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

Expiration Timer Manipulation

Status
Not open for further replies.
Level 8
Joined
Jan 8, 2010
Messages
493
i don't think the unit's expiration timer (i'm referring to the blue-shaded area thing) can be changed after it has been set to the unit. i don't know if there's a JASS function to it, too, but anyway, you can use a timer (or an indexing system) to act like the unit's expiration timer. when it kills a unit add more time to the timer (or add more index value to the unit's index which decreases per second) :O
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You'll need Unit Indexer for that.

The idea is about setting real array variable to your desired 'expiration value' and use loop to make it act as real timer.
So lets say you have set real vairalbe Expiration[(Custom value of <unit>)] = 30.00. Additionaly, add those units to specific group, let's say: ExpirationGroup.

Now, to increase it:
  • init
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Expiration[(Custom value of (Killing unit))] = Expiration[(Custom value of (killing unit))] + 5.00
^My trigger increases the delay by 5.00 secons.

Loop:
  • loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit group - Pick every unit in ExpirationGroup and do Actions
        • Loop - Actions
          • Set key = (Custom value of (Picked unit))
          • Set Expiration[key] = Expiration[key] - 0.03
          • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
            • If - Conidtions
              • Expiration[key] Less or equal to 0.00
            • Then - Actions
              • // whateveryou want
              • UnitGroup - Remove (Picked unit) from ExpirationGroup
            • Else - Actions
Why '(Custom value of <unit>)' everywhere? Because thats what UnitIndexer is here for ;)
 
Status
Not open for further replies.
Top