• 🏆 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!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

[Spell] I want only normal attacks to being able to take damage from skill.

Status
Not open for further replies.
Level 14
Joined
Jul 19, 2007
Messages
748
I have a passive skill in my map that is imported from a spellpack and it works like to give the Hero with the skill a chance to damage and slow enemies that's attacking her but I don't want it to damage and slow enemies that's casting spells on her I only want normal physical attacks to be able to take damage and being slowed. How can I fix that? Here is triggers for the skill.
  • Thorn Armor Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set the base damage (Level 1) --------
      • Set VariableSet TA_BaseDamage = 20.00
      • -------- Set the damage growth per each additional level --------
      • Set VariableSet TA_DamageGrowth = 20.00
      • -------- Set the base chance (Level 1) --------
      • Set VariableSet TA_BaseChance = 10
      • -------- Set the chance growth per each additional level --------
      • Set VariableSet TA_ChanceGrowth = 5
      • -------- Set the special effect --------
      • Set VariableSet TA_SFX = Shot II Blue.mdx
  • Thorn Armor
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Untouchable (Armor)) Equal to True
    • Actions
      • Set VariableSet TA_Levels = (Level of Untouchable for GDD_DamagedUnit)
      • Set VariableSet TA_ThornSpawn = (Position of GDD_DamagedUnit)
      • Set VariableSet TA_ThornEffect = (Position of GDD_DamageSource)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (TA_BaseChance + (TA_ChanceGrowth x (TA_Levels - 1)))
          • (GDD_DamageSource is A structure) Not equal to True
          • (GDD_DamageSource is A flying unit) Not equal to True
        • Then - Actions
          • Special Effect - Create a special effect at TA_ThornEffect using TA_SFX
          • Special Effect - Destroy (Last created special effect)
          • Trigger - Turn off (This trigger)
          • Unit - Cause GDD_DamagedUnit to damage GDD_DamageSource, dealing (TA_BaseDamage + (TA_DamageGrowth x ((Real(TA_Levels)) - 1.00))) damage of attack type Spells and damage type Magic
          • Trigger - Turn on (This trigger)
          • Unit - Create 1 Thorn Armor Dummy for (Owner of GDD_DamagedUnit) at TA_ThornSpawn facing Default building facing degrees
          • Set VariableSet Thorn_Dummy = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to Thorn_Dummy
          • Unit - Add Untouchable (slow) to Thorn_Dummy
          • Unit - Order Thorn_Dummy to Human Sorceress - Slow GDD_DamageSource
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TA_ThornSpawn)
      • Custom script: call RemoveLocation(udg_TA_ThornEffect)
 
Level 37
Joined
Feb 27, 2007
Messages
4,886
GDD cannot determine if the damage source was an attack or a spell or code. It's an old system and I would recommend you don't use it; instead you'll need to modify the spell slightly to work with Damage Engine 5.9.0.0 which can tell the difference.
Bribe said:
Usage of the "<Event> becomes EQUAL to <value>" can be extrapolated as per the below:
  • EQUAL works as it always has - will run for any damage.
  • NOT EQUAL only runs for code damage.
  • LESS THAN only runs for damage from attacks but not coded attacks.
  • LESS THAN OR EQUAL only runs for melee attacks but not coded attacks.
  • GREATER THAN OR EQUAL only runs for ranged attacks but not coded attacks.
  • GREATER THAN only runs for Spell damage but not coded spell damage.
So what needs to change:
  • Event becomes Game - DamageEvent becomes Less than 0.00
  • Every instance of GDD_DamageSource becomes DamageEventSource
  • Every instance of GDD_DamagedUnit becomes DamageEventTarget
  • You probably don't have to worry about recursion so you could remove the lines that disable/enable the trigger.
 
Level 14
Joined
Jul 19, 2007
Messages
748
GDD cannot determine if the damage source was an attack or a spell or code. It's an old system and I would recommend you don't use it; instead you'll need to modify the spell slightly to work with Damage Engine 5.9.0.0 which can tell the difference.

So what needs to change:
  • Event becomes Game - DamageEvent becomes Less than 0.00
  • Every instance of GDD_DamageSource becomes DamageEventSource
  • Every instance of GDD_DamagedUnit becomes DamageEventTarget
  • You probably don't have to worry about recursion so you could remove the lines that disable/enable the trigger.
Ok but what should I change it to then?
 
