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

Changing animation when acquiring an item

Status
Not open for further replies.
Level 8
Joined
Jul 29, 2010
Messages
319
  • Carrying
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Item carried by (Triggering unit) in slot 1) Equal to No item) and ((Item carried by (Triggering unit) in slot 2) Equal to No item)
        • Then - Actions
          • Animation - Add the gold animation tag to (Triggering unit)
        • Else - Actions
I can't seem to get this to work, I want the gold animation tag to be added to any peasant that acquires and item, so it actually looks like he is carrying something.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
If there is no item in slot 1, it will be picked up and will be in slot 1, so there will always be an item in slot 1.
The item is already picked up, when the event fires.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
If he just picked up the first item, it will be in slot 1, so

unit acquires an item
item being manipulated = item in slot of triggering unit and "hero has no other items"

I think you could also just use the event without conditions (except the peasant condition), because whenever the unit acquires an item it will have >= 1 items
It would add the tag, if the unit already has it, but I don't think that's bad.
 
Level 11
Joined
Jun 2, 2004
Messages
849
There's no harm in adding it if already has it, from what I remember. So just always add it when a peasant picks up an item.

As for removing it, just check every time a peasant uses or loses an item if all its slots are empty.

EDIt: Ninja~
 
Level 8
Joined
Jul 29, 2010
Messages
319
There's no harm in adding it if already has it, from what I remember. So just always add it when a peasant picks up an item.

As for removing it, just check every time a peasant uses or loses an item if all its slots are empty.

EDIt: Ninja~
What trigger checks if all a units slots are empty? i can't seem to find one

UPDATE: Nvm i found it, thanks guys :D

EDIT: so i got this and it doesn't change the units animation.
  • Not Carrying
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by (Triggering unit)) Equal to 0
        • Then - Actions
          • Animation - Remove the gold animation tag to (Triggering unit)
        • Else - Actions
RE-EDIT: Solved it with this
  • Not Carrying
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Set TempUnit = (Triggering unit)
      • Countdown Timer - Start Drop_Timer as a One-shot timer that will expire in 0.00 seconds
  • Timer End
    • Events
      • Time - Drop_Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by TempUnit) Equal to 0
        • Then - Actions
          • Animation - Remove the gold animation tag to TempUnit
        • Else - Actions
Apparently Warcraft 3 doesn't recognise the event "Loses an item" quick enough because it needs a delay for some reason
 
Last edited:
Level 8
Joined
Jul 29, 2010
Messages
319
A 0 second wait will suffice and not require any global variables. "Triggering unit" is one of the few event response variables preserved over waits, so it's safe to use after one.
i know i could use the Wait action but i've had bad experiences with that action before and i've been told by some pretty experienced editors Not to use it and to use timers instead because "wait" stuffs up triggers in some cases and is unreliable
 
Status
Not open for further replies.
Top