Page 1 of 1
MA to test for MAs?
Posted: Sat May 26, 2007 6:31 pm
by t o x y n
I'm trying to figure out a way for an action (movement) to activate only if three other actions (TUNIs) are successful, not just one or two, all three and at the same time they must be successful.
I cant figure out a way to do it, if its possible, how do you do it?
Basically, I'm looking for a unit to do a movement aciton only when the player has units in three seperate areas at the same time, inside each polygon'd area (seperate TUNIs setup for each area). I just cant figure out a way to activate the movement action ONLY when all 3 of the TUNI actions are successful.
Posted: Sat May 26, 2007 7:25 pm
by Myrd
Nest them.
Let's say A checks if units are in location X, B checks if units are in location Y, and C tests if units are in location Y.
If A is successful, have the B action activate, if B is successful, have the C action activate, if C is successful, then all three (A,B,C) are successful, and you can activate your script.
Posted: Sat May 26, 2007 9:44 pm
by A-Red
Yeah, with location TUNIs that's a good way to handle it--or anything that requires three actions to be active simultaneously. You'll want those TUNIs to deactivate "never," so that if a unit leaves and comes back it will still work--Also, a failure of TUNI A should deactivate TUNI B and so on, so that a single unit can't wander from A to B to C and set them all off.
If you wanted to test for three actions that have been active, there are tricks for doing that too (you aren't, but I'm just throwing it out there for reference). I usually use a "counter" unit for things like that, one that has no movement capacity and all of its sequences are blank so it can be visible for engine purposes without being visible to the eye. If an action activates, a counter appears--so then if all three have activated at one time or another, three counters will be visible and you can use a test for that number of them to do what you want. Why is this useful? For example, let's say you have a series of six randomized waves, and you have a really tough wave that don't want to show up right away--say you want it to only be one of the last three waves that appear. So you put the other five in the action list that dispatches waves. Then every time a wave appears, a counter appears. Once three counters have appeared, you activate a Munger that adds in that tougher wave, and it will then be random only within the three remaining waves. Neat, huh?
Posted: Sat May 26, 2007 11:47 pm
by Zeph
or you could put a dummy unit with mana.
Every time an action succeeds, give x mana to dummy unit.
Test for mana greater than y. Here's your counter.
Posted: Sun May 27, 2007 8:20 am
by t o x y n
cool stuff for sure, thanks for the replies fellas
Posted: Sun May 27, 2007 3:19 pm
by Pyro
Zeph wrote:or you could put a dummy unit with mana.
Every time an action succeeds, give x mana to dummy unit.
Test for mana greater than y. Here's your counter.
I kinda did that but not with its mana... with its ammo.