Trying to make a Combat system

I made animations and wanted to make a combat system where you have 3 part combos and i wrote this code. Its obviously faulty and the effect is that it instantly skipps to the last one and freezes on the first


so i hope one of you experts can find a solution. i can provide more information if needed.

1 Like

Add “trigger once” condition to the main event.
Add a boolean variable and set it to “false” in the main event and “true” in the subevents. Check for “false” in the subevents. So only one subevent is executed with each click.

1 Like

changing global value right after setting animation number will do no good because it will happen in less than miliseconds… event codes work really fast in electric speed :slight_smile: so you need to write another code like:
attack01 animation finished → then → change the global variable to 2 if let’s say attack button pushed
Because you set animation and right after that changing global values make combo happen very fast.
PS: don’t make combo variable 1 right after 3 because it will loop, make it 0 :slight_smile:

1 Like


(Sorry for the late response i was working on some other parts of the game and forgor about this problem) So i did exactly that (don’t mind the questionable variable name) and it worked, however the animation only plays for a single frame and my monkey brain isn’t smart enough to figure out how to fix that even though i know why it happens

Yes, because you change the global variable to the value that meets the conditions in the event immediately after.

My suggestion is to do as @jack’s first part o fhis post - trigger once in the main event.

But I’d get rid of the change global var action in each of the events, and add a 4th event with the action Change the global variable Player_2_Combo : set to mod(Variable(Player_2_Combo), 3 ) + 1