• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] Item effect stays after removing it!

Status
Not open for further replies.
Level 12
Joined
Jan 13, 2008
Messages
559
  • Axe of Destruction
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Axe of Destruction
      • ((Unit-type of (Buying unit)) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Buying unit) has an item of type Power Claws) Equal to True
          • ((Buying unit) has an item of type Iron Sword) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Buying unit) of type Iron Sword)
          • Item - Remove (Item carried by (Buying unit) of type Power Claws)
          • Special Effect - Create a special effect at (Position of (Buying unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Skip remaining actions
        • Else - Actions
          • Item - Remove (Item being manipulated)
          • Item - Remove (Sold Item)
          • Player - Add 4000 to (Owner of (Buying unit)) Current gold
          • Game - Display to (Player group((Owner of (Buying unit)))) for 1.00 seconds the text: You are missing an ...
          • Skip remaining actions
The item gets removed from the heroes' inventory but the item abilities stay...how can I resolve this problem?

/e: i solved it by adding a wait - 0.03 seconds before removing it (which can lead to problems if 2 players buy smthg at the same time tho)
 
Instead of using waits, which is not that good, especially in multiplayer, use timers with 0.00 seconds.
Paste
JASS:
function Trig_BuyItem_RemoveItem takes nothing returns nothing
    call RemoveItem( udg_RemovingItem )
endfunction
to your map header and use
  • BuyItem2
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Set RemovingItem = (Sold Item)
      • Custom script: call TimerStart(udg_RemovingTimer, 0.00, false, function Trig_BuyItem_RemoveItem)
to remove the bought item immediatly.

Variables:
- Item RemovingItem
- Timer RemovingTimer
 
Status
Not open for further replies.
Back
Top