• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] How to make Crushing Wave reduce the mana of enemy units?

Status
Not open for further replies.
Level 5
Joined
Oct 29, 2020
Messages
82
I wanna make the mana of the enemy units that take damage from Crushing Wave be reduced by some amount. How to write the trigger?
 
Level 5
Joined
Oct 29, 2020
Messages
82
Reduce current mana or max mana? Permanently or temporarily? By a flat number or a percentage? The solution is different depending on the answers to all 3 of these questions.
reduce current mana by a flat number just like Mana Burn.
 
Level 39
Joined
Feb 27, 2007
Messages
5,050
Simplest possible solution involves having a damage detection system in your map. It's been a while since I have mucked about with wc3 so I have no idea what DDSes are popular now but I presume they must exist and are efficient. Look up one to use depending on if you are GUI or JASS or Lua user.
  • Turn the hero spell into a dummy spell that just targets a point/unit and does nothing else. (Base it on Channel, a spell specifically designed for doing this.)

  • When the dummy hero spell is cast, create a special invis dummy unit for that hero's owner. Add the actual crushing wave-based spell to that unit with a trigger, set its spell level to the same level as the dummy spell that did nothing that the hero cast, and then have the dummy unit actually cast the crushing wave spell on the same target unit/point. Give it a short expiration timer that is longer than the total duration the CW spell animation might take to play.

  • Make a trigger that runs when a unit takes damage (supplied by the DDS). Check (via conditions) that the source of that damage is a dummy unit and that that dummy unit has the Crushing Wave spell (spell level > 0); if so, you know that unit just took damage from this CW-based spell. In this trigger, reduce the current mana of the damaged unit by the appropriate amount (via Unit - Set Property or SetUnitState). If you want a mana burn effect you'll also need the dummy to deal additional damage to that target.
 
Last edited:

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,628
I attached an example of a triggered shockwave ability that you can edit to drain mana from damaged units.

Add this line to the Pick Every Unit action:
  • Then - Actions
    • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 25.00)
I'm sure the map could be improved a lot but it gets the job done.
 

Attachments

  • Custom Shockwave.w3x
    24.5 KB · Views: 10
Level 5
Joined
Oct 29, 2020
Messages
82
I attached an example of a triggered shockwave ability that you can edit to drain mana from damaged units.

Add this line to the Pick Every Unit action:
  • Then - Actions
    • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 25.00)
I'm sure the map could be improved a lot but it gets the job done.
Thank you very much. But the map file can't be opened.
Capture.PNG
 
Level 13
Joined
Dec 20, 2012
Messages
155
I recommend using Shockwave/Carrion Swarm System v1.1 instead. You can tweak sfx, targets allowed, damage, speed, distance and more.

I attached an example of a triggered Crushing Wave Shockwave/Carrion Swarm ability that reduces mana points by 25. You should be able to open it since I'm using 1.27. I think Uncle is using 1.31 or above.
 

Attachments

  • Shockwave v1.1 crushing wave.w3x
    40 KB · Views: 12
Level 5
Joined
Oct 29, 2020
Messages
82
I recommend using Shockwave/Carrion Swarm System v1.1 instead. You can tweak sfx, targets allowed, damage, speed, distance and more.

I attached an example of a triggered Crushing Wave Shockwave/Carrion Swarm ability that reduces mana points by 25. You should be able to open it since I'm using 1.27. I think Uncle is using 1.31 or above.
Thanks a lot. But your trigger has a problem. The affected units are infinite. It is too powerful. I want the affected units to be finite, just the first 4 or 5 that are hit by Crushing Wave.
 
