• 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.

Formula for frontal attack detection

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
I have a damage dectection system, and it works and stuff

but Whats would i use to detect "damage from infront of the unt"?

I know how to basically do it, just not the "check" for it.
 
  • Actions
    • Set p[1] = (Position of (Triggering unit))
    • Set p[2] = (Position of (Damage source))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Cos(((Facing of (Triggering unit)) - (Angle from p[1] to p[2])))) Greater than (Cos(110.00))
      • Then - Actions
        • Game - Display to (All players) the text: front
      • Else - Actions
        • Game - Display to (All players) the text: back
    • Custom script: call RemoveLocation (udg_p[1])
    • Custom script: call RemoveLocation (udg_p[2])
 
Status
Not open for further replies.
Top