Level 14
Joined
Jul 19, 2007
Messages
748
Instead of one variable... use the other one. That's all I'm telling you to do. The variables from the two systems have different names.
Now I got what you mean, sry... I changed these things but now the spell doesn't seems to work at all... What could be wrong?
  • Thorn Armor
    • Events
      • Game - DamageEvent becomes Less than 0.00
    • Conditions
      • (DamageEventTarget has buff Untouchable (Armor)) Equal to True
    • Actions
      • Set VariableSet TA_Levels = (Level of Untouchable for DamageEventTarget)
      • Set VariableSet TA_ThornSpawn = (Position of DamageEventTarget)
      • Set VariableSet TA_ThornEffect = (Position of DamageEventSource)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (TA_BaseChance + (TA_ChanceGrowth x (TA_Levels - 1)))
          • (DamageEventSource is A structure) Not equal to True
          • (DamageEventSource is A flying unit) Not equal to True
        • Then - Actions
          • Special Effect - Create a special effect at TA_ThornEffect using TA_SFX
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing (TA_BaseDamage + (TA_DamageGrowth x ((Real(TA_Levels)) - 1.00))) damage of attack type Spells and damage type Magic
          • Unit - Create 1 Thorn Armor Dummy for (Owner of DamageEventTarget) at TA_ThornSpawn facing Default building facing degrees
          • Set VariableSet Thorn_Dummy = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to Thorn_Dummy
          • Unit - Add Untouchable (slow) to Thorn_Dummy
          • Unit - Order Thorn_Dummy to Human Sorceress - Slow DamageEventSource
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TA_ThornSpawn)
      • Custom script: call RemoveLocation(udg_TA_ThornEffect)
 
Last edited:
Level 37
Joined
Feb 27, 2007
Messages
4,886
You used Game - DamageEvent becomes Equal to 0.00 which, according to the DamageEngine documentation I quoted, runs for all damage. It should be Less Than or Equal to. But that wouldn't stop the spell from working at all, just from working properly. Did you actually import Damage Engine 5.9.0.0, or did you just create variables with those names? You need to import DamageEngine.

You can test for yourself to see what runs by adding debug messages for the game to display for you. Like this:
  • Game - Display to (All Players) the text "Test text here!" for 9999.99 seconds
Put lines like that in various places to see if it's failing the conditions, or what is running and when. Try disabling some of the conditions to see if that allows it to run properly. If you're attacking the unit with flying units, then the spell will not work (look at the 3rd condition).
 
Level 14
Joined
Jul 19, 2007
Messages
748
You used Game - DamageEvent becomes Equal to 0.00 which, according to the DamageEngine documentation I quoted, runs for all damage. It should be Less Than or Equal to. But that wouldn't stop the spell from working at all, just from working properly. Did you actually import Damage Engine 5.9.0.0, or did you just create variables with those names? You need to import DamageEngine.

You can test for yourself to see what runs by adding debug messages for the game to display for you. Like this:
  • Game - Display to (All Players) the text "Test text here!" for 9999.99 seconds
Put lines like that in various places to see if it's failing the conditions, or what is running and when. Try disabling some of the conditions to see if that allows it to run properly. If you're attacking the unit with flying units, then the spell will not work (look at the 3rd condition).
Well I had an old version of Damage Engine (5.7) so I imported and replaced it with the newest version (5.9) instead but there is no difference. Still the skill doesn't work :-/ Maybe it has to do something with this trigger? Should I enable something in it?
  • Damage Engine Config
    • Events
      • Map initialization
      • Game - DamageModifierEvent becomes Greater than 0.00
      • Game - LethalDamageEvent becomes Less than or equal to 0.00
      • Game - DamageEvent becomes Not equal to 0.00
      • Game - AfterDamageEvent becomes Less than 0.00
      • Game - AOEDamageEvent becomes Greater than or equal to 0.00
      • Game - SourceDamageEvent becomes Equal to 0.00
      • Game - PreDamageEvent becomes Equal to 0.00
      • Game - ArmorDamageEvent becomes Equal to 0.00
      • Game - ZeroDamageEvent becomes Equal to 0.00
    • Conditions
    • Actions
      • -------- You can add extra classifications here if you want to differentiate between your triggered damage --------
      • -------- Use DamageTypeExplosive (or any negative value damage type) if you want a unit killed by that damage to explode --------
      • -------- - --------
      • -------- The pre-defined type Code might be set by Damage Engine if Unit - Damage Target is detected and the user didn't define a type of their own. --------
      • -------- "Pure" is especially important because it overrides both the Damage Engine as well as WarCraft 3 damage modification. --------
      • -------- I therefore gave the user "Explosive Pure" in case one wants to combine the functionality of the two. --------
      • -------- - --------
      • Set VariableSet DamageTypePureExplosive = -2
      • Set VariableSet DamageTypeExplosive = -1
      • Set VariableSet DamageTypeCode = 1
      • Set VariableSet DamageTypePure = 2
      • -------- - --------
      • Set VariableSet DamageTypeHeal = 3
      • Set VariableSet DamageTypeBlocked = 4
      • Set VariableSet DamageTypeReduced = 5
      • -------- - --------
      • Set VariableSet DamageTypeCriticalStrike = 6
      • -------- - --------
      • Custom script: call DamageEngine_DebugStr()
 
