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

An event representing an item?

Status
Not open for further replies.
Level 6
Joined
Mar 17, 2012
Messages
105
I need to make a trigger where, when an item's life goes below 200, it is removed and replaced with a new item (based on the item type of attacked item). Problem is, there isn't an item devoted event option. "Unit" events don't work for it, either. So: how can I make an Item representing event? Thank you.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Quick reply:
You could use the function GetWidgetLife(whichWidget)

<<< EDIT >>>

Detailed reply:

  • Get Item Life
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • (Current life of Example_Item) Less than or equal to 200.00
    • Actions
      • Set Item_Position = (Position of Example_Item)
      • Set Example_Item_Type = (Item-type of Example_Item)
      • Item - Remove Example_Item
      • Item - Create Example_Item_Type at Item_Position
      • Custom script: call RemoveLocation(udg_Item_Position)
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
info
I made a second post for notification.
If you need to check every item then we pick all items in the map.

Didn't check for leaks

  • Get Item Life
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current life of (Picked item)) Less than or equal to 200.00
            • Then - Actions
              • Set Item_Position = (Position of (Picked item))
              • Set Example_Item_Type = (Item-type of (Picked item))
              • Item - Remove (Picked item)
              • Item - Create Example_Item_Type at Item_Position
              • Custom script: call RemoveLocation(udg_Item_Position)
            • Else - Actions
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Better use 0.03s per interval
100x per second is less efficient than 33x per second (but the detection is good too), because 0.03 second is just a short interval, human eye would not be able to detect its differences
 
Status
Not open for further replies.
Top