• 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.

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
 
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