I'm wondering specifically about the best ways to pass variables to my primary combat events from formulas as well as the potential hangups. I know from testing that by making my variables global withing their formula chains I can access them in an event after running the 'Calculate' step, but I'm assuming that will cause a number of problems. If combatant A launches an attack for example that switches The 'AttackHandR" and 'PrimaryHand' Boolean variables to true and the "AtkType" string variable to Swing, I'm assuming it's changing those variables for all combatants to access and will run into problems when another attack is launched before their attack event has finished cycling. In my case, the formula steps will automatically set all its variables to a neutral value before changing anything, but I'm guessing that means they'd be reset (changed) before the event has finished using them and might even lead to some unforeseen infinite loop occurrences. Local variables won't pass to an event via the 'Calculate' step... unless I'm missing something.

My current solution is to call a global event directly after the calculate step to change the global variables back to neutral and create a local replacement variable within the event itself so that the event can check them and branch accordingly. This is less than ideal, though. For one thing, I've opted to run my 'hit chance' and 'damage' calculations as two separate steps (calculating different levels of the same ability, so they shouldn't run anything twice) and I'm not sure as yet whether the calculate step takes into account local variables from an event that calls it. If not, then this setup will need to be remapped, but aside from that it seems both a sloppy and less than ideal solution regardless. For one, it's a lot of extra steps to run that could end up putting a strain on processors in large battle scenarios, and for another it's twice as many variables to pollute my database. So, I have a few questions...

-Firstly, I'm wondering how feasible it would be to set up my variables in the ability itself and change them inside formulas using selected data.

-Are changes made to ability variables local for each instance as they're called by a combatant? If combatant A makes changes to their ability variables will those changes also be present when called by a separate combatant?

-Are ability variables changed within a formula retained, locally or globally, after the event has finished?

