Calling the event receive Draw HUD on Custom event

I have a gameOver custom event in the hud which is called by another actor blueprint. When event is called I want to draw to the HUD. is part 1, and works fine.

I have an Event Receive Draw Hud that fires immediately upon level start. The words show up, everything works, except it is the wrong time. is part 2, and works fine - just at the wrong time.

How can I connect these two with wires so that when the gameOver custom event is called, it is THEN that the Draw HUD action takes place?

Along the same line of question, how can I have more than one HUD call, driven by events in game? I seem to only be able to have one Event Receive Draw HUD in my graph…

Thanks,

I got it to function for ONE event using gates. only will allow a single event receive draw hud…so it can’t best practice. I want to be able to use the HUD wherever I want for draw text’s.

is what I am doing now to get it to function:

How can I keep functionality, but give myself the ability to have multiple event receive draw HUD calls?

thanks,

I made with a switch on enum. i define the different states of the hud in the enum so that i can call them by name.

You then can make that enum public and set it from where you want to switch the hud.

Multiple DrawHUD-Nodes would be awesome. Like DrawHudElement nodes. I kind of tried to build a system like that. where you can setup screens from text and input elements

But i think with 4.4-5 when UMG is in an usable State might be obsolete.

@ajvnd - that seems more complex than I want to dip my toes into right now - but nice job if it works.

I can’t believe there isn’t a simpler process to achieve the functionality I am looking for? (want to draw to the hud at different times driven by different events).

Yeah that exactly how i use it. Only that i don’t use Events for that. Just getting the HUD from the Player Controller and set variables what to draw in my HUD.
You can still use Events to set those variables. Only that those Events are outside the HUD.

As i said before, With UMG you will be able to do such things in a more intuitive and streamlined way.
Why exactly do you think is complicated?

You could set a bool variable called “isGameOver” when the gameover event fires, and then when you are drawing the hud, use a Branch to check if the variable value is true, if it is, then run your end of game hud details, if it’s false, just use the normal hud.

The Hud draw is called many times per second (I think it is called on tick) so should get the correct timing.

Would that work or am I over simplifying it? :slight_smile:

Haha nailed it :slight_smile:

Thats basicly what i wasn’t saying :smiley:

OK kids, I am learning - so @ajvnd - the whole idea of an Enum in general is question! But I am here to learn. And UMG is…(about to google it)

I think I did a little of both what you and @ said - I had my custom events first set a boolean variable. When that variable is set to true a branch opens, and then flows through a gate that is opened by setting that variable.

It all ends up running through a sequence that linearly tests each branch to see what goes true when:

I know there are a lot of ways to solve problems, but is anything that I am doing TERRIBLY wrong in solution? A concern I have is the constant testing of branches to see if the values are true. As @ said, is the tick of the HUD (right?) - will getting a number of these stacked in a row start causing noticeable lag?

Making progress, thanks to all for the help!

In your BP, instead of using two branch statements, replace your “sequence” node with the branch and use the True output to go to the top part, and the false to the bottom, other than that is looks just fine.

A boolean operation is actually very cheap performance wise, you could have hundreds of them before you would notice any performance issues, Because it is only running one of the 2 operations (either true or false), and not having to run both true and false statements, it can actually save performance for you.

I would not worry about branches affecting performance, it is more the operations that occur after the branch you should be more worried about. :slight_smile:

Just in case what I wrote was not entirely clear, I threw together a quick example of what I mean. I used a Timer and DrawText nodes only as an example, you could modify and run your own functions in place of these:

Hope that helps!! :slight_smile:

@ - I initially tried using the branch instead of sequence but I ran into trouble when both were true. If the condition was true, the second branch that would have triggered if false (if I stacked them) wouldn’t get a to be evaluated. I figured using a sequence I would step through and evaluate each situation as it does the work linearly. As I can add pins to the sequence, I can manage all my HUD calls way.

Right?

