[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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top