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

How can i trigger thunderclap/warstomp to deal x attribute damage?

Status
Not open for further replies.
Level 6
Joined
Aug 31, 2018
Messages
157
I need to do:
Warstomp damage = x5 of STR, i tried to do it, but it damages myself and my allies too.
And question number 2
How can i make a trigger for unit, that will not be able to use a specific spell if under 20% health.
 
You need some form of damage detection system for the first one. I recommend Bribe's damage engine.
EDIT: Nevermind, you don't need this lol.

Give me a sec and I will make a quick demo map for you. To avoid damaging yourself you need to use "Pick all units in unit group" and the action "Damage target" then choose picked unit as the unit you want to damage. Remember to include some condition checks in there to avoid damaging your own units etc.

You use an if/then/else action to prevent spell usage under 20% health.
 
Last edited:
Here's an example:

(The 0 second wait time at the end breaks the MUI so you have to ask someone else if you want it to be MUI).

  • Cast Warstomp
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp (Strength version)
    • Actions
      • Set Caster = (Triggering unit)
      • Set CasterStrength = (Strength of Caster (Include bonuses))
      • Set CasterStrengthReal = (Real(CasterStrength))
      • Set CasterMana = (Mana of (Triggering unit))
      • Set TempLoc = (Position of Caster)
      • Set TempGroup = (Units within 250.00 of TempLoc)
      • If ((Percentage life of Caster) Less than 20.00) then do (Set HealthPercentageBoolean = True) else do (Set HealthPercentageBoolean = False)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HealthPercentageBoolean Equal to False
              • ((Picked unit) belongs to an enemy of (Owner of Caster)) Equal to True
            • Then - Actions
              • Unit - Cause Caster to damage (Picked unit), dealing (CasterStrengthReal x 5.00) damage of attack type Spells and damage type Magic
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HealthPercentageBoolean Equal to True
        • Then - Actions
          • Unit - Order Caster to Stop
          • Game - Display to (All players) the text: |cffff0000WARNING: ...
          • Wait 0.00 seconds
          • Unit - Set mana of Caster to CasterMana
        • Else - Actions

Attaching a map with a damage engine so you can see the actual damage done.
 

Attachments

  • War Stomp Damage.w3x
    46 KB · Views: 19

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
@FeelsGoodMan
I would recommend using the "Begins casting an ability" Event to detect the Health % check. Then you can simply Pause the Hero, order the Hero to "Stop", and Unpause it if it's health is < 20%. This will prevent the ability from being cast and removes the need to track mana and other annoying things.
Triggers:
  • Cancel War Stomp
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp (Strength version)
      • (Percentage life of (Triggering unit)) Less than 20.00
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: Requires 20% or mor...
      • Set Caster = (Triggering unit)
      • Unit - Pause Caster
      • Unit - Order Caster to Stop
      • Unit - Unpause Caster
Then re-organize your first trigger to something like this:
  • Cast Warstomp Edit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp (Strength version)
    • Actions
      • Set Caster = (Triggering unit)
      • Set CasterStrength = (Real((Strength of Caster (Include bonuses))))
      • Set WarStompDamage = (CasterStrength x 5.00)
      • Set TempLoc = (Position of Caster)
      • Set TempGroup = (Units within 250.00 of TempLoc)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of Caster)) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
              • ((Picked unit) is invulnerable) Equal to False
            • Then - Actions
              • Unit - Cause Caster to damage (Picked unit), dealing WarStompDamage damage of attack type Spells and damage type Magic
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call DestroyGroup (udg_TempGroup)
There's no need to over complicate things for an ability like this. It's completely MUI by design since there's no waits required. A Damage Engine is unneeded, although I think most maps should have it anyway seeing as how useful it is.

Edit: Fixed the cancel trigger. Need to Pause/Unpause the unit for it to work properly.
 

Attachments

  • War Stomp Damage Uncle.w3x
    19.3 KB · Views: 19
Last edited:
@FeelsGoodMan
I would recommend using the "Begins casting an ability" Event to detect the Health % check. Then you can simply order the Hero to "Stop" if his health is > 20%. This removes the need to track mana and other annoying things plus it will cancel the ability before the Unit even starts playing the animation. Like this:
  • Cancel Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Percentage life of (Triggering unit)) Less than 20.00
      • (Ability being cast) Equal to War Stomp (Strength version)
    • Actions
      • Unit - Order (Triggering unit) to Stop
Then re-organize your first trigger to something like this:
  • Cast Warstomp Edit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp (Strength version)
    • Actions
      • Set Caster = (Triggering unit)
      • Set CasterStrength = (Real((Strength of Caster (Include bonuses))))
      • Set WarStompDamage = (CasterStrength x 5.00)
      • Set TempLoc = (Position of Caster)
      • Set TempGroup = (Units within 250.00 of TempLoc)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of Caster)) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
              • ((Picked unit) is invulnerable) Equal to False
            • Then - Actions
              • Unit - Cause Caster to damage (Picked unit), dealing WarStompDamage damage of attack type Spells and damage type Magic
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call DestroyGroup (udg_TempGroup)
There's no need to over complicate things for an ability like this. It's completely MUI by design since there's no waits required. A Damage Engine is unneeded, although I think most maps should have it anyway seeing as how useful it is.

This doesn't work unfortunately. The unit starts the effect of war stomp before the "stop" order is given so damage is distributed, and it draws the mana of the unit without activating the ability cooldown. Furthermore it makes the war stomp art not show in game.

