• It's time to dig through Hive's model database and dust off some oldie but goldie models and enter Hive's Texturing Contest #31 : Repurposing! Click here to enter!
  • 🏆 Hive's 5th HD Modeling Contest: Creep Camp is now open! Click here to enter!

[Trigger] Unit generic expiration timer

Level 4
Joined
Sep 6, 2012
Messages
88
Hi guys !

I'm currently having a problem with the generic expiration timer for units. If you look at the trigger below, I'm trying to set an expiration time for a lot of units as 5 seconds when they are created. However, be it 5 seconds for 0.5 seconds, in reality these units always take like 30-40 seconds to expire and disappear. I can't figure out where's the problem is in this case, so please help me if you have any idea.

Thank you very much !

  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Flower Storm
  • Actions
    • Set Temp_Point = (Position of (Triggering unit))
    • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
    • Set Temp_Unit = (Last created unit)
    • Unit - Add Invisibility to Temp_Unit
    • Unit - Order Temp_Unit to Human Sorceress - Invisibility (Triggering unit)
    • Set Temp_Region = (Region centered at (Position of (Triggering unit)) with size (400.00, 400.00))
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Flower Storm for (Owner of (Triggering unit)) at (Random point in Temp_Region) facing (Random angle) degrees
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
They're probably decaying.
In the unit editor, change their decay behaviour to "Can't raise, does not decay". Or, you can just use this simple trigger:
  • Event
    • Unit - generic - unit dies
  • Conditions
    • Unit type of triggering unit equal to flower storm
  • Actions
    • Unit - remove triggering unit
Also, your trigger has memory leaks!

This would be a better, leakless way to create the flower storms:
  • For each integer a from 1 to 10 do (actions)
    • Loop - Actions
      • Set Temp_Point = Random point in Temp_Region
      • Unit - Create 1 Flower Storm for owner of triggering unit at Temp_Point facing random angle
      • Unit - Add a 5.00 second generic expiration timer
      • Custom script: call RemoveLocation(udg_Temp_Point)
The "for each etc etc" just repeats all actions in the "Loop - Actions" block from 1 to 10 - 10 times in this case. Just change the 10 to however many times you want it to run.
 
Level 4
Joined
Sep 6, 2012
Messages
88
Oh, they were really decaying. I did as you said and set their Death type to "Can't raise, does not decay" and things run nicely now. Thank you very much for the support !

And also thank you for the memory leak reminder ~ I was testing the logic so I didn't pay much attention to these optional stuff :)

P/S: By the way, can I ask one more question ? Is there any way to create an expiration timer for destructibles via triggers ? Thank you very much ~
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
P/S: By the way, can I ask one more question ? Is there any way to create an expiration timer for destructibles via triggers ? Thank you very much ~

Make a dummy unit and order it to attack the destructable. Adjust the damage/attack speed as necessary, and index the two together so that you can remove the unit when that destructable dies.
 
Top