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

expiration timer doesnt work! they die instant

Status
Not open for further replies.
Level 12
Joined
Jan 13, 2008
Messages
559
  • teleport north units
    • Events
      • Unit - A unit enters teleport north units <gen>
    • Conditions
    • Actions
      • Unit - Create (Level of (Triggering unit)) FOOD_DUMMY for (Owner of (Triggering unit)) at (Center of food dummy place <gen>) facing Default building facing degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((Owner of (Triggering unit)) Food used) - 1) Equal to ((Owner of (Triggering unit)) Food cap)
        • Then - Actions
          • Countdown Timer - Start refill_timer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for (Last started timer) with title Food Reset in:
          • Set refill_timerwindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
          • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type FOOD_DUMMY) and do (Actions)
            • Loop - Actions
              • Unit - Add a 30.00 second Generic expiration timer to (Picked unit)
        • Else - Actions
      • Unit - Move (Triggering unit) instantly to (Random point in spawn 1 south <gen>)
      • Unit - Change ownership of (Triggering unit) to Player 9 (Gray) and Change color
      • Unit - Order (Triggering unit) to Attack-Move To (Position of Resurrection Stone (southeast facing) 0000 <gen>)
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 9 (Gray) at (Random point in spawn 2 south <gen>) facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack-Move To (Position of Resurrection Stone (southeast facing) 0000 <gen>)
 
Level 12
Joined
Jan 13, 2008
Messages
559
edit: wait what. They die instantly? Pretty sure there is another trigger interfering then.

edit2: A solution could be to kill the units instanylu when the countdown timer expires instead.

it's not another trigger because if I remove the timer..everything works good, I mean. What kind of trigger would cause this? I just started this map..it has basically no triggers at all.

And yes that would the other solution..i also thought about it..but its more work.
 
Level 11
Joined
Jun 2, 2013
Messages
613
So, what does the FOOD_DUMMY oe data look like? How much life do the units have? Is there an AoE damaging spell in that region that could be killing them? etc.

Do you have a trigger that fires when a unit enters Center of food dummy place <gen>?

Also you might need to only be adding the expiration timer to the last created unit, because every time another unit enters 'teleport north units' , you would be adding an additional expiration timer to every unit of that type that is still alive. The problem with that is, you are creating multiple units at once - which means you might want to use a for loop.
 
Level 12
Joined
Jan 13, 2008
Messages
559
Sorry for the confusion. The units did never die. The problem is that as soon as I add the timer, the food cost disappears for this unit. So when the dummy had a food cost of 1, it was suddenly 0 after and that made me think the unit died. So..how do I keep the food costs for units with a exp. timer?

/edit: I solved it now in a different way. But it would still be interesting to know the answer to this question.

  • teleport north units
    • Events
      • Unit - A unit enters teleport north units <gen>
    • Conditions
    • Actions
      • Set player_checkFoodCap = (Owner of (Triggering unit))
      • Player - Add (Level of (Triggering unit)) to player_checkFoodCap Food used
      • Unit - Change ownership of (Triggering unit) to Player 9 (Gray) and Change color
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((player_checkFoodCap Food used) - 0) Equal to (player_checkFoodCap Food cap)
        • Then - Actions
          • Trigger - Turn on destroy timerwindow <gen>
          • Countdown Timer - Start refill_timer[(Player number of player_checkFoodCap)] as a One-shot timer that will expire in 5.00 seconds
          • Countdown Timer - Create a timer window for (Last started timer) with title Food Reset in:
          • Set refill_timerwindow[(Player number of player_checkFoodCap)] = (Last created timer window)
          • Unit - Create 1 FOOD_DUMMY for player_checkFoodCap at (Center of food dummy place <gen>) facing Default building facing degrees
          • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
      • Unit - Move (Triggering unit) instantly to (Random point in spawn 1 south <gen>)
      • Unit - Order (Triggering unit) to Attack-Move To (Position of Resurrection Stone (southeast facing) 0000 <gen>)
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 9 (Gray) at (Random point in spawn 2 south <gen>) facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack-Move To (Position of Resurrection Stone (southeast facing) 0000 <gen>)
I still need the FOOD_DUMMY though, so I can check when the timer expires. Or how do I check which timer expired when there are 8 of them? I guess I would need 8 different triggers then and this sucks.
 
Last edited:
Status
Not open for further replies.
Top