Also the damage engine was there only to show the actual damage done.

Also if the damage is from magic spell damage I don't think you need to have condition checks for mechanical and magic immune. And if the unit is invulnerable it won't take damage anyway. But for the sake of omitting certain units from the loop for maximum performance I guess it makes sense (if that is why you included them in the loop).
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
Fixed it. Forgot to pause/unpause the unit. For whatever reason pausing the unit makes it work.

Regarding the conditions, I just threw in whatever conditions matched the ability. Some might be redundant but it's not that big of a deal. I just wanted to show some of the conditions that people may overlook like "Is Hidden".

Also, let's say he added a Special Effect like some kind of explosion on each unit that was hit by the ability. Sure, an invulnerable unit won't take the damage, but this Special Effect would be created on it even though it wasn't hit by the ability. It's always a good idea to tie up these loose ends.
 
Last edited:
Fixed it. Forgot to pause/unpause the unit. For whatever reason pausing the unit makes it work.
Really? I had no idea! I have had this problem for a long time and have always tracked units mana with variables and set it after the spell was cancelled. If I had only known it was as easy as pausing/unpausing lol.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
Really? I had no idea! I have had this problem for a long time and have always tracked units mana with variables and set it after the spell was cancelled. If I had only known it was as easy as pausing/unpausing lol.
Yeah, although i'm not entirely sure if it causes any unforeseen problems. I know Pausing has undesired effects but because you Pause/Unpause at the same exact time I don't think it causes any issues in this case.
 
Yeah, although i'm not entirely sure if it causes any unforeseen problems. I know Pausing has undesired effects but because you Pause/Unpause at the same exact time I don't think it causes any issues in this case.
I use a lot of "Pause unit" actions, do you mind explaining why they are undesirable?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
Issues I've found when using Pause:
1) Pause will stop timed buffs likes Stun, Slow, Timed Life, etc, and will resume them when the unit is Unpaused.
2) Dying Paused units won't play their death animation. A possible fix is to Unpause the unit when it dies.
3) Pause disables Passive abilities.

And I'm sure there's even more.

Edit:
Here's an alternative to Pause that I've been using. There might be some bugs using this method but so far it has worked great for me:
  • Pause
    • Events
    • Conditions
    • Actions
      • Animation - Change (Triggering unit) prop window angle to 0.00
      • Animation - Change (Triggering unit) turn speed to 0.00
      • Unit - Add Cargo Hold (Orc Burrow) to (Triggering unit)
      • Unit - Order (Triggering unit) to Stop
  • Unpause
    • Events
    • Conditions
    • Actions
      • Animation - Change (Triggering unit) prop window angle to (Default prop window angle of (Triggering unit))
      • Animation - Change (Triggering unit) turn speed to (Default turn speed of (Triggering unit))
      • Unit - Remove Cargo Hold (Orc Burrow) from (Triggering unit)
Cargo Hold disarms the unit. Prop Window Angle of 0 disables Movement. Turn speed of 0 prevents turning. Then you'll have to find a solution to prevent the unit from casting abilities. You could probably use the Pause/Stop/Unpause solution that I used in the War Stomp ability to prevent your Hero from casting abilities or you could keep track of that unit's abilities in a Table and disable them during the Pause and re-enable them afterwards.
 
Last edited:
Issues I've found when using Pause:
1) Pause will stop timed buffs likes Stun, Slow, Timed Life, etc, and will resume them when the unit is Unpaused.
2) Dying Paused units won't play their death animation. A possible fix is to Unpause the unit when it dies.
3) Pause disables Passive abilities.

And I'm sure there's even more.

Edit:
Here's an alternative to Pause that I've been using. There might be some bugs using this method but so far it has worked great for me:
  • Pause
    • Events
    • Conditions
    • Actions
      • Animation - Change (Triggering unit) prop window angle to 0.00
      • Animation - Change (Triggering unit) turn speed to 0.00
      • Unit - Add Cargo Hold (Orc Burrow) to (Triggering unit)
      • Unit - Order (Triggering unit) to Stop
  • Unpause
    • Events
    • Conditions
    • Actions
      • Animation - Change (Triggering unit) prop window angle to (Default prop window angle of (Triggering unit))
      • Animation - Change (Triggering unit) turn speed to (Default turn speed of (Triggering unit))
      • Unit - Remove Cargo Hold (Orc Burrow) from (Triggering unit)
Cargo Hold disarms the unit. Prop Window Angle of 0 disables Movement. Turn speed of 0 prevents turning. Then you'll have to find a solution to prevent the unit from casting abilities. You could probably use the Pause/Stop/Unpause solution that I used in the War Stomp ability to prevent your Hero from casting abilities or you could keep track of that unit's abilities in a Table and disable them during the Pause and re-enable them afterwards.

Hmm my paused units still plays their death animations when they die, but they are affected by the permanent buffs and disabled passives like you described.

Your suggestion looks interesting, I will definitely take a closer look.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The search area in the trigger is not accurate. Enumerating units in a circle does not factor in unit collision size. One has to enumerate all units in a radius of [desired radius + maximum unit collision size] and then filter for units which are in [desired radius] range of the radius origin. This is done with the in range Boolean returning function set.

If one does not do this then the radius behaviour does not match the standard ability and will potentially hit fewer units.
 
Status
Not open for further replies.
Top