Is there a graceful way to break out of a multi-gate branch? Basically, at the moment I have a struct containing related variables that have to be processed in a certain order. I’ve also created a function which takes an integer and passes it as an index to the multi-gate. In the set functions, I have a call to the multigate function that defines the entry point into the multi-gate, and it is set up so that when var a completes its processing, it calls var b, var c, var …n until each node has been gone through. The only time this is an issue is when, for instance, you enter the multigate from var c, and somewhere down the line it has to update var a (it’s a rare occurrence). What I would like to do is to be able to issue a stop execution command to the multigate so that I don’t end up with the same sequence being processed simultaneously at two separate points in the sequence.
I was pretty careful about avoiding circular dependencies, but here is the rough and dirty version:
I have a struct containing base values for a character stat. Each stat has several elements that will be used to calculate the end result that is being passed out to various things such as combat strikes and what not.
Some of the variables are completely independent:
baseVar1
baseVar2
MaxLvl
The reset of the dependencies start at the Level of the stat, and trickle down:
- Lvl
- Current XP
- XP to Level
- XP%
- curVar1 (modified baseVar1)
- curVar2(Modified baseVar2)
- (I update the three non-dependent guys here.)
- baseVar3
- baseVar4
- baseVar5
- curVar3
- curVar4
- curVar5
These 12 (except #6) MUST be performed in sequence because they are value dependent on previous updates. I’have a working version that is crudely hacked together, and just sets them all in order, but it is hard to read and not very flexible.
The only issue with the multigate comes in with the XP. When the level is incremented, when the xp crosses the threshold to level. Working in one big graph this is no issue, really, but in the multigate scenario, what happens is that the XP crosses the threshold to level, and triggers the level up, and continues execution through gate 2 and onwards. Meanwhile, Gate 1 is triggered by the level up, and now you have two sets of sequences running.
Really what I am looking for is for a way that In can enter this sequence at any point in the chain and continue onwards, but break out of the chain if needed. And do it neatly. Neat code is not as buggy and easier to troubleshoot.