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

Best Method For A Backstab?

Status
Not open for further replies.
You mean take extra damage when the unit is attacked on its back? Because you can only detect when a specific unit is attacked and was placed already on the map meaning that when a unit is attacked it can't be detected using a generic unit event but insted the only was is specific unit event e.g.
  • Events
    • Unit - Peasant 0000 <gen> Takes damage
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Does that solution work?

This works for sure:
  • Attack GUI Copy Copy 2
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- Set unit variables --------
      • -------- -------------------------------------------------- --------
      • Set u1 = (Attacking unit)
      • Set u2 = (Triggering unit)
      • -------- -------------------------------------------------- --------
      • -------- Set location variables --------
      • -------- -------------------------------------------------- --------
      • Set p1 = (Position of u1)
      • Set p2 = (Position of u2)
      • -------- -------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Cos(((Angle from p1 to p2) - (Facing of u2)))) Greater than 0.00
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Backstab!
        • Else - Actions
      • -------- -------------------------------------------------- --------
      • -------- Clear leaks --------
      • -------- -------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_p1)
      • Custom script: call RemoveLocation(udg_p2)
Modify the greater than x value to adjust the angle width. Keep it between -1 and 1. The closer to 1 the value is, the narrower the angle will be. The loser to -1 the value is, the wider the angle will be.
 
Status
Not open for further replies.
Top