• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Dummy Unit messing up

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
My ranger has an ability that slows the target 40% for 5 seconds and deals 12% of their max hp per second in damage if they are moving. So I can make each arrow spell look and act like a normal attack, without having the autocast of an orb ability, I have each arrow ability spawn a dummy unit with the same attack properties as the hero, order the dummy to attack, and then check the damage source when the target is damaged. Then the proper buff is applied based on which arrow dummy is the damage source.

So this spell I make a dummy spawn when the ability is cast, then I order it to attack the target. When the target is damaged by the dummy, a buff (Drunken Haze) is cast on them. Then the dummy is moved to the target's current location and checks every 0.2 seconds the distance between the target's position and the dummy's position to see if the target is moving. Problem is, sometimes the dummy unit just ends up at the middle of the map, does not cast the buff, and the spell fails. I don't know why.

  • Venemous Arrow 01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to RNG-2 Venemous Arrow
    • Actions
      • Set temp_point = (Position of (Triggering unit))
      • Set temp_real = (Facing of (Triggering unit))
      • Unit - Create 1 D.RNG-2 Venemous Arrow for (Owner of (Triggering unit)) at temp_point facing temp_real degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Attack (Target unit of ability being cast)
      • Custom script: call RemoveLocation(udg_temp_point)
  • Damage1
    • Events
      • Game - GDD_Damage becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of GDD_DamageSource) Equal to D.RNG-2 Venemous Arrow
        • Then - Actions
          • Set temp_point = (Position of GDD_DamagedUnit)
          • Unit - Create 1 D.RNG Arrow Source for (Owner of GDD_DamageSource) at temp_point facing Default building facing degrees
          • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Add GDD_DamagedUnit to GDD__Group
          • Unit Group - Pick every unit in GDD__Group and do (Actions)
            • Loop - Actions
              • Hashtable - Save 5.00 as (Key duration) of (Key (Picked unit)) in H_RNG_VenemousArrow
              • Hashtable - Save ((0.12 x (Max life of (Picked unit))) x R_FRAME_OVERTIME) as (Key damage) of (Key (Picked unit)) in H_RNG_VenemousArrow
              • Hashtable - Save Handle Of(Last created unit) as (Key source) of (Key (Picked unit)) in H_RNG_VenemousArrow
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in G_RNG_VenemousArrow) Equal to False
                • Then - Actions
                  • Unit Group - Add (Picked unit) to G_RNG_VenemousArrow
                  • Unit - Order (Last created unit) to Neutral Pandaren Brewmaster - Drunken Haze GDD_DamagedUnit
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Venemous Arrow 02 <gen> is on) Equal to False
                    • Then - Actions
                      • Trigger - Turn on Venemous Arrow 02 <gen>
                    • Else - Actions
                • Else - Actions
          • Custom script: call RemoveLocation(udg_temp_point)
        • Else - Actions
  • Venemous Arrow 02
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (G_RNG_VenemousArrow is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in G_RNG_VenemousArrow and do (Actions)
            • Loop - Actions
              • Set temp_real = (Load (Key duration) of (Key (Picked unit)) from H_RNG_VenemousArrow)
              • Set temp_unit = (Load (Key source) of (Key (Picked unit)) in H_RNG_VenemousArrow)
              • Game - Display to (All players) the text: (Venemous Arrow: + (String(temp_real)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • temp_real Greater than 0.00
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set temp_point = (Position of (Picked unit))
                  • Set temp_point2 = (Position of temp_unit)
                  • Game - Display to (All players) the text: (Distance: + (String((Distance between temp_point and temp_point2))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between temp_point and temp_point2) Greater than 8.00
                    • Then - Actions
                      • Unit - Cause temp_unit to damage (Picked unit), dealing (Load (Key damage) of (Key (Picked unit)) from H_RNG_VenemousArrow) damage of attack type Spells and damage type Normal
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Unit - Move temp_unit instantly to temp_point
                  • Hashtable - Save (temp_real - R_FRAME_OVERTIME) as (Key duration) of (Key (Picked unit)) in H_RNG_VenemousArrow
                  • Custom script: call RemoveLocation(udg_temp_point)
                  • Custom script: call RemoveLocation(udg_temp_point2)
                • Else - Actions
                  • Unit - Remove ~RNG-2 Venemous Arrow buff from (Picked unit)
                  • Unit - Remove temp_unit from the game
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in H_RNG_VenemousArrow
                  • Unit Group - Remove (Picked unit) from G_RNG_VenemousArrow
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Level 8
Joined
Apr 30, 2009
Messages
338
Yep I caught that and gave it a 6 second timer, but it still messes up sometimes. I enabled the model for the "source" dummy unit and it seems to instantly move to the center of the map on the first tick of damage.

I tried giving the spell infinite range, and it always fails if the target is out of the sight range of the caster, obviously need visibility for the dummy to cast the buff.

There are 2 ways it can mess up and it's annoying:

1. Buff is cast, but triggered damage does not occur (source moves to map center)

2. Buff is not cast but triggered damage still occurs
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Indeed, dummy needs visibility to cast the spell. However you can make the dummy as neutral hostile, so that he will always see (since the debuff doesn't deal the actual damage, it won't matter which player cast it). That should solve 2)

Map center is a default point returned as Position of non-existing unit.
 
Status
Not open for further replies.
Top