Headshot angle help

The-Shadows

New Member
Reaction score
12
i've a projectile missle(throw on location) and i want the triggering that can make "HEADSHOT" if hit on the very center of an enemy's body. the missle detects unit within 75 aoe and the headshot would be < 30: 15(headshot) :30 > like that. thanks for help :thup:
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
It'll be a little trickier because you can't just check if it's within 15 AOE, since it can detect a hit at 75.

Trigger:
  • Headshot
    • Events
    • Conditions
    • Actions
      • Set TempPoint[0] = (Position of MissileUnit)
      • Set HitGroup = (Units within 75.00 of TempPoint[0] matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of MissileUnit)) Equal to True)) and (((Matching unit) is dead) Equal to False)))
      • Set HitUnit = (Random unit from HitGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HitUnit Not equal to No unit
        • Then - Actions
          • Set TempPoint[1] = (Position of HitUnit)
          • Set Angle = ((Angle from TempPoint[0] to TempPoint[1]) - (Facing of MissileUnit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(((Distance between TempPoint[0] and TempPoint[1]) x (Cos((Angle + 90.00)))))) Less than or equal to 15.00
            • Then - Actions
              • -------- HEADSHOT!!1 --------
            • Else - Actions
              • -------- Normal hit. --------
          • Custom script: call RemoveLocation(udg_TempPoint[1])
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint[0])
      • Custom script: call DestroyGroup(udg_HitGroup)
      • Set HitUnit = No unit


This will compare only the sideways distance from the missile (you are using a sliding dummy unit as the missile, right?) to the hit unit, indicating whether the missile would come within 15 distance of the hit unit if it were to keep traveling (since the hit gets detected as far as 75 distance away.)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top