• 🏆 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!

[Trigger] Simple Fix?

Status
Not open for further replies.
Level 14
Joined
Oct 16, 2011
Messages
296
I'm trying to make a triggered version of the Shockwave ability. Unfortunately, I have problems with the loop I made. Can anyone fix it for me? Thanks in advance.

  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave (Cairne)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_Point[1] = (Position of SW_Caster[SW_Max])
      • Set SW_Point[2] = (Target point of ability being cast)
      • Set SW_Ability = (Ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for SW_Caster[SW_Max])
      • Set SW_Distance[SW_Max] = 1500.00
      • Set SW_Speed = 12.50
      • Set SW_Damage[1] = 75.00
      • Set SW_Damage[2] = 150.00
      • Set SW_Damage[3] = 300.00
      • Set SW_Area[1] = 125.00
      • Set SW_Area[2] = 125.00
      • Set SW_Area[3] = 125.00
      • Unit - Create 1 Shockwave for (Owner of SW_Caster[SW_Max]) at SW_Point[1] facing SW_Point[2]
      • Set SW_Shockwave[SW_Max] = (Last created unit)
      • Unit - Turn collision for SW_Shockwave[SW_Max] Off
      • Set SW_Angle[SW_Max] = (Facing of SW_Shockwave[SW_Max])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SW_Max Equal to 1
        • Then - Actions
          • Trigger - Turn on Shockwave Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_SW_Point[1])
      • Custom script: call RemoveLocation(udg_SW_Point[2])

  • Shockwave Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SW_Loop) from 1 to SW_Max, do (Actions)
        • Loop - Actions
          • Set SW_Distance[SW_Loop] = (SW_Distance[SW_Loop] - SW_Speed)
          • Set SW_Point[1] = (Position of SW_Shockwave[SW_Loop])
          • Set SW_Point[2] = (SW_Point[1] offset by SW_Speed towards SW_Angle[SW_Loop] degrees)
          • Unit - Move SW_Shockwave[SW_Loop] instantly to SW_Point[2], facing SW_Angle[SW_Loop] degrees
          • Set SW_GroupInitial[SW_Loop] = (Units within SW_Area[SW_Lvl[SW_Loop]] of SW_Point[2] matching ((((Matching unit) belongs to an enemy of (Owner of SW_Caster[SW_Loop])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in SW_GroupDamaged[SW_Loop]) Equal
          • Unit Group - Pick every unit in SW_GroupInitial[SW_Loop] and do (Actions)
            • Loop - Actions
              • Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_Damage[SW_Lvl[SW_Loop]] damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add (Picked unit) to SW_GroupDamaged[SW_Loop]
          • Custom script: call RemoveLocation(udg_SW_Point[1])
          • Custom script: call RemoveLocation(udg_SW_Point[2])
          • Custom script: call DestroyGroup( udg_SW_GroupInitial[udg_SW_Loop] )
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_Distance[SW_Loop] Less than or equal to 0.00
            • Then - Actions
              • Custom script: call DestroyGroup( udg_SW_GroupDamaged[udg_SW_Loop] )
              • Unit - Kill SW_Shockwave[SW_Loop]
              • Set SW_GroupInitial[SW_Loop] = SW_GroupInitial[SW_Max]
              • Set SW_GroupDamaged[SW_Loop] = SW_GroupDamaged[SW_Max]
              • Set SW_Shockwave[SW_Loop] = SW_Shockwave[SW_Max]
              • Set SW_Shockwave[SW_Max] = No unit
              • Set SW_Caster[SW_Loop] = SW_Caster[SW_Max]
              • Set SW_Caster[SW_Max] = No unit
              • Set SW_Distance[SW_Loop] = SW_Distance[SW_Max]
              • Set SW_Angle[SW_Loop] = SW_Angle[SW_Max]
              • Set SW_Lvl[SW_Loop] = SW_Lvl[SW_Max]
              • Set SW_Max = (SW_Max - 1)
              • Set SW_Loop = (SW_Loop - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_Max Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 

Ardenian

A

Ardenian

If you elaborate further what problem you have, it would be more likely someone can help you.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
SW_GroupDamaged is not being handled properly. Every time an instance is created you need to create a new group for it if it is null (as you cannot add units to or test if units are in a null group). The test for null is needed as GUI will make a few such groups initially.
 
If you use DamageEngine, you can set the Shockwave damage to 0. When the unit is dealt 0 damage by the caster, it was shockwave damage and you can add the effect and damage to the unit in that trigger.

  • Shockwave Cast
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave
    • Actions
      • Custom script: local integer TempInt
      • Set TempInt = (Custom value of (Triggering unit))
      • Set ShockwaveCount = (ShockwaveCount + 1)
      • If ShockwaveCount Equal to 1 then Trigger - Turn on ShockwaveLoop
      • Set SW_Damage[1] = 75.00
      • Set SW_Damage[2] = 150.00
      • Set SW_Damage[3] = 300.00
      • Set SW_ActualDamage[TempInt] = SW_Damage[(Level of (Ability being cast) for SW_Caster[SW_Max])]
      • Wait - 2.50 seconds of game time
      • Set SW_ActualDamage[TempInt] = 0.00
      • Set ShockwaveCount = (ShockwaveCount - 1)
      • If ShockwaveCount Equal to 0 then Trigger - Turn off ShockwaveLoop
  • ShockwaveLoop
    • Events
      • Game - DamageEvent becomes Equal to 2.00
    • Conditions
      • SW_ActualDamage[(Custom value of DamageEventSource)] Not equal to 0.00
    • Actions
      • Trigger - Turn off (this trigger)
      • Unit - Cause DamageEventSource to damage DamageEventTarget, dealing SW_ActualDamage[(Custom value of DamageEventSource] damage of attack type Spells and damage type Normal
      • Trigger - Turn on (This trigger)
      • Special Effect - Create a special effect attached to the origin of DamageEventTarget using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
A lot shorter, and is MUI. I think there is even a shockwave buff that you can check for.
 
Last edited:
Status
Not open for further replies.
Top