• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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,243
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