Changing game state?

So my main character will be using magic of the four base elements (Wind, Water, Earth, FIre). How can I set it up to where I can change the elemental state depending on which D pad button I press? In correlation each state will change the spells I want to assign to the two bumper, and two trigger buttons on the controller. So to simplify if I press Up on Dpad the four buttons will have wind spells, then if I press down on D pad the four buttons will change to fire spells? Any guidance would be greatly appreciated :slight_smile:

I’d consider making a state machine. Your character can be in state Wind, Water, Earth, or Fire at any given time. Depending on which one your character is in then go about assigning the corresponding buttons to the corresponding spells. Don’t do it in a tick as that would be unnecessary. Rather on spawn character or BeginPlay assign a starting state or a last saved state to your character and then go about assigning your spells. Whenever you change state or press a dpad button reassign your buttons to the corresponding spell.

If that answer helps please upvote my question @ IOnlineSession::FindSessions() sends weird warning - Multiplayer & Networking - Epic Developer Community Forums
Hope this helps!

How would I go about starting a game state for each element? Im really not sure on how to initially set up my BP nodes?

If your animations won’t be changing, an enumeration might work to distinguish your spell states. When you press a dpad button, you will update the current value, then trigger an event that switches the spells based on the current enum value. Let me know if you need an example of this.

An example would be great! I am a visual learner especially when trying to figure it out on my own. SO any help would be great. The animations really wont be changing just the actual spells themselves. I just dont understand where to begin, as far as where to build the actual states and if this needs to be done in the third person BP.

Sorry for the delay. Here is an example of something you could do. It’s not the only way to do it, but it might give you some ideas. I created an enumeration to define the different elemental states. Then in the third person BP I made a custom event that is triggered when you press a D-Pad button. Let me know if this helps, or if you have additional questions. I’ll probably make a short walkthrough video when I get the chance.

293347-statechange-unreal-editor-11-28-2019-1-21-53-pm.png

OK so I have that set up, and it seems to work fine according to the print strings. How do I exactly call each state? How should I set up each state as far as when I press the input it switches to the spells and such regarding that state? Is this done through a library, or stats, or ??

I guess I am trying to ask, is how and where do I call the spells for each state?

You probably don’t want to change the game state every time you change elements. Using what Uproar said above you would want to keep an enumeration variable, let’s call is SpellMode within your character controller. Then upon clicking a dpad button you change SpellMode to be either wind, fire, earth, etc. Now whenever you launch an attack you can check what SpellMode you are in and depending on the element you launch the corresponding attack. Hope that is clear!

Ok so I have been working on this the last few days…and Im having a tricky time understanding the process of accessing the buttons and correlating spells to each elemental state… Like I can press the button and it tells me im in the chosen element state…but how to i get it to call the spells? I will essentially have 4 accessible spells in each state with each state having its own skill tree and so on.
I really just dont understand how to call the abilities

So Im still running into a snag. I have been creating a skill system and a hot key slot. I am trying to create the hot key widget from the switch on element state node…not really sure if this is the right way. When I press the key for fire state the print string still shows but the hot keys wont work…any suggestions my friends?

Ok so I have it now where the hot keys are showing but Im not really sure how to take away the other widgets or deactivate them while i am entering another element state? It gives me errors I believe because Im trying to reference the same hot key slots.

My first suggestion would be to move the widget creation nodes to your onbeginplay event. And then use the AddToViewPort and RemoveFromParent nodes to show/hide them. There’s no need to create a new widget instance each time. For each output in the OnStateChange event, you should display the desired widget, and remove the others from view. Start with that, and let me know what the result is.

In general, you would need to set up an input mapping to trigger the state switch and a second one to trigger the spells.

Did you already figure out how to set up input mappings?
if not this is a good start

If you did that you would basically listen to the events you have to trigger the magic,
e.g.
Big Magic, Small Magic …

and then use a Switch Node to do the different magic stuff dependent on your current selected magic kind.

I am not sure if I am setting this up right. When I press the input the widget wont show and I keep getting these errors.

Hey everyone it has been a while and I hope everyone’s is doing well in these current times. I am in need of assistance. As mentioned above I am going the route of the elemental states being triggered by a dpad button. How would I go about making a htkey bar for each state? I have been running into errors as when I go into fire I want the moves slots to show and when I go into another state I want that hockey bar to show and make the other one disappear.
Also I am trying to use the same key mappings for each slot which is giving me errors I believe because I am hitting right bumper to use a fire move but when I use right bumper to use a water move I am getting errors. Can anyone guide me?