• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Problem tracking a Move order Condition

Status
Not open for further replies.
Level 2
Joined
Jan 12, 2010
Messages
13
Problem tracking If a Ranged Unit finished it's attack animation

Hello fellow forum members.

EDIT: With the help of some of you, I Managed to track if the unit has moved in the past few seconds. However, the problem isn't solved =/. Thx for the Help anyway

EDIT2: Problem Solved, thanks to the guy who suggested me to use Damage Detection System. It wasn't even necessary to implement the Missile Detect system. Thanks to everyone who tried to Help me, the case is Solved =D.

I'll leave the Solution below, so if you ever need it you can use it as you please.

(PDD System used - http://www.hiveworkshop.com/forums/spells-569/physical-damage-detection-gui-v1-2-0-1-a-231846/)

Trigger 1:

  • Skill Flanking Maneuver
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Flanking Maneuver for (Attacking unit)) Not equal to 0
      • ((Attacked unit) is A structure) Equal to False
    • Actions
      • -------- Setting who's the attacking and attacked Unit --------
      • Set Flanking_units[1] = (Attacking unit)
      • Set Flanking_units[2] = (Attacked unit)
      • -------- Setting the Attacking unit's position for later analysis if it has moved --------
      • Set Flanking_position[1] = (Position of Flanking_units[1])
      • -------- Setting the Bonus Damage if the Unit Successfully "Flanked" --------
      • Set Flanking_Damage = (((Real((Level of Flanking Maneuver for Flanking_units[1]))) x 15.00) + (0.05 x (Current movement speed of Flanking_units[1])))
      • -------- Waiting Event to check for new Position of Attacking unit --------
      • Wait 0.80 seconds
      • -------- The next Condition is a Real Comparision, to make sure the Attacking Unit has moved --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((X of Flanking_position[1]) Not equal to (X of (Position of Flanking_units[1]))) or ((Y of Flanking_position[1]) Not equal to (Y of (Position of Flanking_units[1])))
        • Then - Actions
          • -------- At this point, I'm using Custom Value of unit instead of a Boolean Variable --------
          • Unit - Set the custom value of Flanking_units[1] to 1
          • -------- Removing Memory Leak --------
          • Custom script: call RemoveLocation(udg_Flanking_position[1])
        • Else - Actions
Trigger 2:

  • Skill Flanking Damage
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_damageType Equal to PDD_PHYSICAL
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PDD_source Equal to Flanking_units[1]
              • PDD_target Equal to Flanking_units[2]
              • (Custom value of Flanking_units[1]) Equal to 1
            • Then - Actions
              • -------- The Previous Conditions are related to the PDD System, and they make sure that the Flanking target took damage --------
              • -------- Setting Special effect that will play in the attacked unit, if it is sucessfully "Flanked" --------
              • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodFootman.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- Setting the bonus damage caused to the Flanked unit --------
              • Unit - Cause Flanking_units[1] to damage (Triggering unit), dealing Flanking_Damage damage of attack type Hero and damage type Normal
              • -------- Just a floating text to show up with the damage bonus value --------
              • Floating Text - Create floating text that reads (+ + ((String((Integer(Flanking_Damage)))) + !)) above PDD_target with Z offset 0.00, using font size 10.00, color (90.00%, 10.00%, 10.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • -------- Setting the Custom value to 0 again, so everything will have to be checked again --------
              • Unit - Set the custom value of Flanking_units[1] to 0
            • Else - Actions
        • Else - Actions
tl:dr; Is there a way to detect if a ranged unit finished it's attack animation? (In other words, if a unit attacked someone and didn't cancel the attack before the projectile is launch)




I'm having a little problem with a trigger of mine in wich I'm trying to track if a certain unit has attacked and moved afterwards. Thing is, the said unit is a Player-controlled Hero, and thus people can order a unit to attack someone and cancel this order right before the animation is finished (The trigger can detect if someone started to attack a target, but don't check if the attack was successful), and the attack animation and damage aren't done.

7m4rh0


The reason why I'm trying to check this condition is because I've made a spell called "Flanking Maneuvers". That spell would deal bonus damage to a target unit if the owner of this ability ordered to move as soon as he attacked it's target, like a "Hit-and-run" bonus. Any Ideas how to fix / make this work?
 

Attachments

  • Flanking Maneuvers.jpg
    Flanking Maneuvers.jpg
    53 KB · Views: 71
Last edited:
Level 2
Joined
Jan 12, 2010
Messages
13
Right click order is "smart". The order "move" is only if you explicitly order the unit to move with the 'M' hotkey ability. The order "smart" is also issued when you target allied units and enemy units. Hence the "smart" order covers move, patrol and attack.
Thanks for the answer, this information is extremely helpful :D
So, is there any other way to check if the unit has moved out of his position since it attacked?
 
Level 2
Joined
Jan 12, 2010
Messages
13
Check if their current position is the same (or almost the same) as when they attacked.
Thx for the Help, I did it checking if Position X of unit was different 0.5 seconds later. The problem is, A unit can order to attack and cancel the order before it finishes. Now I'm struggling on how Will I manage to track if said Unit actually finished it's attack animation. Any Ideas?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"I'm having a little problem with a trigger of mine in wich I'm trying to track if a certain unit has moved in the past 0.5 seconds. Thing is, the said "

Every 0.5s, store each units X and Y in an array (using unit indexer) and check if those are the same as the current X and Y... if not, unit is moving.
(first check then store ofc)

That is how isMoving works I thought.
 
Thx for the Help, I did it checking if Position X of unit was different 0.5 seconds later. The problem is, A unit can order to attack and cancel the order before it finishes. Now I'm struggling on how Will I manage to track if said Unit actually finished it's attack animation. Any Ideas?

Melee attacks can be detected through DDS as they applied as soon as the animation ends.
 
Level 2
Joined
Jan 12, 2010
Messages
13
Melee attacks can be detected through DDS as they applied as soon as the animation ends.
@Daffa, But the problem is that I'm trying to detect if a Ranged unit finished its attack animation :C , however, a unit can be ordered to attack a target and cancel it afterwards. The trigger will read as if you attacked the unit, even if the attack was canceled.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
It does.

There is this little thing that you could do.
Make the unit have 0 missile speed. (dunno if that works actually)
Test if that will make him hit its target immediately.
If so, also remove the missile model.
If not, change attack type from missile to instant. (100% works but will be weird on damage factors.)

Then you use a DDS and when that unit attacks someone with a basic attack, that is the moment that he releases his arrow (because damage is instant).
Then you can make a missile using a missile system which deals the exact same amount of damage as the amount of damage taken.
Use the DDS again to nullify the damage taken.
 
Level 2
Joined
Jan 12, 2010
Messages
13
It does.

There is this little thing that you could do.
Make the unit have 0 missile speed. (dunno if that works actually)
Test if that will make him hit its target immediately.
If so, also remove the missile model.
If not, change attack type from missile to instant. (100% works but will be weird on damage factors.)

Then you use a DDS and when that unit attacks someone with a basic attack, that is the moment that he releases his arrow (because damage is instant).
Then you can make a missile using a missile system which deals the exact same amount of damage as the amount of damage taken.
Use the DDS again to nullify the damage taken.

WOw, Quite impressive. I'll try it as soon as possible. Thx for the help
 
Status
Not open for further replies.
Top