Bug that allows the action to replay every time you click action button


Reported by: Eldar Bertsel

September 29, 2023

THE PROBLEM

I had in issue where if the player would press any of the action buttons like light, heavy, ability1, ability2, and/or ultimate ability it would be able to play it at any time. While you are rolling, or jumping. It would play them together if you press multiple buttons at the same time. You could also move while performing certain abilities and spamming the buttons would constantly replay the actions. 

THE SOLUTION

The issue occurred because there was nothing preventing it from happening. I basically had a bunch of actions bounded to different keys that would play different animations. 

So there were 2 parts in that problem. First one is spamming action keys would replay animations and sounds. Second one is being able to move while executing certain actions. 

To solve the first issue I had to create 2 functions. To turn on and off a bool variable. Then in each of the animations I added 2 events. At the beginning the bool is getting set to true, meaning we are mid performing an action, then at the end of the animation the bool is set to false, meaning that we are not performing any action anymore. Then I would just check whether the bool is on. if it is then any new action will be skipped until the current action is not finished. This solution works well and it can be adjusted to match each action animation making it a good solution for unique animations. But you have to manually add the events and add a check into each of the action call.

To solve the second issue I had to create another bool. This bool is added to each of the action's scriptable object and basically tells whether the player character should move during this action or not. Same bool also created in animator to reset it later. Now in each function that performs an action I set the bool in the animator to be equal to the bool in the current action's scriptable object. Then in the update where all of the functions are called I am checking whether the animator's bool is true. if it is then the player should not be moving right now. If it is not then the player should be moving right now. Now with that change I can modify each of the abilities and light/heavy attacks to say whether the player character should or should not be moving during their execution. Don't know if that is a good solution but it works.

Get Psyche

Leave a comment

Log in with itch.io to leave a comment.