I am really stumped here, gang.
I am working on a JRPG-style combat system.
There are three types of Skills: Block, Fight, and Magic.
What I would like to happen:
Player selects a skill.
Player selects a target.
AI selects a skill.
AI selects a target.
(So far, so good. The program does things more-or-less correctly up to here)
All Block Skills resolve: Skill name displays, animation plays, numbers adjust.
(This is where things start to go wrong)
All Fight Skills resolve, as above.
All Magic Skills resolve, as above.
Things I have tried:
For these first few attempts, I set everything up as sub-events of a single function.
-- At first, I just set a timer on events associated with resolving Fight skills. This worked, but if nobody selected any Block skills, then there were a couple seconds of dead air before the Fight stuff started happening. Not ideal.
--I tried toggling a "blockDone" boolean once all the resolution steps for Block Skills were complete. This never worked. Couldn't even get Fight Skills to start resolving.
-- I told my Fight skills to wait for the "blocksDone" signal. I attached the "blocksDone" signal to the end of the resolution events to Block Skills. This worked better. Fight Skills started processing immediately upon completion of Block Skills. However, if nobody selected any Block skills the Fight Skills would never start resolving, because no signal.
My most recent attempt has involved:
1) Calculating the number of skills of each type that have been selected.
2) Toggling booleans when the number of skills of a given type is equal to zero, in order to skip unnecessary resolution steps.
3) Running each type of Skill resolution as its own function.
The results of this attempt have been more-or-less identical to my efforts to leverage Booleans when all of resolution was handled as a chain of sub-events for a single function. That is, Blocks do what they're supposed to. Fights never get off the ground.
I believe the problem has to do with when the system asks for the status of my booleans, versus when the booleans toggle as part of event processing. However, after much howling and gnashing of teeth, I can't think of a way to restructure the events in order to achieve the objectives stated above. Plz help?
drive.google.com/file/d/1jpfnlE5EW4MJcQ9Z8sx3hq23bihJoAgq/view
Addendum: Is there a way to track the values of local variables in debug mode? I've just been using global variables, setting them equal to the local variables whenever the local values change, but this seems cumbersome.
Also, sorry, I have no idea why the formatting on this post is so obnoxious.