Im stuck here:
When event is triggered (pressing the attack button, for example), the function "eCombatMath_Attack" is called. When this function is activated, it triggers an another function ("eAnimations_DummyAttack") which contains the "start attack" animations. After "start attack" is finished it returns a value to the "eCombatMath_Attack" function, so that the first function knows when to continue. If animation is over and ReturnValue is delivered, this function will check if event is true or false (for example: blocking) and then it will continue; after dealing the damage, it calls an 3th function ("eAnimations_DummyPositioning").
Press button > call calculation > show animation > if attacked player successfully blocks, then lower the maximum damage; if not, deal damage > show animation where player gets back to his starting position > idle
My problem is:
The function eigther doesnt return a value, or the first function doesnt wait for the ReturnValue of the second (wasnt able to debug that >.>).
Im trying to minimize the usage of variables (everything, whats possible at least, is contained in several arrays... 3x3D arrays are totally enough at this moment) and would like to only have multiusable functions (1 single function for combat attack maths for all kinds of attacks, 1 routine for all kind of player-/enemy-animations, unregarding which skin/individual animations they got, etc...). The aim is reaching a "lightweight" source and minimize CPU traffic.
Is that even possible (returning something from a function to an earlier triggered function which continues running)?
Yes, multiple questions in one suck, but I dont want to make an another topic for this... - did someone of you already make such "combatsystem" and has tips for me? Or are my thoughts bullsh*t about how the system works | got an better solution for this/has a link/site/wiki for me where I could improove the whole process | encountered the same problem | has an idea how to make this code more "elegant"?
Heres the code (sorry for not providing the *.capx, but I dont want to publish the whole source from this project ):
(1) How the function is triggered (that you know where the params came from. (Arrays Y values: 9=current stamina; 11=cost for attack-type | checks if attack can be performed)
(2) This is the "eCombatMath_Attack" function which triggers the animations (Math should be done here, Animations should be done there) and waits for the ReturnValue to continue
(3) This is the "eAnimations_DummyAttack" function which is triggered from the previous function and should return value to the previous one after finishing
The "eAnimations_DummyPositioning" function isnt implemented yet - first I need a solution for this question
If anything is unclear, please ask... I really need a way to get this done :/
Have a great day,