Level 14
Joined
Jul 19, 2007
Messages
748
You need to use debug messages, then. I can't help you any more than that without knowing what is and isn't running and/or why.
You mean put text message within the trigger? I tried that but it didn't work. No text showed up...
  • Thorn Armor
    • Events
      • Game - DamageEvent becomes Less than or equal to 0.00
    • Conditions
      • (DamageEventTarget has buff Untouchable (Armor)) Equal to True
    • Actions
      • Game - Display to (All players) for 12.00 seconds the text: Working!
      • Set VariableSet TA_Levels = (Level of Untouchable for DamageEventTarget)
      • Set VariableSet TA_ThornSpawn = (Position of DamageEventTarget)
      • Set VariableSet TA_ThornEffect = (Position of DamageEventSource)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (TA_BaseChance + (TA_ChanceGrowth x (TA_Levels - 1)))
          • (DamageEventSource is A structure) Not equal to True
          • (DamageEventSource is A flying unit) Not equal to True
        • Then - Actions
          • Special Effect - Create a special effect at TA_ThornEffect using TA_SFX
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing (TA_BaseDamage + (TA_DamageGrowth x ((Real(TA_Levels)) - 1.00))) damage of attack type Spells and damage type Magic
          • Unit - Create 1 Thorn Armor Dummy for (Owner of DamageEventTarget) at TA_ThornSpawn facing Default building facing degrees
          • Set VariableSet Thorn_Dummy = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to Thorn_Dummy
          • Unit - Add Untouchable (slow) to Thorn_Dummy
          • Unit - Order Thorn_Dummy to Human Sorceress - Slow DamageEventSource
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TA_ThornSpawn)
      • Custom script: call RemoveLocation(udg_TA_ThornEffect)
 
Level 37
Joined
Feb 27, 2007
Messages
4,886
So that tells you what? That either the event is not running (meaning DamageEngine is not installed or set up properly) or the condition is failing (because the unit doesn't have the buff). Explore those possible reasons and see what you learn.
 
Level 14
Joined
Jul 19, 2007
Messages
748
So that tells you what? That either the event is not running (meaning DamageEngine is not installed or set up properly) or the condition is failing (because the unit doesn't have the buff). Explore those possible reasons and see what you learn.
DamageEngine is correctly installed and the unit clearly has the buff. I tried to change "Game - DamageEvent becomes Less than 0.00" to "DamageModifierEvent becomes Equal to 1.00" and now the skill seems to be working 😯
 
Level 3
Joined
Oct 28, 2010
Messages
6
I don't know about the evnt that starts the trigger, but the generic unit even 'is attacked' only works for actual attacks and not spells.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to Dummy 0073 <gen>
    • Actions
      • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 100.00 damage of attack type Spells and damage type Normal
This causes reflected damage for attacks (both melee and ranged) but not for spells.
Not sure how this works with GDD but i reckon you could still use all the variables, you maybe just need the standard 'attacked unit' and 'attacking unit' part of it.



Disregard this post, I didn't realize it worked the second the attack was initiated.
 
Last edited:
Level 37
Joined
Feb 27, 2007
Messages
4,886
That event runs when the attack starts, not when it goes through and connects. So the reflect happens before the target takes damage. In addition to that, if you spam right click and s to issue the attack order repeatedly while within range it will fire this event every time you click.

In short: A unit is attacked should almost never be used.
 
Status
Not open for further replies.
Top