• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Item - Remove runs the trigger twice

Status
Not open for further replies.
Level 3
Joined
Jan 28, 2015
Messages
48
Hi guys!
I've stumbled upon an interesting "feature": whenever I order an item removal it runs the trigger where it appears twice.

For example try this one out.
  • Convert dropped to runic Copy
    • Events
      • Unit - A unit owned by Player 1 (Red) Loses an item
      • Unit - A unit owned by Player 1 (Red) Acquires an item
    • Conditions
    • Actions
      • Item - Remove (Item being manipulated)
      • Game - Display to (All players) the text: It ran.
Any suggestions?
 
Level 3
Joined
Jan 28, 2015
Messages
48
NWM. I should have thought about adding a variable to fix this issue.

  • Convert dropped to runic
    • Events
      • Unit - A unit owned by Player 1 (Red) Loses an item
OR
  • Convert dropped to runic
    • Events
      • Unit - A unit owned by Player 1 (Red) Acquires an item
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • SecondRun Equal to False
      • Then - Actions
        • Set SecondRun = True
        • Item - Remove (Item being manipulated)
        • Game - Display to (All players) the text: Cicle
      • Else - Actions
        • Set SecondRun = False
But still this double run upon removal is quite strange.

P.S. Bobby was a clever boy. He asked himself some questions and answered them.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
Hi, Wiet.
Can you explain what 'Disply text ""' is there for?

Your unit acquires an item.
So the trigger is called.
You display the text "Cicle" to the players and you see it.

Next to that, you remove the item from the game.
So the item is also removed from the unit.
That means that your unit loses an item.
So the trigger is called.
You display the text "Cicle" to the players again.
(They are in fact called in the opposite way but that doesn't matter)

What you have to do is remove the event "A unit loses an item"
or you do this:
Disable (this trigger)
Remove (Item Being Manipulated)
Enable (this trigger)
 
Level 3
Joined
Jan 28, 2015
Messages
48
The idea behind making this trigger was to show that an "item removal" command runs trigger twice whether it was acquired or lost. This strange behavior can be perfectly observed by commenting either event line and running the test map.

My bad not expressing myself clear enough.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,900
As Wietlol said,
You acquire an item:
item - remove manipulating item
display text "...."
You lose an item:
item - remove manipulating item
display text "...."
When you acquire the item, it removes the item, and so you INSTANTLY lose the item, thats why the trigger fires again, calling again item - remove manipulating item and display text "...."
I don't see any strange behavior in this.
 
Level 3
Joined
Jan 28, 2015
Messages
48
OMG, once again :)

By commenting out the line I meant using ONLY ONE of the following events in a test:
  • Unit - A unit owned by Player 1 (Red) Loses an item
OR
  • Unit - A unit owned by Player 1 (Red) Acquires an item
 
Status
Not open for further replies.
Top