[Spell] Passive spell which reduce basic attack damage

Level 13
Joined
Sep 11, 2013
Messages
467
Greetings!
I want to create a passive spell for my tower which reduce basic attack damage of enemy units with 75% when attack the enemy with normal hit. Also, my tower must have a 35% chance to proc this passive on each attack and i want the spell to be MUI. debuff duration must be 15 seconds.

I tried to make it alone, but I am not sure if i did good..
  • Untitled Trigger 002
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Damage source)) Equal to Tower
    • Actions
      • Game - Display to (All players) the text: 1
      • Set VariableSet IntegerPurgeChange = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerPurgeChange Less than or equal to 35
        • Then - Actions
          • Game - Display to (All players) the text: 2
          • Set VariableSet CrippleCursePoint = (Position of (Damage source))
          • Unit - Create 1 Wisp Cripple/Curse Dummy for (Owner of (Damage source)) at CrippleCursePoint facing (Position of (Damage Target))
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Cripple X to (Last created unit)
          • Unit - Set level of Cripple X for (Last created unit) to 1
          • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Damage Target)
          • Special Effect - Create a special effect attached to the origin of (Damage Target) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_CrippleCursePoint)
        • Else - Actions
I found a small problem with my trigger.
Because my dummy unit do not have big vision (150), when the tower attack a running target, and the target go on fog of war, the dummy will not proc his spell..
I don't want to make huge vision for my dummy because dummy share his vision with me and this will be annying for players. (is like cheating..)
What is the best way to make this type of spell?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Here's an updated trigger with optimizations and an attempt to fix the vision problem:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Tower
      • (Random integer number between 1 and 100) Less than or equal to 35
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Damage Target) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set VariableSet CrippleCursePoint = (Position of (Damage Target))
      • Unit - Create 1 Dummy for (Owner of (Damage source)) at CrippleCursePoint facing (default building degrees)
      • Custom script: call RemoveLocation(udg_CrippleCursePoint)
      • Set VariableSet CrippleCurseDummy = (Last created unit)
      • Unit - Add a 0.20 second Generic expiration timer to CrippleCurseDummy
      • Unit - Add Cripple X to CrippleCurseDummy
      • Unit - Grant shared vision of (Damage Target) to (Owner of (Damage source))
      • Unit - Order CrippleCurseDummy to Undead Necromancer - Cripple (Damage Target)
      • Unit - Deny shared vision of (Damage Target) to (Owner of (Damage source))
Your Dummy shouldn't need any Sight Radius if this "granted vision" solution works. You can also Set Variables for the (Damage source) and (Damage Target) to further improve the trigger.

Back to the Dummy, you generally only need one type of Dummy unit. Here's how to create a proper Dummy unit:
1) Copy and paste the Locust.
2) Set it's Movement Type = None, Speed Base = 0, Attacks Enabled = None, Model = None, Shadow = None.
3) (Recommended) Use Vexorian's Dummy model instead, allowing it to have Attachment Points for Art related purposes.

HOWEVER, if you're using the Dummy as a Missile (old systems would rely on these instead of Special Effects) then the Movement settings need to be enabled. So in this case you might want two types of Dummy units -> Caster / Missile.

Oh and an alternative solution to the vision problem is to create the Dummy unit for an unused Player that has been given vision of everything. So for example your Neutral Extra player can be setup to have a visibility modifier across the map. This is useful for spells like Cripple which don't deal any damage.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Thank you very much! Your trigger works perfect! I don't need Vexorian's Dummy for the moment and I don't use dummy as a missile.
I don't understant how a variable for damage source and damage target will improve this trigger. It already works. :peasant-confused:
No problem :)

This is a more advanced nitpick and not something I would put too much focus on but...

1) Whenever you reference an Event Response you're actually calling a function which returns you a variable. This is less efficient than just referencing a variable directly, although it's a very minor thing to worry about. That being said, a map with 100's of "efficient" triggers could have better performance than one that doesn't. But again, don't go crazy thinking you need to redo all of your triggers.

2) Variables can help you avoid the rare issue of an Event Response getting lost/changed. But this can really depend on a lot of things, plus a shared variable could cause the same exact problem. Unique variables are often the best solution, but bare in mind that too many variables will bloat the trigger editor.

Regarding #2, here's an example of a problem that could possibly occur:
Whenever you Order the Dummy unit to cast Cripple it will actually cause the "Unit - A unit Takes damage" Event to run for 0 damage. In this case you're hoping that 1) the Event Responses involved act like local variables and can't change from outside sources, 2) the trigger queue will handle things in a separate manner, 3) the (Damage Target) will be set to the same target.

However, you've confirmed that your trigger works perfectly (for now), so you're likely in the clear. Most things are designed to work smoothly, but I'm sure you've had to deal with this kind of issue before.
 
Last edited:
Top