| 02-22-2005, 07:45 PM | #1 |
I am using a temporary integer variable (lets call it Temp_Int) in many triggers to hold some number only within that trigger (say, it is a player num of triggering player). Here's a code example: Code:
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Set Temp_Int = (Player number of (Owner of (Entering unit)))
-----
-----
-----
(several actions using Temp_Int, no wait action)I guess such trigger is supposed to run instantly before another trigger can change the Temp_Int. Is that true? |
| 02-22-2005, 07:50 PM | #2 |
Depends. that is true in normal condition But for example if you have a trigger that has A unit loses an item as event, and you change the value of the int in that trigger, Using The Unit - Drop Item action would make the other trigger fire and change the value of the global. That often happens with For loop integer A |
| 02-22-2005, 07:58 PM | #3 |
Well.. what if a periodically running trigger changes the variable? May it accidentally happen right in the middle of the above trigger (if the time was right), setting another value to the variable? |
| 02-23-2005, 12:00 AM | #4 | |
Quote:
think of it this way, imagine this is a trigger [XXXXX] so when we run this trigger, the entire bundle is sent to be processed by the game [XXXXX] -----> Warcraft 3 now even if you have a fiercing running periodical, warcraft will only process a single trigger at a time and everything will kinda just go and 'stack' up [Per05] [Per04] [Per03] [XXXXX] [Per02] [Per01] [YYYYY] ------> Warcraft 3 and if there are no waits in the trigger, yes it pretty much gets processed instantly, and nothing else will happen inbetween a trigger running, unless the trigger calls another trigger, then that trigger will be ran to completion before returning to the original trigger if there is a wait in the trigger, then essentially it will be thrown back to the top and everything will be processed while its waiting ok i know this isn't a perfectly accurate description but it suits its purpose |
| 02-23-2005, 03:54 AM | #5 | |
Guest | Quote:
So an event ( and its actions ) may actually be fired before the running trigger ends? |
| 02-23-2005, 07:53 AM | #6 | |
Quote:
But you can easily controll this, you can always check which triggers may run on some actions and turn them off in the meantime, or just put that action towards the end of the trigger when you no longer need any global variables, or use different global variables in triggers that may overlap (for example, a Temp_Int array, with diffrent indexes for different purposes), or just use local variables. |
| 02-23-2005, 07:54 AM | #7 | |
Quote:
Thanks Lord Vexorian, Raptor-- and Anitarf, I got a clearer view of the mechanics now. Starting to give out rep =) |
| 02-23-2005, 03:52 PM | #8 |
Guest | I see, thanks for the explanation. |