Level 5
Joined
Oct 29, 2020
Messages
82
nit and does nothing else. (B
Simplest possible solution involves having a damage detection system in your map. It's been a while since I have mucked about with wc3 so I have no idea what DDSes are popular now but I presume they must exist and are efficient. Look up one to use depending on if you are GUI or JASS or Lua user.
  • Turn the hero spell into a dummy spell that just targets a point/unit and does nothing else. (Base it on Channel, a spell specifically designed for doing this.)

  • When the dummy hero spell is cast, create a special invis dummy unit for that hero's owner. Add the actual crushing wave-based spell to that unit with a trigger, set its level to the same level as the hero that cast the dummy spell that did nothing, and then have the dummy unit actually cast the crushing wave spell on the same target unit/point. Give it a short expiration timer that is longer than the total duration the CW spell animation might take to play.

  • Make a trigger that runs when a unit takes damage (supplied by the DDS). Check (via conditions) that the source of that damage is a dummy unit and that that dummy unit has the Crushing Wave spell (spell level > 0); if so, you know that unit just took damage from this CW-based spell. In this trigger, reduce the current mana of the damaged unit by the appropriate amount (via Unit - Set Property or SetUnitState). If you want a mana burn effect you'll also need the dummy to deal additional damage to that target.
Thank you for your guide. But I don't have much experience in writing triggers. Could you be more specific or give me a map of this kind to me so that I can figure out how to do it?
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,628
Thanks a lot. But your trigger has a problem. The affected units are infinite. It is too powerful. I want the affected units to be finite, just the first 4 or 5 that are hit by Crushing Wave.
Do you mean you want it to have a maximum damage limit? And should it disappear after it hits X targets? Or should it keep going but not deal dmg/burn mana?

The more details the better, as there's different solutions depending on the specifics.

It sounds like you want some kind of Integer variable that counts each target hit, and prevents damage/mana burn from occurring once this Integer has become Greater than or equal to 5.
 
Level 5
Joined
Oct 29, 2020
Messages
82
Do you mean you want it to have a maximum damage limit? And should it disappear after it hits X targets? Or should it keep going but not deal dmg/burn mana?

The more details the better, as there's different solutions depending on the specifics.

It sounds like you want some kind of Integer variable that counts each target hit, and prevents damage/mana burn from occurring once this Integer has become Greater than or equal to 5.
As we all know, Shockwave has a maximum damage limit, it can only damage several enemy units. I just want the mana of these damaged units to be reduced.
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,628
Using that system Fleck posted, create three new variables:
SW_DamageMax - Real (array)
SW_DamageMaxPre - Real
SW_ManaBurn - Real (array)

Then edit your Shockwave and Shockwave Loop triggers to look like this:
  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave (Trigger)
    • Actions
      • -------- ------------------------------------------------------------ --------
      • Set VariableSet SW_Max = (SW_Max + 1)
      • Set VariableSet SW_Caster[SW_Max] = (Triggering unit)
      • Set VariableSet SW_Point[0] = (Position of (Triggering unit))
      • Set VariableSet SW_Point[1] = (Target point of ability being cast)
      • Set VariableSet SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
      • -------- ------------------------------------------------------------ --------
      • -------- NEW: --------
      • -------- Declares the maximum amount of damage a Shockwave can deal and how much mana is burned. --------
      • Set VariableSet SW_DamageMax[SW_Max] = 100.00
      • Set VariableSet SW_ManaBurn[SW_Max] = 10.00
      • -------- STOP! --------
      • -------- ------------------------------------------------------------ --------
      • Set VariableSet SW_WaveEffect[SW_Max] = Abilities\Spells\Orc\Shockwave\ShockwaveMissile.mdl
      • -------- Declares what Sfx will the Shockwave be based on. --------
      • Set VariableSet SW_WaveEffectEnd[SW_Max] = Abilities\Spells\Other\Doom\DoomDeath.mdl
      • -------- Declares what Sfx will played when the Shockwave reaches its max distance. --------
      • Set VariableSet SW_LoopingSfx[SW_Max] = False
      • -------- If set to True, it will allow the Shockwave to display a looping Sfx. It requires declaration of "SW_WaveEffectLoop". --------
      • -------- An example of the "SW_WaveEffectLoop" can be found in the Incineration Wave trigger. --------
      • Set VariableSet SW_ExtraEffectCheck[SW_Max] = False
      • -------- If set to True, it will allow the Shockwave to do a specific effect. It requires declaration of "SW_ExtraEffect". --------
      • -------- An example of the "SW_ExtraEffect" can be found in the Silence Wave trigger. --------
      • Set VariableSet SW_ExtraEffectTargetCheck[SW_Max] = False
      • -------- If set to True, it will allow the Shockwave to do a specific effect on an affected. It requires declaration of "SW_ExtraEffectTarget". --------
      • -------- An example of the "SW_ExtraEffectTarget" can be found in the Carrion Swarm trigger. --------
      • Set VariableSet SW_AffectAlly[SW_Max] = False
      • Set VariableSet SW_AffectEnemy[SW_Max] = True
      • Set VariableSet SW_AffectAir[SW_Max] = False
      • Set VariableSet SW_AffectGround[SW_Max] = True
      • Set VariableSet SW_AffectStructure[SW_Max] = False
      • -------- Allows selection of which units will be affected by the Shockwave. --------
      • Set VariableSet SW_OneInstance[SW_Max] = True
      • -------- If set to True, then the instance of the effect/damage to a unit will only be once. --------
      • Set VariableSet SW_AttackType[SW_Max] = Spells
      • -------- Determines what kind of attack type the Shockwave will do. --------
      • Set VariableSet SW_DamageType[SW_Max] = Magic
      • -------- Determines what kind of damage type the Shockwave will do. --------
      • Set VariableSet SW_Attachment = origin
      • -------- Determines where the Shockwave Sfx will be attached to from the Dummy. Only used for giving some height to the wave. --------
      • Set VariableSet SW_Damage[1] = 10.00
      • Set VariableSet SW_Damage[2] = 20.00
      • Set VariableSet SW_Damage[3] = 30.00
      • -------- Determines the amount of damage dealt. --------
      • Set VariableSet SW_AreaInitial[1] = 125.00
      • Set VariableSet SW_AreaInitial[2] = 125.00
      • Set VariableSet SW_AreaInitial[3] = 125.00
      • -------- Determines the initial area of the Shockwave. --------
      • Set VariableSet SW_AreaFinal[1] = 125.00
      • Set VariableSet SW_AreaFinal[2] = 125.00
      • Set VariableSet SW_AreaFinal[3] = 125.00
      • -------- Determines the final area of the Shockwave. --------
      • Set VariableSet SW_Speed[1] = 1050.00
      • Set VariableSet SW_Speed[2] = 1050.00
      • Set VariableSet SW_Speed[3] = 1050.00
      • -------- Determines the speed of the Shockwave. --------
      • Set VariableSet SW_Distance[1] = 400.00
      • Set VariableSet SW_Distance[2] = 1000.00
      • Set VariableSet SW_Distance[3] = 1800.00
      • -------- Determines the max distance that the Shockwave will travel. --------
      • Trigger - Run Shockwave Cast <gen> (ignoring conditions)
  • 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 VariableSet SW_DistanceX[SW_Loop] = (SW_DistanceX[SW_Loop] - (SW_SpeedX[SW_Loop] / (1.00 / 0.03)))
          • Set VariableSet SW_Angle = (Facing of SW_Dummy[SW_Loop])
          • Set VariableSet SW_NextPoint[0] = (Position of SW_Dummy[SW_Loop])
          • Set VariableSet SW_NextPoint[1] = (SW_NextPoint[0] offset by (SW_SpeedX[SW_Loop] / (1.00 / 0.03)) towards SW_Angle degrees.)
          • Set VariableSet SW_AreaCurrent[SW_Loop] = (SW_AreaCurrent[SW_Loop] + SW_AreaGrowth[SW_Loop])
          • Set VariableSet 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
          • If (SW_ExtraEffectCheck[SW_Loop] Equal to True) then do (Trigger - Run SW_ExtraEffect[SW_Loop] (checking conditions)) else do (Do nothing)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SW_LoopingSfx[SW_Loop] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect at SW_NextPoint[0] using SW_WaveEffectLoop[SW_Loop]
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • Unit Group - Pick every unit in SW_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit belongs to an enemy of (Owner of SW_Caster[SW_Loop]).) Equal to SW_AffectEnemy[SW_Loop]
                  • SW_AffectEnemy[SW_Loop] Equal to True
                  • (TempUnit is in SW_GroupDone[SW_Loop].) Equal to False
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((TempUnit is A flying unit) Equal to SW_AffectAir[SW_Loop]) and (SW_AffectAir[SW_Loop] Equal to True)
                      • ((TempUnit is A ground unit) Equal to SW_AffectGround[SW_Loop]) and (SW_AffectGround[SW_Loop] Equal to True)
                      • ((TempUnit is A structure) Equal to SW_AffectStructure[SW_Loop]) and (SW_AffectStructure[SW_Loop] Equal to True)
                • Then - Actions
                  • -------- NEW: --------
                  • Unit - Set mana of TempUnit to ((Mana of TempUnit) - SW_ManaBurn[SW_Loop])
                  • Set VariableSet SW_DamageMaxPre = SW_DamageMax[SW_Loop]
                  • Set VariableSet SW_DamageMax[SW_Loop] = (SW_DamageMax[SW_Loop] - SW_DamageX[SW_Loop])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SW_DamageMax[SW_Loop] Greater than 0.00
                    • Then - Actions
                      • Unit - Cause SW_Caster[SW_Loop] to damage TempUnit, dealing SW_DamageX[SW_Loop] damage of attack type SW_AttackType[SW_Loop] and damage type SW_DamageType[SW_Loop]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SW_DamageMaxPre Greater than 0.00
                        • Then - Actions
                          • Unit - Cause SW_Caster[SW_Loop] to damage TempUnit, dealing SW_DamageMaxPre damage of attack type SW_AttackType[SW_Loop] and damage type SW_DamageType[SW_Loop]
                        • Else - Actions
                  • -------- STOP! --------
                  • -------- --------
                  • If (SW_ExtraEffectTargetCheck[SW_Loop] Equal to True) then do (Trigger - Run SW_ExtraEffectTarget[SW_Loop] (checking conditions)) else do (Do nothing)
                  • If (SW_OneInstance[SW_Loop] Equal to True) then do (Unit Group - Add TempUnit to SW_GroupDone[SW_Loop]) else do (Do nothing)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit belongs to an ally of (Owner of SW_Caster[SW_Loop]).) Equal to SW_AffectAlly[SW_Loop]
                  • SW_AffectAlly[SW_Loop] Equal to True
                  • (TempUnit is in SW_GroupDone[SW_Loop].) Equal to False
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((TempUnit is A flying unit) Equal to SW_AffectAir[SW_Loop]) and (SW_AffectAir[SW_Loop] Equal to True)
                      • ((TempUnit is A ground unit) Equal to SW_AffectGround[SW_Loop]) and (SW_AffectGround[SW_Loop] Equal to True)
                      • ((TempUnit is A structure) Equal to SW_AffectStructure[SW_Loop]) and (SW_AffectStructure[SW_Loop] Equal to True)
                • Then - Actions
                  • If (SW_ExtraEffectTargetCheck[SW_Loop] Equal to True) then do (Trigger - Run SW_ExtraEffectTarget[SW_Loop] (checking conditions)) else do (Do nothing)
                  • If (SW_OneInstance[SW_Loop] Equal to True) then do (Unit Group - Add TempUnit to SW_GroupDone[SW_Loop]) else do (Do nothing)
                • 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
              • Special Effect - Create a special effect attached to the origin of SW_Dummy[SW_Loop] using SW_WaveEffectEnd[SW_Loop]
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Destroy SW_Wave[SW_Loop]
              • Custom script: call DestroyGroup( udg_SW_GroupDone[udg_SW_Loop] )
              • Set VariableSet SW_GroupDone[SW_Loop] = SW_GroupDone[SW_Max]
              • Set VariableSet SW_Caster[SW_Loop] = SW_Caster[SW_Max]
              • Set VariableSet SW_Caster[SW_Max] = No unit
              • Unit - Kill SW_Dummy[SW_Loop]
              • Set VariableSet SW_Dummy[SW_Loop] = SW_Dummy[SW_Max]
              • Set VariableSet SW_Dummy[SW_Max] = No unit
              • Set VariableSet SW_Wave[SW_Loop] = SW_Wave[SW_Max]
              • Set VariableSet SW_WaveEffectEnd[SW_Loop] = SW_WaveEffectEnd[SW_Max]
              • Set VariableSet SW_WaveEffectLoop[SW_Loop] = SW_WaveEffectLoop[SW_Max]
              • Set VariableSet SW_LoopingSfx[SW_Loop] = SW_LoopingSfx[SW_Max]
              • Set VariableSet SW_ExtraEffectCheck[SW_Loop] = SW_ExtraEffectCheck[SW_Max]
              • Set VariableSet SW_ExtraEffect[SW_Loop] = SW_ExtraEffect[SW_Max]
              • Set VariableSet SW_ExtraEffectTargetCheck[SW_Loop] = SW_ExtraEffectTargetCheck[SW_Max]
              • Set VariableSet SW_ExtraEffectTarget[SW_Loop] = SW_ExtraEffectTarget[SW_Max]
              • Set VariableSet SW_AffectAlly[SW_Loop] = SW_AffectAlly[SW_Max]
              • Set VariableSet SW_AffectEnemy[SW_Loop] = SW_AffectEnemy[SW_Max]
              • Set VariableSet SW_AffectAir[SW_Loop] = SW_AffectAir[SW_Max]
              • Set VariableSet SW_AffectStructure[SW_Loop] = SW_AffectStructure[SW_Max]
              • Set VariableSet SW_AffectGround[SW_Loop] = SW_AffectGround[SW_Max]
              • Set VariableSet SW_OneInstance[SW_Loop] = SW_OneInstance[SW_Max]
              • Set VariableSet SW_AttackType[SW_Loop] = SW_AttackType[SW_Max]
              • Set VariableSet SW_DamageType[SW_Loop] = SW_DamageType[SW_Max]
              • Set VariableSet SW_DamageX[SW_Loop] = SW_DamageX[SW_Max]
              • Set VariableSet SW_AreaCurrent[SW_Loop] = SW_AreaCurrent[SW_Max]
              • Set VariableSet SW_AreaGrowth[SW_Loop] = SW_AreaGrowth[SW_Max]
              • Set VariableSet SW_SpeedX[SW_Loop] = SW_SpeedX[SW_Max]
              • Set VariableSet SW_DistanceX[SW_Loop] = SW_DistanceX[SW_Max]
              • Set VariableSet SW_Lvl[SW_Loop] = SW_Lvl[SW_Max]
              • -------- NEW: --------
              • Set VariableSet SW_DamageMax[SW_Loop] = SW_DamageMax[SW_Max]
              • Set VariableSet SW_ManaBurn[SW_Loop] = SW_ManaBurn[SW_Max]
              • -------- STOP! --------
              • Set VariableSet SW_Max = (SW_Max - 1)
              • Set VariableSet 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
Look for these comments I added:
  • -------- NEW: --------
  • -------- STOP! --------
In between NEW and STOP is where I added new actions to the triggers. You'll see it done twice in Shockwave Loop and once in Shockwave.
 

Attachments

  • Shockwave v1.1 crushing wave.w3x
    37.5 KB · Views: 17
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,050
Could you be more specific or give me a map of this kind to me so that I can figure out how to do it?
Every single line you need to have in your triggers is described in my 3 bullet points. Try to follow what I said to do, and when you get stuck then post what you tried. You will learn more this way.

Doing it the way I described will automatically cap damage per cast and won't affect units that are magic immune or whatever else.
 
Level 5
Joined
Oct 29, 2020
Messages
82
I reconsidered my idea and found this ability may be too powful. so I quit. But thanks to all the people that gave me help.
 
Last edited:
Status
Not open for further replies.
Top