I created an effect-target ability with which a unit launches a projectile and unloads a unit in its cargo at the projectile's impact location when it impacts, using a calldown effect (which is working fine). I also created a marker system using a buff to mark each cargo unit, because validating cargo count isn't sufficient to avoid launching more projectiles before the current ones have landed (even though the unit doesn't have any units in its cargo anymore), because the units are only removed from cargo when the projectile lands.
A stack is added each time the carrying unit loads a unit (load transport effect in the transport bail) and a stack is removed each time a unit is unloaded (same thing for unload). Then, when the calldown ability is used, a stack is removed when the projectile is launched. However, the use of the calldown also procs the unload effect which resulted in two stacks being removed per cast. However however, when I added an effect to the impact to add back a stack (to compensate for the double removal) it no longer removes a stack from the unload (leading to too many stacks). Even more infuriatingly, if you simply set the stacks added upon impact to 0, the calldown removal works again (too few stacks again).
I'm not really sure what to do, the editor just spits out every other result apart from the optimal one. What am I missing here?
Why not just add a stack to the caster when launching and add a validator to check if the stack count is greater than the cargo count? Did you use a set too in your previous method?
You can use a validator to compare behavior count and cargo count? Wow, that would simplify things. Which validator type do I use?
EDIT: I solved this using a Function validator. Function validators allow you to test lots of different cases, so I made a lot of validators (cargo is greater than 0, greater than 1, greater than 2, all the way through 11 (because 12 is my unit's cargo capacity), and stacks=0, stacks=1, stacks=2, all the way through 11). I set a buff stack to be added when the projectile is launched, and removed when it lands (no more stacks when loading or unloading). Then in function validator I created 12 lines with test: cargo=0, return: cargo > 0, test:cargo=1, return: cargo > 1, test:cargo=2, return: cargo > 2, etc. The Return validator is the validator for that line, and the Test validator means that if it returns false, that line is skipped. So basically what the whole this does is check if stack count = 0 (0 projectiles in the air), check that cargo count is greater than 0, if stack count = 1 (1 in the air), check that cargo count is greater than 1, and so on.
I created an effect-target ability with which a unit launches a projectile and unloads a unit in its cargo at the projectile's impact location when it impacts, using a calldown effect (which is working fine). I also created a marker system using a buff to mark each cargo unit, because validating cargo count isn't sufficient to avoid launching more projectiles before the current ones have landed (even though the unit doesn't have any units in its cargo anymore), because the units are only removed from cargo when the projectile lands.
A stack is added each time the carrying unit loads a unit (load transport effect in the transport bail) and a stack is removed each time a unit is unloaded (same thing for unload). Then, when the calldown ability is used, a stack is removed when the projectile is launched. However, the use of the calldown also procs the unload effect which resulted in two stacks being removed per cast. However however, when I added an effect to the impact to add back a stack (to compensate for the double removal) it no longer removes a stack from the unload (leading to too many stacks). Even more infuriatingly, if you simply set the stacks added upon impact to 0, the calldown removal works again (too few stacks again).
I'm not really sure what to do, the editor just spits out every other result apart from the optimal one. What am I missing here?
Why not just add a stack to the caster when launching and add a validator to check if the stack count is greater than the cargo count? Did you use a set too in your previous method?
You can use a validator to compare behavior count and cargo count? Wow, that would simplify things. Which validator type do I use?
EDIT: I solved this using a Function validator. Function validators allow you to test lots of different cases, so I made a lot of validators (cargo is greater than 0, greater than 1, greater than 2, all the way through 11 (because 12 is my unit's cargo capacity), and stacks=0, stacks=1, stacks=2, all the way through 11). I set a buff stack to be added when the projectile is launched, and removed when it lands (no more stacks when loading or unloading). Then in function validator I created 12 lines with test: cargo=0, return: cargo > 0, test:cargo=1, return: cargo > 1, test:cargo=2, return: cargo > 2, etc. The Return validator is the validator for that line, and the Test validator means that if it returns false, that line is skipped. So basically what the whole this does is check if stack count = 0 (0 projectiles in the air), check that cargo count is greater than 0, if stack count = 1 (1 in the air), check that cargo count is greater than 1, and so on.