Activating/deactivating abilities from UI

I want to be able to turn abilities on/off based off UI input from the user, but I’m struggling to make it happen.

Right now I have a bool in the AbilityControl struct and I’m checking it at the top of the update function in the Ability_RequestActive system. The problem is I don’t know how to set the value in AbilityControl from UI input.

Is the best way to try to accomplish this? If so how do I set the bool in AbilityControl?

You need to add a new member “Entity character” to AbilityCollection.InternalState and initialized it in HandleCharacterSpawn.Initialize. Then you get UserCommandComponentData from the character entity when update.

1 Like

Thanks for responding. I was able to get it working this way. Is there a way I can do it from GUI instead of using UserCommandComponentData?

I’m having trouble understanding how to have GUI input interact with ECS.

You should be able to run UserCommandComponentData by clicking a GUI button or setting a GUI check mark.
Try to add what you need to an existing menu like when you press ESC ingame or in the option menu.

When you get this working you can then add a new menu (by seeing how Options work) to hold whatever it is you need.

On a side note. You dont have to use ESC to make a new menu. You should be able to add it like you normally would before ESC were implemented.

Nice. I was able to get it working. Thanks guys.