HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need to add a timer to a unit, that when it runs out...

08-27-2003, 12:34 AM#1
FyreDaug
I need a way to add an X second timer to certain units, the trigger is a Nova, and when the unit are affected, they are poisoned for X seconds, dealing Y damage every second. When the timer expires, the poison ability is removed from them.

I can't create a timer variable for 2 reasons, it affects multiple units and I can't define it for each unit and it can be casted again while these units are poisoned, thus restarting the timer.

Need help...
08-27-2003, 12:36 AM#2
Pesmerga
Cant you just add a wait action in between casting events?
08-27-2003, 12:46 AM#3
FyreDaug
That wouldn't help in any remote way at all, I need to find a way to define units in a circle, that could be in random orders and add a timer to them, but if I cast it again and hit that same unit, the timer will be reset.
08-27-2003, 01:22 AM#4
hazzen
You could probably use custom values, unless you are using them for something else (which is pretty likely). Have the spell trigger set the custom value of all units to a number (say 3) and add them to a unit group. Every 3 seconds (or whatever combination works for duration time and lag reduction), select all units in the group and set their custom value to the current - 1. If a unit's value is 0, remove it from the group. That seems like the simplest way to me.
08-27-2003, 01:44 AM#5
Raptor--
the best way would be to use custom values as reference numbers, and then use the custom values of the units in a timer array (or integer array) to define the index -- when the timer expires, check the index number, and take the unit whose custom value is the same as the index, and voila

its a bit more complicated than your way hazzen, but it allows you to use custom values for more than one thing
08-27-2003, 03:41 AM#6
FyreDaug
You know, that actually sounds easier than what I was thinking up, I'll give that a shot tomorrow.
08-27-2003, 02:13 PM#7
Oinkerwinkle
Wouldn't local variables be the easiest way out here? After you detect that the spell is being cast, you could do something like this:
Code:
Actions
    Custom script:   local group udg_unitGroup
    Set unitGroup = (Units within 512.00 of (Target point of issued order))
    For each (Integer A) from 1 to 10, do (Actions)
        Loop - Actions
            Unit Group - Pick every unit in unitGroup and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 5.00))
            Wait 1.00 seconds
That would do 5 life per second for 10 seconds.