• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Spell - Effect during, damage at end.

Status
Not open for further replies.
Level 7
Joined
Aug 5, 2010
Messages
147
Made an ability, life drain based, that creates a wisp on the overhead of targeted unit, the wisp is deleted after 0.20 seconds and then aoe damage is dealt around the unit along with an explosion effect, whilst this is acceptable it isnt exactly what i want.

I want it to create a wisp on the overhead of a unit during the life drain effect and do Aoe Damage and an explosion effect once the Life Drain effect has finished.

I created a rough trigger that is functional but isnt exactly what i want. i could probably do this myself but theirs probably a better way to do it than the way im thinking, also its 3:30am.

  • Soul Explosion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Soul Explosion [Ultimate] for (Triggering unit)) Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using units\nightelf\Wisp\Wisp.mdl
          • Wait 0.20 seconds
          • Special Effect - Destroy (Last created special effect)
          • Wait 0.20 seconds
          • Special Effect - Create a special effect at (Position of (Target unit of ability being cast)) using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 300.00 at (Position of (Target unit of ability being cast)), dealing 500.00 damage of attack type Spells and damage type Normal
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Wait timers can work, but I think it's better to have a loop timer that lasts until your Life Drain ends. I also recommend not using Unit - Damage Area for it will damage anything and everything. You will have to properly filter out units using a Unit Group function.

So if your Life Drain lasts 5 seconds:

On cast:
  • On Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • Set Caster = (Triggering unit)
      • Set Owner = (Triggering player)
      • Set Counter = 0.00
      • -------- --------
      • Set Target = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of Target using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set Special_Effect = (Last created special effect)
      • -------- --------
      • Trigger - Turn on On Cast <gen>
On loop:
  • On Loop
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set Counter = (Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Counter Greater than or equal to 5.00
              • (Target is dead) Equal to True
              • (Current order of Caster) Not equal to (Order(lifedrain))
        • Then - Actions
          • Special Effect - Destroy Special_Effect
          • -------- --------
          • Set TempLoc = (Position of Target)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 300.00 of TempLoc) and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit is A structure) Equal to False
                  • (TempUnit is Magic Immune) Equal to False
                  • (TempUnit is alive) Equal to False
                  • (TempUnit belongs to an enemy of Owner) Equal to False
                • Then - Actions
                  • Unit - Cause Caster to damage TempUnit, dealing 500.00 damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Trigger - Turn off On Loop <gen>
        • Else - Actions

Do note that this isn't MUI. I also added extra conditions of why the spell would stop: target dies, caster is no longer channeling life drain (stunned, dies, etc), or if the duration is over.
 
