• 🏆 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!

[Solved] An unit loses an ability when drop item

Level 12
Joined
Oct 28, 2019
Messages
475
  • BowmanDrops
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Hero manipulating item)) Equal to Archer
      • (Item-type of (Last dropped item)) Equal to Flame Arrow
    • Actions
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Hero manipulating item) has an item of type Flame Arrow) Equal to True
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit - Remove Flame Arrow (Archer) from (Hero manipulating item)
IDK what happened, it was working , and now isnt anymore, Its simple, if an archer has a flaming arrow item it gains the flaming arrow ability, if drops the item loses ability
 
Level 20
Joined
Feb 27, 2019
Messages
593
I would use Item being manipulated instead of Last dropped item. I would also use Triggering unit instead of Hero manipulating item. They make sense to me and I can be sure that they work as intended. The others... I dont trust em!

When an item is dropped, the game requires an instant to realize that the item is not owned or a unit doesnt have the item. Thats why you needed to add a wait. Timers are faster than waits so I recommend you use one instead.
  • Cheese Dropped 1
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Archer
      • (Item-type of (Item being manipulated)) Equal to Cheese
    • Actions
      • Set VariableSet CheeseUnit = (Triggering unit)
      • Countdown Timer - Start CheeseTimer as a One-shot timer that will expire in 0.00 seconds
  • Cheese Dropped 2
    • Events
      • Time - CheeseTimer expires
    • Conditions
      • (CheeseUnit has an item of type Cheese) Equal to False
    • Actions
      • Unit - Remove Animate Dead from CheeseUnit
      • Game - Display to (All players) the text: Oh no! Cheese Dropp...
Theres an even faster way to keep track of items. Set a variable to +1 when an item is acquired. Set the variable to -1 when an item is lost. The unit doesnt have the item when the variable reaches 0.
 
Top