• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

"Last Created Unit" - interfering with more triggers

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2009
Messages
257
Hello, basic question:
If ive got more triggers with any action that uses "Last created unit" (Order Last Created unit to X Y etc.), can they interfere with each other? Or, actually, to what extent can they interfere? I mean, does that "last created unit" refer to last created unit in given trigger, or it can refer to unit created in different trigger at the same/similar moment?


Currently bug occured to me, when 2 triggers happen at almost same moment, one then gives expiration of 2 seconds to last created unit, the other one 180secs to last created dummy unit, and somehow it misfires and the one that should get 180secs gets 2 sec and the other way around. Really, wtf? :D

So, basically, i know it apparently can bug, but, anybody has got any ideas when this can happen (this was 1st time for me) and how can i fix this? Adding "wait 0,1sec" event to other trigger?

Thanks :D
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
If Last Created Unit has been used into different multiple units, yes it would greatly interfere and there is some chances that the editor will treat a wrong unit as Last Created Unit. Best solution is what MT said. Storing them into variables makes it more clearer and efficient and Editor will treat proper units as Last Created Unit.
 
Level 20
Joined
Apr 14, 2012
Messages
2,901
Also, a possible explanation of your problem would be this:

Trigger 1 creates a unit , trigger 2 creates a unit at the same time ; if you add a generic expiration timer to both units after you create them, that will cause a problem.

To avoid this problem in the future, add forth two different variables for Unit1 and Unit2 :))
 
Level 7
Joined
Aug 19, 2012
Messages
244
I have same question too
I have 2 triggers that wirk at same time
First trigger
Create unit A wait for 0.2 then order last created unit
Second trigger
Wait for 0.1 then create unit B

The question is who is the last created unit in first trigger, still A or change to be B

More question
If we create a unit A then order last created unit
Does it can chnged? I mean the unit, it will order A or can be change by other trigger that work at same time?
Does the trigger run directly (no wait) ?

How abouy two triggers that work same time
First trigger
Create unit A then set unit variable A for last created unit
Second trigger
Create unit B then set unit variable B for last created unit
Can it be miss (var A is B, and var B is A)???
 
Wc3 only runs one trigger at any given time. So having cross bugs is not possible unless u use something like waits or timers which pause triggers and then the next trigger is run. It would help if u posted the triggers in question.
As a rule anything u use twice or more should be stored into a temp variable. This is for speed and efficiency
 
Level 20
Joined
Apr 14, 2012
Messages
2,901
I would personally RECOMMEND that you read deathismyfriend's tutorial about GUI coding. And you might also want to make it a habit of posting the triggers that are involved in your problem.
something like that.
+REP to you.

But good point thought, death. Having waits or pauses between triggers might make it possible for them to cross-actions... can't believe I forgot

Though I would really like Ragon.Slear to make his own thread, answering one here wouldn't hurt:
I have same question too
I have 2 triggers that wirk at same time
First trigger
Create unit A wait for 0.2 then order last created unit
Second trigger
Wait for 0.1 then create unit B
First I would like to point out that my thoughts about the problem might be inaccurate or wrong, but if the purpose of the two triggers is to create different units, why not just create two units in one trigger, like this:
  • Unit - create 1 unit a at (x, y)
  • Unit - order last created unit
  • Unit - create 1 unit b at (x2, y2)
  • .
  • .
A much more better thing to do is store units a and b into variables since you might use them again later.
 
Last edited:
Status
Not open for further replies.
Top