| 12-13-2002, 07:52 PM | #1 |
Guest | Hey guys, Just FYI, I had a trigger setup that would count units as they entered a region. As soon as there was a certain number of units in the region, a integer variable would add a +1 then compare it's value. If it's value was equal to the number defined as the condition, then it would replace all units of type blah. There was also a cinematic put in (I don't know why I chose a cinematic) that would display the current count integer. When the count was filled, and the units were replaced, the units would exponentially increase. For example, if you were replacing 1 unit of type blah, it would create 2 instead of just replacing the first. If you had 2, it would dupe 4 next time the trigger went off. This might be known but it took me a good 10 minutes of trouble shooting to figure out the cinematic count was causing this. Once it was disabeled everything worked fine. |
| 12-13-2002, 09:04 PM | #2 |
I can't say for sure what was wrong without seeing the triggers themselves. Maybe there was something in this cinematic trigger that could be causing the problem. |
| 12-13-2002, 09:49 PM | #3 |
oh, i think i know why...when you create a unit in a region, that counts as a unit entering the region. Other similar instances is when you use the Unit Dies event: killing a unit, setting a unit's health to 0, or even removing the unit from the game will execute the trigger. obviously i've figured ways around this. in reality, Replace Unit hides the old unit and creates a new unit (the replacement) at the location of the old unit. i don't know if this will work with CREATING units however. though, i will give it a shot: make two triggers 1st trig Event: - Unit Enters region Condition: - You're doing the cinematic - The variable is correct - The unit is correct - Whatever Action: - Wait (0.25) - If(Entering Unit is Paused) do (Unpause Unit) else do (Remove entering unit) 2nd trig Event: - Unit Dies Condition: - You're doing the cinematic - The unit is in the cinematic region - The unit is correct to do the replacement Action: - Create Replacement Unit - Pause last created unit now i'm not sure this pseudo code is exactly correct. but the Pause unit serves a valuable purpose here...it essentially serves as a "boolean variable" in a way. the Wait (0.25) is also important because it is sort of a buffer time for the second trigger to be able to pause the unit before the first trigger can run again. since triggers can run simultaneously in a map, if we didn't have the wait, the "boolean variable" might sometimes be checked before it's even modified. as a last note, you don't HAVE to use Pause Unit with IsUnitPaused as the "boolean", you could use other things such as Hide Unit with IsUnitHidden or Make Unit Invulnerable with IsUnitInvulnerable as the "unit's boolean". i hope this helps you |