Level 7
Joined
Aug 5, 2010
Messages
147
After some modifications and fixes the trigger worked how i want it to, Here are the completed triggers.

  • Soul Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • Set Soul_Caster = (Triggering unit)
      • Set Soul_Owner = (Triggering player)
      • Set Soul_Counter = 0.00
      • -------- - --------
      • Set Soul_Target = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of Soul_Target using units\nightelf\Wisp\Wisp.mdl
      • Set Soul_Effect = (Last created special effect)
      • -------- - --------
      • Trigger - Turn on Soul Loop <gen>
  • Soul Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set Soul_Counter = (Soul_Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Soul_Counter Greater than or equal to 3.00
          • (Soul_Target is dead) Equal to False
          • (Current order of Soul_Caster) Equal to (Order(lifedrain))
        • Then - Actions
          • Special Effect - Destroy Soul_Effect
          • Special Effect - Create a special effect attached to the overhead of Soul_Target using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Set Soul_Effect = (Last created special effect)
          • -------- - --------
          • Set Soul_TempLoc = (Position of Soul_Target)
          • Custom script: set bj_wantDestroyGroup = true
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soul Explosion [Ultimate] for Soul_Caster) Equal to 1
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 200.00 of Soul_TempLoc) and do (Actions)
                • Loop - Actions
                  • Set Soul_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Soul_TempUnit is A structure) Equal to False
                      • (Soul_TempUnit is Magic Immune) Equal to False
                      • (Soul_TempUnit is alive) Equal to True
                      • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                    • Then - Actions
                      • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing 2000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soul Explosion [Ultimate] for Soul_Caster) Equal to 2
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 250.00 of Soul_TempLoc) and do (Actions)
                • Loop - Actions
                  • Set Soul_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Soul_TempUnit is A structure) Equal to False
                      • (Soul_TempUnit is Magic Immune) Equal to False
                      • (Soul_TempUnit is alive) Equal to True
                      • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                    • Then - Actions
                      • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing 4000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soul Explosion [Ultimate] for Soul_Caster) Equal to 3
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 300.00 of Soul_TempLoc) and do (Actions)
                • Loop - Actions
                  • Set Soul_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Soul_TempUnit is A structure) Equal to False
                      • (Soul_TempUnit is Magic Immune) Equal to False
                      • (Soul_TempUnit is alive) Equal to True
                      • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                    • Then - Actions
                      • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing 8000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soul Explosion [Ultimate] for Soul_Caster) Equal to 4
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 350.00 of Soul_TempLoc) and do (Actions)
                • Loop - Actions
                  • Set Soul_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Soul_TempUnit is A structure) Equal to False
                      • (Soul_TempUnit is Magic Immune) Equal to False
                      • (Soul_TempUnit is alive) Equal to True
                      • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                    • Then - Actions
                      • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing 16000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soul Explosion [Ultimate] for Soul_Caster) Equal to 5
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 400.00 of Soul_TempLoc) and do (Actions)
                • Loop - Actions
                  • Set Soul_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Soul_TempUnit is A structure) Equal to False
                      • (Soul_TempUnit is Magic Immune) Equal to False
                      • (Soul_TempUnit is alive) Equal to True
                      • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                    • Then - Actions
                      • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing 32000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Soul_TempLoc)
          • Special Effect - Destroy Soul_Effect
          • Trigger - Turn off Soul Loop <gen>
        • Else - Actions
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Oh lord that looks disgusting.

  • On Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • Set Caster = (Triggering unit)
      • Set Owner = (Triggering player)
      • Set Damage = (Power(2000.00, (Real((Level of Soul Explosion [Ultimate] for Caster)))))
      • Set AoE = 150 + (50 x (Real(Level of Soul Explosion [Ultimate] for Caster)))
      • -------- --------
      • Set Target = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of Target using units\nightelf\Wisp\Wisp.mdl
      • Set Special_Effect = (Last created special effect)
      • -------- --------
      • Trigger - Turn on On Cast <gen>
  • On Loop
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set Counter = (Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Counter Greater than or equal to 3.00
              • (Target is dead) Equal to True
              • (Current order of Caster) Not equal to (Order(lifedrain))
        • Then - Actions
          • Special Effect - Destroy Special_Effect
          • Special Effect - Create a special effect attached to the overhead of Soul_Target using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • Set TempLoc = (Position of Target)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within AoE of TempLoc) and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit is A structure) Equal to False
                  • (TempUnit is Magic Immune) Equal to False
                  • (TempUnit is alive) Equal to False
                  • (TempUnit belongs to an enemy of Owner) Equal to False
                • Then - Actions
                  • Unit - Cause Caster to damage TempUnit, dealing Damage damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Trigger - Turn off On Loop <gen>
        • Else - Actions
