[unit is dead] checks

2evil

New Member
Reaction score
16
Is there any way to check if a unit is dead, or dying? I have a chain lightning spell based off of Daelin's Tutorial (good 1 btw :)) and it is supposed to summon a unit upon another's death. Heres the trigger, important part bolded :D

Code:
Void Lightning
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Void Lightning 
    Actions
        Set VL_prev = (Casting unit)
        Set VL_targ = (Target unit of ability being cast)
        Set VL_level = (Level of Void Lightning  for (Casting unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Less than or equal to 3
            Then - Actions
                Set VL_targetsnum = 3
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Greater than or equal to 3
                VL_level Less than or equal to 4
            Then - Actions
                Set VL_targetsnum = 4
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Greater than or equal to 5
                VL_level Less than or equal to 6
            Then - Actions
                Set VL_targetsnum = 5
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Equal to 7
            Then - Actions
                Set VL_targetsnum = 6
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Equal to 8
            Then - Actions
                Set VL_targetsnum = 7
            Else - Actions
        For each (Integer MB_cur) from 1 to VL_targetsnum, do (Actions)
            Loop - Actions
                Unit Group - Add VL_targ to VL_alltargs
                -------- Effect Part --------
                Set VL_TempPoint = (Position of VL_prev)
                Unit - Create 1 Albatross for (Owner of (Triggering unit)) at VL_TempPoint facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_MB_TempPoint)
                Animation - Change (Last created unit) flying height to 50.00 at 0.00
                Unit - Hide (Last created unit)
                Unit - Add Void Lightning (EFFECT) to (Last created unit)
                Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike VL_targ
                Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                -------- Waiting part --------
                Wait until (((VL_targ has buff Void Lightning ) Equal to True) or ((VL_targ is dead) Equal to True)), checking every 0.35 seconds
                -------- Spell part --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (VL_targ is dead) Equal to False
                    Then - Actions
                        Set VL_TempPoint = (Position of VL_targ)
                        Unit - Create 1 Albatross for (Owner of (Triggering unit)) at VL_TempPoint facing Default building facing degrees
                        Custom script:   call RemoveLocation(udg_MB_TempPoint)
                        Unit - Hide (Last created unit)
                        Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                        Unit - Add Void Lightning [Chain Spell] to (Last created unit)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                VL_level Greater than or equal to 1
                                VL_level Less than or equal to 2
                            Then - Actions
                                Unit - Set level of Void Lightning [Chain Spell] for (Last created unit) to (((3 x (VL_level - 1)) + 0) + MB_cur)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                VL_level Greater than or equal to 3
                                VL_level Less than or equal to 4
                            Then - Actions
                                Unit - Set level of Void Lightning [Chain Spell] for (Last created unit) to (((4 x (VL_level - 3)) + 6) + MB_cur)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                VL_level Greater than or equal to 5
                                VL_level Less than or equal to 6
                            Then - Actions
                                Unit - Set level of Void Lightning [Chain Spell] for (Last created unit) to (((5 x (VL_level - 5)) + 14) + MB_cur)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                VL_level Equal to 7
                            Then - Actions
                                Unit - Set level of Void Lightning [Chain Spell] for (Last created unit) to ((25 - 1) + MB_cur)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                VL_level Equal to 8
                            Then - Actions
                                Unit - Set level of Void Lightning [Chain Spell] for (Last created unit) to ((31 - 1) + MB_cur)
                            Else - Actions
                        Set VL_prev = VL_targ
                        Set VL_TempPoint = (Position of VL_prev)
                        Unit - Order (Last created unit) to Human Mountain King - Storm Bolt VL_targ
                        Unit - Remove Stunned (Pause) buff from VL_targ
                        Wait 0.01 game-time seconds
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                           [B] If - Conditions
                                (VL_targ is dead) Equal to True
                            Then - Actions
                                Set Temp_Point = VL_TempPoint
                                Unit - Create 1 Void_Summons_Units[(Random integer number between ((VL_level x 2) - 1) and (VL_level x 2))] for (Owner of (Casting unit)) at Temp_Point facing Default building facing degrees
                                Custom script:   call RemoveLocation (udg_Temp_Point)
                            Else - Actions[/B]
                    Else - Actions
                        Set MB_cur = (VL_targetsnum + 1)
                -------- Choice Part --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        MB_cur Less than VL_targetsnum
                    Then - Actions
                        Unit Group - Pick every unit in (Units within 500.00 of (Position of VL_prev)) and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) is A structure) Equal to False
                                        ((Picked unit) is Magic Immune) Equal to False
                                        ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
                                        ((Picked unit) is dead) Equal to False
                                        ((Picked unit) is in VL_alltargs) Equal to False
                                    Then - Actions
                                        Set VL_targ = (Picked unit)
                                    Else - Actions
                                        Unit Group - Remove (Picked unit) from (Last created unit group)
                    Else - Actions
                Custom script:   call RemoveLocation(udg_MB_TempPoint)
        Unit Group - Remove all units from VL_alltargs


edit: i cant link nething right now (im goin thru a proxy) so heres the tutorial URL
www.thehelper.net/forums/showthread.php?t=38181
 

Daelin

Kelani Mage
Reaction score
172
There is a passive ability which does this. Giving it to an unit will cause another unit to be spawned upon its death. It's under Neutral Hostile - Units - Spawn Spider or any other spawn ability. :)

~Daelin
 

2evil

New Member
Reaction score
16
is there ne way to mine work, cause that would be a lot less work :D

otherwise, im gonna have to have 2 new dummy units and remove the abilities if the chain lightning doesnt kill them and such
 

2evil

New Member
Reaction score
16
ill clarify a bit :D