Yes of course, I also use the sequence in mine as it makes things easier to compartmentalize, I just meant that if you have are using two separate HUD setups (one for normal in game, and a separate one for end of game) instead of using a sequence there, it would be simpler to just replace it with a branch, so that it would run the end of game hud if the value is true, and the normal hud on false. It just saves a step. But if using a sequence, you would then want only one branch afterwards (as in my image above) to run one or the other, as you don’t want to run both hud’s onscreen at the same time (or do you? let me know if I am not understanding correctly).

I just noticed in your last BP screenshot, you have both of them evaluating as true. You would want to instead have one using the false pin, otherwise both of them will run every time the hud is drawn, it would be better performance wise if it did not have to do .

Let me know if is the way you were intending it to work, I can expand on the example if it would help!

Ok - followup question. One of my messages says “One more to go” when they have all but 1 jewel they are collecting. If I put a delay, and then destroy actor on that specific draw text like :

…I am not able to access the HUD again? It is almost like I destroy the HUD altogether with destroy actor, not leaving it to be used again. The message I do want to disappear DOES go away…but my “Level complete” message no longer functions when final jewel is collected.

I CAN get the level complete message to show up if I collect last jewel before the 3 second delay destroys the actor - so I know from that standpoint I have functionality.

How can I setup different drawtexts to be cleared after a specific time, or key press? Specifically I want the “One more go” message to disappear after x seconds - without affecting the rest of my HUD calls.

I do it , at last you dont need variables.

Btw Imo, Try to dont use game logic in hud, use othe blueprint and comunicate with the hud only to show the data.

But as I using a boolean value to prevent the true side of the branch from running, I am not having each one run every time the hud is drawn, only when that boolean variable is set to true, right? I am not for example even hitting the gates for the each condition unless that specific boolean value is set to true. It IS continually testing on if they are true - is that a problem?

If I do it your way, won’t I only get a choice of only true / false, so 2 potential messages to the HUD?

Without using Ue4 speak, I want to be able to put up messages on the screen driven by events. Specifically:

  • “Welcome message” and instructions.

  • “1 more ring to collect” - when all but 1 ring is … collected.

  • instructions toggable bound to key.

  • a level over message with time it took to complete the level (I can do the timer later)

So I want to be able to draw and hide these at will, driven by events in the game, user input, or based on score for example.

For me the confusing is the single “Event Receive Draw HUD”. If I could have more than one of these (really, how can that be so hard? I don’t get it.) I would be able to separate these different messages.

Recommendations?

Ok, so I cobbled together to handle the message lasting for only x seconds before leaving. In essence I start with a boolean as false. The message is only sent to the draw text when made true (from event in scorekeeping blueprint). Then after a 2 second delay I set the boolean back to false. It doesn’t destroy the HUD / Draw Text, it simply stops sending data to it.

It functions…and it makes sense to my brain…please tell me if I going to break the matrix doing it way.

I need a break, going for a run.

Thanks to all that helped, and continue to help!

Put a secuence after “Event Receive Draw HUD”, now each pin can handle diferentes Draw Text. and use the Gate to cut the update Signal.

@erWilly - makes sense - and so long as the engine is NOT calculating / processing down each potential tree (only when the gate allows), it won’t hamper performance yes?

Thanks,

Yes, the signal is stop in the gate when it is close.

well, it is depend how many gates you have and the hardware you aim, but I think that you need myriads to break matrix and start to see Blondes.

Sorry I had to run out for a minute, but your setup in the screenshot should work, I don’t think you will break the matrix. :slight_smile:

And what erWilly posted is definitely the way to go, pictures make things so much easier to explain, thanks for that erWilly. Things get complicated when using delay timers as every time the Draw Hud event fires, it would re-evaluate the same data without a gate (meaning it would create a new timer each time without a gate), so using gates will definitely be necessary to get the functionality you are looking for. Performance wise as well, the gate will make sure the different messages in your tree aren’t running unnecessarily.

For getting more than just one true/false, have a look into using a Switch statement, it is basically multiple Branch statements in one node that the blueprint would go through and test each case, and run only the ones that evaluate as true, that could be another way to go, but it can also be complicated to wrap your head around. Just keep it in mind if later you notice that you are using a lot of branch statements, as it could make it more readable.

Sorry I got a bit confused as to what you were wanting to achieve, but it looks you are on the right track now!