HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Are triggers with no 'wait' actions instant?

02-22-2005, 07:45 PM#1
D0nk1ckh0t
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
Vexorian
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
D0nk1ckh0t
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
Raptor--
Quote:
Originally Posted by D0nk1ckh0t
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?

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:
Originally Posted by Lord Vexorian
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

So an event ( and its actions ) may actually be fired before the running trigger ends?
02-23-2005, 07:53 AM#6
Anitarf
Quote:
Originally Posted by Sabugostorm
So an event ( and its actions ) may actually be fired before the running trigger ends?
In rare and controllable situations, yes. If you have an action in your trigger "create item for hero" and another trigger with the event "unit acquires an item", then the second trigger will run while the first one is still being processed like if you used the action "run trigger". Same goes for "drop item"+"unit looses an item", and maybe also others like "create unit"+"unit enters playable map area", but I'm only certain about the item actions, just guessing about the units.

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
D0nk1ckh0t
Quote:
Originally Posted by Sabugostorm
So an event ( and its actions ) may actually be fired before the running trigger ends?
Lord Vexorian says this is true so I guess if an event fires in the mid of another trigger then the event's actions are completed BEFORE the first trigger may continue. That would explain my global Temp_Int change.

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.