-Is their a way to customize the calculate node so that it checks for certain numerical and variable values, and/or create more branching options than the four (hit, critical, miss or block) that are available by default? Maybe, as an updated feature, you might simply include conditional checks to the user and target requirements and allow it to check against formula results before finishing.
  • Local variables (and selected data) are shared between the battle events used by an ability and the formulas called by those events (e.g. the damage calculation cauesd by the Calculate node).
    So the easiest thing to do this is using local variables :)

    Using ability variables is also possible, since they're bound to that the combatant's instance of the ability (unless it's a group ability). So yes, those changes are local for that one ability of the combatant.

    Changes to variables (local, global, ability, etc.) are always retained.

    You could do those checks before or after the Calculate node and to whatever you need to do based on that :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • -"Local variables (and selected data) are shared between the battle events used by an ability and the formulas called by those events (e.g. the damage calculation caused by the Calculate node).
    So the easiest thing to do this is using local variables :)"

    Events? Do you mean the battle events tied to animations? Because the formula chains that I'm trying to draw variable references from via the 'Calculate' step are being run by 'Hit Chance (%)'. In any case, changing the variable types to global is the only way I've been able to verify successful changes made by those formulas after running them through the 'Hit Chance' step. That was the only change I made between failure and success, as were checked and verified by conditional dialogue comments. When variables were left local inside the formula chain I always got the same static string of comments, whereas after changing them to global I started seeing things like, "Right Hand, Swing, Cut, Critical, Blocked", or "Left Hand, Thrust, Pierce, Dodged" etc. Those are the kind of variable references I need to be sure pass through my formulas as an inviolable single instance of rolls, checks and changes for events to determine how they should branch, and they weren't being passed on a local level. Also, thank you for the smiley face.

    -"Using ability variables is also possible, since they're bound to that the combatant's instance of the ability (unless it's a group ability). So yes, those changes are local for that one ability of the combatant."

    So, in any case, what you're saying is that I can indeed use my formulas to change and check the variables I've assigned to the ability used to call them (or whatever ability is selected) and no other combatant's ability variables will either be altered or conflict, correct? Not to put you in a feedback loop. If I add a host of Boolean variables to the base attack ability and check them off accordingly as part of the hit chance calculation, I'll be able to keep them for checking throughout the length of my event, including the time it takes to run animations and such, and nothing else should be able to effect, or be effected by them.

    -Changes to variables (local, global, ability, etc.) are always retained.

    Now I'm more confused. I thought that changes made to local variables were only retained for the duration of their being called in a specific case. Can local variables conflict? If I'm using 'TimesLooped' for every formula that cycles to add or subtract a certain value for instance, could it potentially ever be given the wrong value to check against by changes made to that variable in another formula. I haven't noticed anything like that occur, but I'm still in the nascent stages of testing.

    "You could do those checks before or after the Calculate node and to whatever you need to do based on that :)"

    It seems that another way to handle this might be then to somehow run certain formula chains in my battle event and then pass the results to a 'Calculate node'. This is one solution I would have preferred early on, and would still prefer, but I don't see any way to go about it. It seems that I can run a formula by checking its value, but this isn't any good to me unless it can be made into a fork, i.e. 'value is equal to 100101011001', 'value is equal to 10110001111', and so on. I could set that up using a check fork that runs the formula once and then branches into the correct line of sequences, but I can't run the same formula chain again and again for each check because it should return a different value every time it's run.

    The other option it seems might be the 'Formula to Variable' node, but that would only be of any use if the variable's value could be set to that of the formula it calls. It seems, however, that I'm required to set the value of the variable manually. I can't set the variable key 'Value' to be whatever numerical value the formula itself returns... or is that done automatically. I found this to be unclear looking at the node,though its name implies setting itself automatically. Too bad we can't test events like formulas, though I do get that they're entirely different animals. Also, I'm unsure of whether running a formula through either of these steps will pass along variable changes, but if possible I would indeed prefer this method to anything mentioned above. Also, thanks again for the smiley face.
  • Yes, battle events - all battle events of the ability share the same local variables, and they're also used in all calculations like hit chance or status value changes. When and where did you check the local variables after the calculation?

    Correct, abilities (and base attacks) are individual instances for each combatant - only group abilities would be shared instances for all combatants of a group. However, the ability variables will not be reset after the action/events finished, whatever changes you make, they're stored in the ability's instance.

    Variable changes are retained in whatever lifespan their origin has - e.g. global variables pretty much forever, local variables for as long as an event (or action) is executed. It's not the case that e.g. you change local variables in a formula and those changes would be gone after the calculation - the changes are still present in the local variables of the event that caused the formula calculation.

    Formula To Variable stored the result of the formula calculation in the defined variable key - the Value field here is the key, not the variable's value.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • "Yes, battle events - all battle events of the ability share the same local variables, and they're also used in all calculations like hit chance or status value changes. When and where did you check the local variables after the calculation?"


    Thanks, that's enough chasing around that particular question.


    "Correct, abilities (and base attacks) are individual instances for each combatant - only group abilities would be shared instances for all combatants of a group. However, the ability variables will not be reset after the action/events finished, whatever changes you make, they're stored in the ability's instance."


    So, if I don't reset my attack variables at the end of the battle event, every combatant might be walking around with ability variables set to different values, but that would only effect their next use of the ability (or anything that might reference the ability's variables as selected data) and it shouldn't really matter if I select to reset them at the end or beginning of an event.


    "Variable changes are retained in whatever lifespan their origin has - e.g. global variables pretty much forever, local variables for as long as an event (or action) is executed. It's not the case that e.g. you change local variables in a formula and those changes would be gone after the calculation - the changes are still present in the local variables of the event that caused the formula calculation."


    Right, so local variables are forgotten once they're done being used. You know your system better than I do, but I'll state again that my local formula changes were not transferring into the event simply by running the Calculate node. I can't say why, I just know that they weren't effecting anything until I switched them to a global reference. I use a lot of separate chains tied together by a single call at the beginning of the ultimate formula. Maybe that's the issue.


    "Formula To Variable stored the result of the formula calculation in the defined variable key - the Value field here is the key, not the variable's value."


    Perfect! So if my formula ends as 777, the variable could be named "Starsky," or "Hutch," or "Huggy_Bear" or possibly even "SnoopDog," but its value is 777. Are variable changes made by running that instance of the formula also then tied to the new variable as selected data? If I run a chain of events and set the variable to "Local" will it carryover an infinite amount of times until the event concludes?
  • Correct, each combatant's ability would have their separate changed values that only affect their own ability use. Resetting at the beginning or end of the use doesn't matter (unless the ability variables are used somewhere else as well) - just keep in mind that whatever changes you made will stick with the ability.

    I'll check out changing local variables in formulas called by the Calculate node. It should work like that, might be a bug :)

    Selected data and variables are separate things - you can use selected data as a source for variables (which could e.g. be ability variables of a selected ability or object variables of a selected combatant or game object), but it's not the same.
    As long as the event runs (or events called by it), the local variables will stay alive.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.