• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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