Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is there a way to change game mode from blueprint

So I am trying to change my game mode from a trigger in the blueprint so I can have it trigger a different HUD. I need it to go from a game menu to a points HUD and need it to change game modes since you can't have multiple HUDs in one game mode. If there is a way that I would be able to do that without having to switch game modes that would be awesome but if someone could tell me how to switch game modes from the blueprint that would be awesome as well. Thanks in advance.

Product Version: Not Selected
more ▼

asked May 09 '14 at 05:53 AM in Blueprint Scripting

avatar image

124 28 37 45

avatar image Xenome May 09 '14 at 07:05 AM

A good question. Some random musings below:

I would probably try to handle this by using a switch in the HUD class, so that the drawing of the interface branches out in a few different directions immediately after the Event ReceiveDrawHUD depending on some value that would be set and stored in the PlayerController.

Let's say that the PlayerController has a public integer variable named "HUDSelect" that can take on a value of 0 or 1 for example. Then the switch in the HUD would easily be able to check this and go one way or the other, either drawing the stuff related to your game menu HUD (if value == 0) or the stuff related to your points HUD (if value == 1).

The PlayerController is also by default responsible for deciding whether or not to show the mouse pointer and accept clicks on screen, which further speaks in favour of this setup. So, the player would hit some action key (tab maybe) to switch between modes, and at that point the PlayerController event graph can toggle the "HUDSelect" variable to the correct value and also at the same time make sure that mouse interfacing is set to match. Once the Event ReceiveDrawHUD fires, the HUD graph will know what to do.

EDIT: Or perhaps more efficiently, upon switching the mode, the PlayerController calls a public function of the HUD which sets a mode value in the HUD BP directly, which is then used in the switch construct. That way the HUD doesn't have to poll the PlayerController all the time... yeah, probably better...

avatar image Ineni.Realtime May 11 '14 at 11:49 PM

Thanks so much for the answer this is awesome! I will try it out now and see if I can get it working. Thanks again.

avatar image Ineni.Realtime May 12 '14 at 01:45 AM

Short explanation: Can't get live feed event for text in HUD function Wrote all this first. So I managed to get everything working, thank you very much. I have one more question though. For one of my HUDs I'm trying to get scoring working (used to be an event that was associated with a variable that would +1 every time a trigger box was hit) but I cannot add an event in the function part of the HUD. Is there a way I could do that? I'll post a couple pictures because I have a feeling my words did not explain it very well.

What I am trying to do alt text

What it looked like when that aspect worked in event

alt text

avatar image Kronykus Jul 30 '14 at 05:48 PM

For this you could use a local variable, say score, inside the HUD blueprint. When you want to update the score from whichever blueprint, get a cast to HUD and set the value that way.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Continuing from my comment above, I'm pretty sure it's a good solution to have the HUD switch itself based on messages from the player controller. Did some quick tests, and it's all very clean (and actually works as well) so it has to be good :)

Like this:

alt text

So, you don't necessarily change the game mode - you can just change what the HUD is doing.

hud_switcheroo.png (159.4 kB)
more ▼

answered May 09 '14 at 09:12 AM

avatar image

2.1k 64 54 120

avatar image buscas31 Jul 25 '15 at 09:03 PM

You are a GENIUS ! G-E-N-I-U-S!

Tks alot! You bring me back HOURS of work :D

Well done !

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question