• 🏆 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] Shockwave System?

Status
Not open for further replies.
Level 14
Joined
Oct 16, 2011
Messages
296
Can someone check this if there's a leak. Also, I know there's a lot of improvement to this, so if someone can improve or make it shorter please do so :)

Edit: as KILLCIDE says,
Post the triggers please. Not everyone has the World Editor on them.

  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave (Trigger)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_WaveEffect[SW_Max] = Abilities\Spells\Orc\Shockwave\ShockwaveMissile.mdl
      • Set SW_WaveEffectL[SW_Max] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set SW_AllowFXLoop[SW_Max] = True
      • Set SW_PointCaster[SW_Max] = (Position of (Triggering unit))
      • Set SW_PointTarget[SW_Max] = (Target point of ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • Set SW_Damage[1] = 10.00
      • Set SW_Damage[2] = 20.00
      • Set SW_Damage[3] = 30.00
      • Set SW_DamageFinal[1] = 200.00
      • Set SW_DamageFinal[2] = 300.00
      • Set SW_DamageFinal[3] = 400.00
      • Set SW_AreaInitial[1] = 125.00
      • Set SW_AreaInitial[2] = 125.00
      • Set SW_AreaInitial[3] = 125.00
      • Set SW_AreaFinal[1] = 125.00
      • Set SW_AreaFinal[2] = 125.00
      • Set SW_AreaFinal[3] = 125.00
      • Set SW_Speed[1] = 1050.00
      • Set SW_Speed[2] = 1050.00
      • Set SW_Speed[3] = 1050.00
      • Set SW_Distance[1] = 400.00
      • Set SW_Distance[2] = 1000.00
      • Set SW_Distance[3] = 1800.00
      • Unit - Create 1 Dummy for (Owner of SW_Caster[SW_Max]) at SW_PointCaster[SW_Max] facing SW_PointTarget[SW_Max]
      • Set SW_Dummy[SW_Max] = (Last created unit)
      • Unit - Turn collision for SW_Dummy[SW_Max] Off
      • Animation - Change SW_Dummy[SW_Max]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Set SW_AreaGrowth[SW_Max] = ((SW_AreaFinal[SW_Lvl[SW_Max]] - SW_AreaInitial[SW_Lvl[SW_Max]]) / ((1.00 / 0.03) x (SW_Distance[SW_Lvl[SW_Max]] / SW_Speed[SW_Lvl[SW_Max]])))
      • Set SW_AreaCurrent[SW_Max] = SW_AreaInitial[SW_Lvl[SW_Max]]
      • Special Effect - Create a special effect attached to the origin of SW_Dummy[SW_Max] using SW_WaveEffect[SW_Max]
      • Custom script: set udg_SW_GroupDone[udg_SW_Max] = CreateGroup()
      • Set SW_DistanceX[SW_Max] = SW_Distance[SW_Lvl[SW_Max]]
      • Set SW_SpeedX[SW_Max] = SW_Speed[SW_Lvl[SW_Max]]
      • Set SW_DamageX[SW_Max] = SW_Damage[SW_Lvl[SW_Max]]
      • Set SW_DamageFinalX[SW_Max] = SW_DamageFinal[SW_Lvl[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
  • Carrion Swarm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Carrion Swarm (Trigger)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_WaveEffect[SW_Max] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmMissile.mdl
      • Set SW_WaveEffectL[SW_Max] = Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
      • Set SW_AllowFXLoop[SW_Max] = True
      • Set SW_PointCaster[SW_Max] = (Position of (Triggering unit))
      • Set SW_PointTarget[SW_Max] = (Target point of ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • Set SW_Damage[1] = 100.00
      • Set SW_Damage[2] = 200.00
      • Set SW_Damage[3] = 300.00
      • Set SW_DamageFinal[1] = 0.00
      • Set SW_DamageFinal[2] = 0.00
      • Set SW_DamageFinal[3] = 0.00
      • Set SW_AreaInitial[1] = 100.00
      • Set SW_AreaInitial[2] = 100.00
      • Set SW_AreaInitial[3] = 100.00
      • Set SW_AreaFinal[1] = 100.00
      • Set SW_AreaFinal[2] = 300.00
      • Set SW_AreaFinal[3] = 500.00
      • Set SW_Speed[1] = 1100.00
      • Set SW_Speed[2] = 1100.00
      • Set SW_Speed[3] = 1100.00
      • Set SW_Distance[1] = 800.00
      • Set SW_Distance[2] = 800.00
      • Set SW_Distance[3] = 800.00
      • Unit - Create 1 Dummy for (Owner of SW_Caster[SW_Max]) at SW_PointCaster[SW_Max] facing SW_PointTarget[SW_Max]
      • Set SW_Dummy[SW_Max] = (Last created unit)
      • Unit - Turn collision for SW_Dummy[SW_Max] Off
      • Animation - Change SW_Dummy[SW_Max]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Set SW_AreaGrowth[SW_Max] = ((SW_AreaFinal[SW_Lvl[SW_Max]] - SW_AreaInitial[SW_Lvl[SW_Max]]) / ((1.00 / 0.03) x (SW_Distance[SW_Lvl[SW_Max]] / SW_Speed[SW_Lvl[SW_Max]])))
      • Set SW_AreaCurrent[SW_Max] = SW_AreaInitial[SW_Lvl[SW_Max]]
      • Special Effect - Create a special effect attached to the origin of SW_Dummy[SW_Max] using SW_WaveEffect[SW_Max]
      • Custom script: set udg_SW_GroupDone[udg_SW_Max] = CreateGroup()
      • Set SW_DistanceX[SW_Max] = SW_Distance[SW_Lvl[SW_Max]]
      • Set SW_SpeedX[SW_Max] = SW_Speed[SW_Lvl[SW_Max]]
      • Set SW_DamageX[SW_Max] = SW_Damage[SW_Lvl[SW_Max]]
      • Set SW_DamageFinalX[SW_Max] = SW_DamageFinal[SW_Lvl[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
  • 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_DistanceX[SW_Loop] = (SW_DistanceX[SW_Loop] - (SW_SpeedX[SW_Loop] / (1.00 / 0.03)))
          • Set SW_Angle[SW_Loop] = (Facing of SW_Dummy[SW_Loop])
          • Set SW_NextPoint[SW_Loop] = (Position of SW_Dummy[SW_Loop])
          • Set SW_NextPointMove[SW_Loop] = (SW_NextPoint[SW_Loop] offset by (SW_SpeedX[SW_Loop] / (1.00 / 0.03)) towards SW_Angle[SW_Loop] degrees)
          • Set SW_AreaCurrent[SW_Loop] = (SW_AreaCurrent[SW_Loop] + SW_AreaGrowth[SW_Loop])
          • Set SW_Group[SW_Loop] = (Units within SW_AreaCurrent[SW_Loop] of SW_NextPointMove[SW_Loop] 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_GroupDone[SW_Loo
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_AllowFXLoop[SW_Loop] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect at SW_NextPoint[SW_Loop] using SW_WaveEffectL[SW_Loop]
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • Unit - Move SW_Dummy[SW_Loop] instantly to SW_NextPointMove[SW_Loop], facing SW_Angle[SW_Loop] degrees
          • Unit Group - Pick every unit in SW_Group[SW_Loop] and do (Actions)
            • Loop - Actions
              • Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_DamageX[SW_Loop] damage of attack type Spells and damage type Universal
              • Unit Group - Add (Picked unit) to SW_GroupDone[SW_Loop]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_DistanceX[SW_Loop] Less than or equal to 0.00
            • Then - Actions
              • Set SW_GroupFinal = (Units within SW_AreaCurrent[SW_Loop] of SW_NextPointMove[SW_Loop] 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)))
              • Unit Group - Pick every unit in SW_GroupFinal and do (Actions)
                • Loop - Actions
                  • Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_DamageFinalX[SW_Loop] damage of attack type Spells and damage type Universal
              • -------- Only remove existing groups. --------
              • Custom script: call DestroyGroup( udg_SW_GroupFinal )
              • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
              • Unit Group - Remove all units of SW_GroupDone[SW_Max] from SW_GroupDone[SW_Max]
              • Set SW_Caster[SW_Loop] = SW_Caster[SW_Max]
              • Set SW_Caster[SW_Max] = No unit
              • Unit - Kill SW_Dummy[SW_Loop]
              • Set SW_Dummy[SW_Loop] = SW_Dummy[SW_Max]
              • Set SW_Dummy[SW_Max] = No unit
              • -------- Must move all members of an object during object move operation. --------
              • Set SW_DistanceX[SW_Loop] = SW_DistanceX[SW_Max]
              • Set SW_SpeedX[SW_Loop] = SW_SpeedX[SW_Max]
              • Set SW_DamageX[SW_Loop] = SW_DamageX[SW_Max]
              • Set SW_DamageFinalX[SW_Loop] = SW_DamageFinalX[SW_Max]
              • Set SW_AreaCurrent[SW_Loop] = SW_AreaCurrent[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
          • Custom script: call RemoveLocation(udg_SW_NextPoint[udg_SW_Loop])
          • Custom script: call RemoveLocation(udg_SW_NextPointMove[udg_SW_Loop])
          • Custom script: call DestroyGroup( udg_SW_Group[udg_SW_Loop] )
          • 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
  • Shockwave Recover
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Dummy
    • Actions
      • Unit - Remove (Triggering unit) from the game
 

Attachments

  • Shockwave.w3x
    23.5 KB · Views: 45
Last edited:
  • Set SW_GroupDone[SW_Max] = (Random 0 units from (Units in (Playable map area)))
This leaks a Group. Cause There are 2 Groups: 1.Group "Units in Playable Map"; 2. Group "0 Units of 1.Group".

Out of the Jass API JASS Manual: API Browser - Blizzard.j
Code:
function GetRandomSubGroup takes integer count, group sourceGroup returns group
    local group g = CreateGroup()

    set bj_randomSubGroupGroup = g
    set bj_randomSubGroupWant  = count
    set bj_randomSubGroupTotal = CountUnitsInGroup(sourceGroup)

    if (bj_randomSubGroupWant <= 0 or bj_randomSubGroupTotal <= 0) then
        return g
    endif

    set bj_randomSubGroupChance = I2R(bj_randomSubGroupWant) / I2R(bj_randomSubGroupTotal)
    call ForGroup(sourceGroup, function GetRandomSubGroupEnum)
    return g
endfunction

Best solution is to use custom script to create an empty Group.
  • Custom script: set udg_SW_GroupDone[udg_SW_Max] = CreateGroup()
  • -------- If that is to much to write or you don't want the system user to use custom script, do something like this --------
  • Set SW_GroupDone[SW_Max] = (Units in (Playable map area) matching (False Equal True))
This might Leak too, Cause the Current Group-Object is not destroyed.
It is only forgotten.
  • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]

Edit: I tested your Map the shockwaves somehow dealed sometimes only 10% dmg.

You can correct me, if i tell bullshit.
 
Last edited:
Level 14
Joined
Oct 16, 2011
Messages
296
  • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
I tried to desroy it with
  • Custom script: call DestroyGroup( udg_SW_GroupDone[udg_SW_Max] )
but when I do, if you cast 2 shockwaves end the first one ends, the damage on the second shockwave also loops to units in passes through. :(
so I thought of using
  • Unit Group - Remove all units of SW_GroupDone[SW_Max] from SW_GroupDone[SW_Max]
but I still consider it might leak.
 
Level 14
Joined
Oct 16, 2011
Messages
296
Sorry, but, what do you mean?
I tried this:
  • Custom script: call DestroyGroup( udg_SW_GroupFinal )
  • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
  • Custom script: call DestroyGroup( udg_SW_GroupDone[udg_SWMax] )
  • Set SW_Caster[SW_Loop] = SW_Caster[SW_Max]
  • Set SW_Caster[SW_Max] = No unit
  • Unit - Kill SW_Dummy[SW_Loop]
  • Set SW_Dummy[SW_Loop] = SW_Dummy[SW_Max]
  • Set SW_Dummy[SW_Max] = No unit
  • Set SW_DistanceX[SW_Loop] = SW_DistanceX[SW_Max]
  • Set SW_SpeedX[SW_Loop] = SW_SpeedX[SW_Max]
  • Set SW_DamageX[SW_Loop] = SW_DamageX[SW_Max]
  • Set SW_DamageFinalX[SW_Loop] = SW_DamageFinalX[SW_Max]
  • Set SW_AreaCurrent[SW_Loop] = SW_AreaCurrent[SW_Max]
  • Set SW_Lvl[SW_Loop] = SW_Lvl[SW_Max]
  • Set SW_Max = (SW_Max - 1)
  • Set SW_Loop = (SW_Loop - 1)
Is there something wrong with;
  • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
  • Custom script: call DestroyGroup( udg_SW_GroupDone[udg_SWMax] )
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
No errors, but things you can change.
  • Configurable variables like Damage[], WaveEffect[], Speed[], Distance[], etc. should all be kept in a map initialization trigger. They are constant data, meaning they will always be the same value throughout the entire game duration, so there is no need to keep storing "100 into Damage[1]" every spell cast if Damage[1] will always be 100. This would make your cast trigger a lot shorter
  • Since Angle[], NextPoint[], NextPointMove[], & Group[] are not unique to an instance, they do not need to be arrays
  • I wouldn't recommend filtering out units via (Matching unit). It is better for you to use an If/Then/Else block inside the unit group loop. You can read more about it here
  • Avoid repeating function calls like (Picked unit) in unit group loops. Store them into variables so that you can just refer to the variable instead of senselessly calling the function over and over
  • Why do you have both Group[] and GroupFinal enumerating units? You can just use one.
  • You don't need to remove units from a destroyed group. Destroying the group does that for you
 
Level 14
Joined
Oct 16, 2011
Messages
296
Okay, so I updated the triggers according to your suggestion(?). I'll be working to remove some limitations.

Correct me if I'm wrong; I didn't kept the configurable variables in a map initialization trigger because multiple shockwave-like spells that will use this system is going to have different values in their respective trigger?
So here is the code:
  • Shockwave Cast
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Dummy for (Owner of SW_Caster[SW_Max]) at SW_Point[0] facing SW_Point[1]
      • Set SW_Dummy[SW_Max] = (Last created unit)
      • Unit - Turn collision for SW_Dummy[SW_Max] Off
      • Set SW_AreaGrowth[SW_Max] = ((SW_AreaFinal[SW_Lvl[SW_Max]] - SW_AreaInitial[SW_Lvl[SW_Max]]) / ((1.00 / 0.03) x (SW_Distance[SW_Lvl[SW_Max]] / SW_Speed[SW_Lvl[SW_Max]])))
      • Set SW_AreaCurrent[SW_Max] = SW_AreaInitial[SW_Lvl[SW_Max]]
      • Special Effect - Create a special effect attached to the origin of SW_Dummy[SW_Max] using SW_WaveEffect[SW_Max]
      • Custom script: set udg_SW_GroupDone[udg_SW_Max] = CreateGroup()
      • Set SW_DistanceX[SW_Max] = SW_Distance[SW_Lvl[SW_Max]]
      • Set SW_SpeedX[SW_Max] = SW_Speed[SW_Lvl[SW_Max]]
      • Set SW_DamageX[SW_Max] = SW_Damage[SW_Lvl[SW_Max]]
      • Set SW_DamageFinalX[SW_Max] = SW_DamageFinal[SW_Lvl[SW_Max]]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SW_AllowExtraEffectLoop[SW_Max] Equal to True
        • Then - Actions
          • Unit - Add SW_ExtraEffect[SW_Max] to SW_Dummy[SW_Max]
          • Unit - Set level of SW_ExtraEffect[SW_Max] for SW_Dummy[SW_Max] to SW_Lvl[SW_Max]
        • Else - Actions
      • 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[0])
      • Custom script: call RemoveLocation(udg_SW_Point[1])
  • 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_DistanceX[SW_Loop] = (SW_DistanceX[SW_Loop] - (SW_SpeedX[SW_Loop] / (1.00 / 0.03)))
          • Set SW_Angle = (Facing of SW_Dummy[SW_Loop])
          • Set SW_NextPoint[0] = (Position of SW_Dummy[SW_Loop])
          • Set SW_NextPoint[1] = (SW_NextPoint[0] offset by (SW_SpeedX[SW_Loop] / (1.00 / 0.03)) towards SW_Angle degrees)
          • Set SW_AreaCurrent[SW_Loop] = (SW_AreaCurrent[SW_Loop] + SW_AreaGrowth[SW_Loop])
          • Set SW_Group = (Units within SW_AreaCurrent[SW_Loop] of SW_NextPoint[1])
          • Unit - Move SW_Dummy[SW_Loop] instantly to SW_NextPoint[1], facing SW_Angle degrees
          • Unit Group - Pick every unit in SW_Group 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 alive) Equal to True
                  • (TempUnit belongs to an enemy of (Owner of SW_Caster[SW_Loop])) Equal to True
                  • (TempUnit is A flying unit) Equal to False
                  • (TempUnit is A structure) Equal to False
                  • (TempUnit is in SW_GroupDone[SW_Loop]) Equal to False
                • Then - Actions
                  • Unit - Cause SW_Caster[SW_Loop] to damage TempUnit, dealing SW_DamageX[SW_Loop] damage of attack type Spells and damage type Universal
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SW_AllowExtraEffectLoop[SW_Loop] Equal to True
                    • Then - Actions
                      • Custom script: call IssueTargetOrderById( udg_SW_Dummy[udg_SW_Loop], S2I(udg_SW_ExtraEffectId[udg_SW_Loop]), udg_TempUnit)
                    • Else - Actions
                  • Unit Group - Add TempUnit to SW_GroupDone[SW_Loop]
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_AllowFXLoop[SW_Loop] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect at SW_NextPoint[0] using SW_WaveEffectL[SW_Loop]
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_DistanceX[SW_Loop] Less than or equal to 0.00
            • Then - Actions
              • Set SW_GroupFinal = (Units within SW_AreaCurrent[SW_Loop] of SW_NextPoint[1])
              • Unit Group - Pick every unit in SW_GroupFinal 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 alive) Equal to True
                      • (TempUnit belongs to an enemy of (Owner of SW_Caster[SW_Loop])) Equal to True
                      • (TempUnit is A flying unit) Equal to False
                      • (TempUnit is in SW_GroupDone[SW_Loop]) Equal to False
                    • Then - Actions
                      • Unit - Cause SW_Caster[SW_Loop] to damage TempUnit, dealing SW_DamageFinalX[SW_Loop] damage of attack type Spells and damage type Universal
                    • Else - Actions
              • Custom script: call DestroyGroup( udg_SW_GroupFinal )
              • Custom script: call DestroyGroup( udg_SW_GroupDone[udg_SW_Loop] )
              • Set SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
              • Set SW_Caster[SW_Loop] = SW_Caster[SW_Max]
              • Set SW_Caster[SW_Max] = No unit
              • Unit - Kill SW_Dummy[SW_Loop]
              • Set SW_Dummy[SW_Loop] = SW_Dummy[SW_Max]
              • Set SW_Dummy[SW_Max] = No unit
              • Set SW_ExtraEffect[SW_Loop] = SW_ExtraEffect[SW_Max]
              • Set SW_DistanceX[SW_Loop] = SW_DistanceX[SW_Max]
              • Set SW_SpeedX[SW_Loop] = SW_SpeedX[SW_Max]
              • Set SW_DamageX[SW_Loop] = SW_DamageX[SW_Max]
              • Set SW_DamageFinalX[SW_Loop] = SW_DamageFinalX[SW_Max]
              • Set SW_AreaCurrent[SW_Loop] = SW_AreaCurrent[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
          • Custom script: call RemoveLocation(udg_SW_NextPoint[0])
          • Custom script: call RemoveLocation(udg_SW_NextPoint[1])
          • Custom script: call DestroyGroup( udg_SW_Group )
          • 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
And this are the sample shockwaves:
  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave (Trigger)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_Point[0] = (Position of (Triggering unit))
      • Set SW_Point[1] = (Target point of ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • Set SW_WaveEffect[SW_Max] = Abilities\Spells\Orc\Shockwave\ShockwaveMissile.mdl
      • Set SW_AllowFXLoop[SW_Max] = False
      • Set SW_AllowExtraEffectLoop[SW_Max] = False
      • Set SW_Damage[1] = 10.00
      • Set SW_Damage[2] = 20.00
      • Set SW_Damage[3] = 30.00
      • Set SW_DamageFinal[1] = 200.00
      • Set SW_DamageFinal[2] = 300.00
      • Set SW_DamageFinal[3] = 400.00
      • Set SW_AreaInitial[1] = 125.00
      • Set SW_AreaInitial[2] = 125.00
      • Set SW_AreaInitial[3] = 125.00
      • Set SW_AreaFinal[1] = 125.00
      • Set SW_AreaFinal[2] = 125.00
      • Set SW_AreaFinal[3] = 125.00
      • Set SW_Speed[1] = 1050.00
      • Set SW_Speed[2] = 1050.00
      • Set SW_Speed[3] = 1050.00
      • Set SW_Distance[1] = 400.00
      • Set SW_Distance[2] = 1000.00
      • Set SW_Distance[3] = 1800.00
      • Trigger - Run Shockwave Cast <gen> (ignoring conditions)
  • Carrion Swarm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Carrion Swarm (Trigger)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_Point[0] = (Position of (Triggering unit))
      • Set SW_Point[1] = (Target point of ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • Set SW_WaveEffect[SW_Max] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmMissile.mdl
      • Set SW_AllowFXLoop[SW_Max] = False
      • Set SW_AllowExtraEffectLoop[SW_Max] = False
      • Set SW_Damage[1] = 100.00
      • Set SW_Damage[2] = 200.00
      • Set SW_Damage[3] = 300.00
      • Set SW_DamageFinal[1] = 0.00
      • Set SW_DamageFinal[2] = 0.00
      • Set SW_DamageFinal[3] = 0.00
      • Set SW_AreaInitial[1] = 100.00
      • Set SW_AreaInitial[2] = 100.00
      • Set SW_AreaInitial[3] = 100.00
      • Set SW_AreaFinal[1] = 100.00
      • Set SW_AreaFinal[2] = 300.00
      • Set SW_AreaFinal[3] = 500.00
      • Set SW_Speed[1] = 1100.00
      • Set SW_Speed[2] = 1100.00
      • Set SW_Speed[3] = 1100.00
      • Set SW_Distance[1] = 800.00
      • Set SW_Distance[2] = 800.00
      • Set SW_Distance[3] = 800.00
      • Trigger - Run Shockwave Cast <gen> (ignoring conditions)
  • Incineration Wave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Incineration Wave (Trigger)
    • Actions
      • Set SW_Max = (SW_Max + 1)
      • Set SW_Caster[SW_Max] = (Triggering unit)
      • Set SW_Point[0] = (Position of (Triggering unit))
      • Set SW_Point[1] = (Target point of ability being cast)
      • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • Set SW_WaveEffect[SW_Max] = <Empty String>
      • Set SW_WaveEffectL[SW_Max] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set SW_AllowFXLoop[SW_Max] = True
      • Set SW_ExtraEffect[SW_Max] = Incineration Wave (Stun)
      • Set SW_ExtraEffectId[SW_Max] = 852095
      • Set SW_AllowExtraEffectLoop[SW_Max] = True
      • Set SW_Damage[1] = 50.00
      • Set SW_Damage[2] = 100.00
      • Set SW_Damage[3] = 150.00
      • Set SW_DamageFinal[1] = 200.00
      • Set SW_DamageFinal[2] = 300.00
      • Set SW_DamageFinal[3] = 400.00
      • Set SW_AreaInitial[1] = 100.00
      • Set SW_AreaInitial[2] = 100.00
      • Set SW_AreaInitial[3] = 100.00
      • Set SW_AreaFinal[1] = 100.00
      • Set SW_AreaFinal[2] = 100.00
      • Set SW_AreaFinal[3] = 100.00
      • Set SW_Speed[1] = 1500.00
      • Set SW_Speed[2] = 1500.00
      • Set SW_Speed[3] = 1500.00
      • Set SW_Distance[1] = 900.00
      • Set SW_Distance[2] = 1350.00
      • Set SW_Distance[3] = 1800.00
      • Trigger - Run Shockwave Cast <gen> (ignoring conditions)
You can test it using the Attached File below.
 

Attachments

  • Shockwave.w3x
    30.6 KB · Views: 29
Level 37
Joined
Jul 22, 2015
Messages
3,485
Ahh mistake. Alternatively, you could use hashtables, but what you have also works.

There is still the issue with repeating function calls I mentioned to you earlier:
  • Set SW_Caster[SW_Max] = (Triggering unit)
  • Set SW_Point[0] = (Position of (Triggering unit))
  • Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
You stored (Triggering unit) into a variable, but instead of referencing that variable, you call (Triggering unit) two more times.
 
Level 14
Joined
Oct 16, 2011
Messages
296
Oops. I forgot to change that. Will do. My bad.

I have a problem with my logic. It's about filtering Picked unit using the ones you recommended.

Ex: Shockwave = Allows all TempUnit(Picked Unit) except Flying units.
Carrion Swarm = Allows all TempUnit(Picked Unit) except Flying units and Mechanical units.

Something like this.
(This is one of the limitations)

Btw, is my Math for a cone-shaped area right? I'm bad at math sorry.
 
Status
Not open for further replies.
Top