its meant thet the owner of the killing unit will get the 'spawns' not the owner of the dying unit. The idea behind the spell is its a summoning type one and the caster only summons units if the spell kills one.

also, to use the spawn spiderlings ability, i would still have to use the 'unit is dead' check to remove the ability so stuff doesnt summon upon the units death if it is not by the spell

another issue would be converting the owner of the units. There would be no way to track the caster of the spell because the actual killing spell is done by a neutral passive unit (the albatross)
 

Daelin

Kelani Mage
Reaction score
172
Lol... that's not true. The albatross is created for the owner of (triggering unit) => the owner of (killing unit) will be the one you want. But I wouldn't use storm bolt. I'd stick to Unit - Damage Target action because it instantly damages unit unlike storm bolt which has a small delay. Then the code should work like you wanted.

~Daelin
 

2evil

New Member
Reaction score
16
i was searching for a spell that only damaged a unit

a question about order strings: I changed an order string for an ability and the albatross never casted it. the original order string was none (neutral fireball) and i changed it to manaburn, along with the ordered spell on the albatross.
Is that just because the original order string on the ability was non, or was it because i simply changed the order string on the ability?

and to trigger damage, should i put all of the values that were previously in the damage table into a integer array and just use that, getting rid of the ability 'Void Lightning [Chain Spell]' altogether?
 

Daelin

Kelani Mage
Reaction score
172
Changing order strings for any other abilities but channel will have absolutely no effect. I suggest you do not even attempt that! Use the original order string of the ability.

~Daelin
 

Daelin

Kelani Mage
Reaction score
172
That's indeed a problem. Yes, I guess you have to use a lot of IFs.

~Daelin
 

2evil

New Member
Reaction score
16
or a loop with 2 integer array and such and AHA!! just give me a couple minutes here :D i love it when ideas come into my head!
 

2evil

New Member
Reaction score
16
got that all working in about 15 min BUT it doesnt always summon the units. on average, it will summon 4 units when it kills 7. Ive tried changing the wait around (before it checks if their dead) and it doesnt seem to effect it too much. could it be because different death animations?


new trigger now (the bold is new)

Code:
Void Lightning
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Void Lightning 
    Actions
        Set VL_prev = (Casting unit)
        Set VL_targ = (Target unit of ability being cast)
        Set VL_level = (Level of Void Lightning  for (Casting unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Less than or equal to 3
            Then - Actions
                Set VL_targetsnum = 3
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Greater than or equal to 3
                VL_level Less than or equal to 4
            Then - Actions
                Set VL_targetsnum = 4
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Greater than or equal to 5
                VL_level Less than or equal to 6
            Then - Actions
                Set VL_targetsnum = 5
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Equal to 7
            Then - Actions
                Set VL_targetsnum = 6
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                VL_level Equal to 8
            Then - Actions
                Set VL_targetsnum = 7
            Else - Actions
        For each (Integer VL_cur) from 1 to VL_targetsnum, do (Actions)
            Loop - Actions
                Unit Group - Add VL_targ to VL_alltargs
                -------- Effect Part --------
                Set VL_TempPoint = (Position of VL_prev)
                Unit - Create 1 Albatross for (Owner of (Triggering unit)) at VL_TempPoint facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_VL_TempPoint)
                Animation - Change (Last created unit) flying height to 50.00 at 0.00
                Unit - Hide (Last created unit)
                Unit - Add Void Lightning (EFFECT) to (Last created unit)
                Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike VL_targ
                Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                -------- Waiting part --------
                Wait until (((VL_targ has buff Void Lightning ) Equal to True) or ((VL_targ is dead) Equal to True)), checking every 0.35 seconds
                -------- Spell part --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (VL_targ is dead) Equal to False
                    Then - Actions
                        Set VL_TempPoint = (Position of VL_targ)
                        Unit - Create 1 Albatross for (Owner of (Triggering unit)) at VL_TempPoint facing Default building facing degrees
                        Custom script:   call RemoveLocation(udg_VL_TempPoint)
                        Unit - Hide (Last created unit)
                        Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                        [B]Unit - Cause (Last created unit) to damage VL_targ, dealing (Real(VL_Damage[(VL_Damage_Index[VL_level] + (VL_cur - 1))])) damage of attack type Spells and damage type Normal[/B]
                        Set VL_prev = VL_targ
                        Set VL_TempPoint = (Position of VL_prev)
                        [B]Wait 0.10 game-time seconds
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (VL_targ is dead) Equal to True
                            Then - Actions
                                Set Temp_Point = VL_TempPoint
                                Unit - Create 1 Void_Summons_Units[(Random integer number between ((VL_level x 2) - 1) and (VL_level x 2))] for (Owner of (Casting unit)) at Temp_Point facing Default building facing degrees
                                Custom script:   call RemoveLocation [/B](udg_Temp_Point)
                            Else - Actions
                    Else - Actions
                        Set VL_cur = (VL_targetsnum + 1)
                -------- Choice Part --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        VL_cur Less than VL_targetsnum
                    Then - Actions
                        Unit Group - Pick every unit in (Units within 500.00 of (Position of VL_prev)) and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) is A structure) Equal to False
                                        ((Picked unit) is Magic Immune) Equal to False
                                        ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
                                        ((Picked unit) is dead) Equal to False
                                        ((Picked unit) is in VL_alltargs) Equal to False
                                    Then - Actions
                                        Set VL_targ = (Picked unit)
                                    Else - Actions
                                        Unit Group - Remove (Picked unit) from (Last created unit group)
                    Else - Actions
                Custom script:   call RemoveLocation(udg_VL_TempPoint)
        Unit Group - Remove all units from VL_alltargs
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top