• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Unit lose item bug?

Status
Not open for further replies.
Level 3
Joined
Jul 27, 2012
Messages
33
hi guys i just find a problem with this, so when hero drop item1, it should create 1 item1_dummy in hero position, but when i run(drop) it, it instead create 2 item1_dummy, whyy?

  • test
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to item1
    • Actions
      • Item - Remove (Item being manipulated)
      • Unit - Create 1 item1_dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Because the coding is intercepting.
When you remove an item (Item - Remove <item>), the holder of the item loses that item.
When a unit loses an item, it still has it.
So you order the unit to drop the item -> dummy is created.
You remove the item -> another dummy is created.

Try disabling the trigger before "Item - Remove (Item being manipulated)" and enable the trigger again after that.
 
Level 3
Joined
Jul 27, 2012
Messages
33
thx dude, so i just save item in hashtable?

  • dismiss item
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to item1
    • Actions
      • Set Dismiss_handle = (Triggering unit)
      • Unit - Create 1 item1_dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Item being manipulated) as (Key loseitem1) of (Key (Triggering unit)) in Hash
      • Trigger - Turn on dcheck <gen>
  • dcheck
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Item - Remove (Load (Key loseitem1) of (Key Dismiss_handle) in Hash)
      • Trigger - Turn off (This trigger)
 
Level 11
Joined
Dec 19, 2012
Messages
411
What he meant is turn off at start and re-enable trigger at the end :
  • dismiss item
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to item1
    • Actions
      • Trigger - Turn off (This trigger)
      • Item - Remove (Item being manipulated)
      • Unit - Create 1 item1_dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Trigger - Turn on (This trigger)
Also, you have a location leak.
 
Status
Not open for further replies.
Top