Your damage incremented 2000^(level of ability). So at level 1, you have 2000^1, which is 2000 damage. Level 2 is 2000^2, which is 4000, and so on. Instead of having a lot of If/Then/Else checking what level it is, just store the damage into a variable. Same goes for AoE: your AoE increased by 50 for each level (150 + (50 x Level of Ability). At level 1, this will be 200, and level 2 this will be 250, and so on. Alternatively, you can store these values in a config trigger like so:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Damage[1] = 2000
      • Set Damage[2] = 4000
      • Set Damage[3] = 8000
      • Set Damage[4] = 16000
      • Set Damage[5] = 32000
      • -------- --------
      • Set AoE[1] = 200
      • Set AoE[2] = 250
      • Set AoE[3] = 300
      • Set AoE[4] = 350
      • Set AoE[5] = 400


Your trigger will look slightly different if you use this method. You will need to cache a new variable that stores the level of the ability for the caster:
  • On Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • Set Caster = (Triggering unit)
      • Set Owner = (Triggering player)
      • Set Level = (Level of Soul Explosion [Ultimate] for Caster)
      • -------- --------
      • Set Target = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of Target using units\nightelf\Wisp\Wisp.mdl
      • Set Special_Effect = (Last created special effect)
      • -------- --------
      • Trigger - Turn on On Cast <gen>
  • On Loop
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set Counter = (Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Counter Greater than or equal to 3.00
              • (Target is dead) Equal to True
              • (Current order of Caster) Not equal to (Order(lifedrain))
        • Then - Actions
          • Special Effect - Destroy Special_Effect
          • Special Effect - Create a special effect attached to the overhead of Soul_Target using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • Set TempLoc = (Position of Target)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within AoE[Level] of TempLoc) and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit is A structure) Equal to False
                  • (TempUnit is Magic Immune) Equal to False
                  • (TempUnit is alive) Equal to False
                  • (TempUnit belongs to an enemy of Owner) Equal to False
                • Then - Actions
                  • Unit - Cause Caster to damage TempUnit, dealing Damage[Level] damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Trigger - Turn off On Loop <gen>
        • Else - Actions
 
Level 7
Joined
Aug 5, 2010
Messages
147
Oh lord that looks disgusting.

I havent really meddled with creating custom spells so i posted it to see if anyone could do better. I also fixed another spell, that was causing quite a bit of frustration, thanks to your triggers


Regarding the Soul Explosion spell, i used your second method due to it being easier for me to manipulate the damage and aoe of it if i ever want to change them.

  • Soul Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Explosion [Ultimate]
    • Actions
      • Set Soul_Caster = (Triggering unit)
      • Set Soul_Owner = (Triggering player)
      • Set Soul_Level = (Level of Soul Explosion [Ultimate] for Soul_Caster)
      • -------- - --------
      • Set Soul_Target = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of Soul_Target using units\nightelf\Wisp\Wisp.mdl
      • Set Soul_Effect = (Last created special effect)
      • -------- - --------
      • Trigger - Turn on Soul Loop <gen>
  • Soul Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set Soul_Counter = (Soul_Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Soul_Counter Greater than or equal to 3.00
          • (Soul_Target is dead) Equal to False
          • (Current order of Soul_Caster) Equal to (Order(lifedrain))
        • Then - Actions
          • Special Effect - Destroy Soul_Effect
          • Special Effect - Create a special effect attached to the overhead of Soul_Target using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- - --------
          • Set Soul_TempLoc = (Position of Soul_Target)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within Soul_Aoe[Soul_Level] of Soul_TempLoc) and do (Actions)
            • Loop - Actions
              • Set Soul_TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Soul_TempUnit is A structure) Equal to False
                  • (Soul_TempUnit is Magic Immune) Equal to False
                  • (Soul_TempUnit is alive) Equal to True
                  • (Soul_TempUnit belongs to an enemy of Soul_Owner) Equal to True
                • Then - Actions
                  • Unit - Cause Soul_Caster to damage Soul_TempUnit, dealing Soul_Damage[Soul_Level] damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_Soul_TempLoc)
          • Trigger - Turn off Soul Loop <gen>
        • Else - Actions
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
I havent really meddled with creating custom spells so i posted it to see if anyone could do better. I also fixed another spell, that was causing quite a bit of frustration, thanks to your triggers
No problem. I hope you didn't find my comment offensive, I was just fooling around. I learned most of what I know by doing exactly what you did :)


Regarding the Soul Explosion spell, i used your second method due to it being easier for me to manipulate the damage and aoe of it if i ever want to change them.
I always favor the second method. The former only becomes useful if your spell has A LOT of levels. I can't even imagine trying to edit a variable with an index size of 100. Always keep both in mind :)
 
Status
Not open for further replies.
Top