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

(Spell) How can i make??? And can you make it for me???

Status
Not open for further replies.
-I need to make an item with a bash that has cooldown.
-Item with critical strike that has cooldown.
-A maim effect like the sange & yasha from dota (The new non-orb effect one)
-How can i detect when the ATTACK is done (instead of the attack event that is a propense bug)
-How can i detect if a unit attacks by the back or the front?
 
Level 4
Joined
Mar 24, 2012
Messages
24
I think I know this one.. or maybe not..

-How can i detect if a unit attacks by the back or the front?

  • Back or Front??
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Angle_Array[1] = (Facing of (Attacking unit))
      • Set Angle_Array[2] = (Facing of (Attacked unit))
      • -------- CHECKS IF "ATTACKING UNIT" IS BEHIND "ATTACKED UNIT" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Angle_Array[1] Greater than or equal to (Angle_Array[2] - 45.00)
          • Angle_Array[1] Less than or equal to (Angle_Array[2] + 45.00)
        • Then - Actions
          • -------- ATTACKER IS BEHIND YOU --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Angle_Array[1] Less than or equal to (Angle_Array[2] + (45.00 + 90.00))
              • Angle_Array[1] Less than or equal to (Angle_Array[2] - (45.00 + 90.00))
            • Then - Actions
              • -------- ATTACKER IS IN FRONT YOU --------
            • Else - Actions
      • -------- You can either put or dont put a "Do Nothing" action at the end of Else in the Condition... --------
      • -------- Recommendation: Never put the "Do Nothing" action. Besides, it does nothing at all and its totally meaningless... --------
Why I made like this? Answer: I use the "Attacking Unit" as the center point and the "Attacked Unit" as a moving locus point which is at any position in a circle around the attacker/"Attacking Unit".. hope u understand tis.. :goblin_jawdrop:

Set bla3 = facing angle of attacker
Set bla5 = angle of attacked one's "peripheral vision"

The 1st condition checks whether bla3 is within or equal to bla5. Simply, if attacker's facing angle is equal to attacked one's facing angle, then it shows that the attacker is from behind...

The 2nd condition checks whether bla3 is within or equal to (bla5 +/- 90 degrees)...

Why must bla5 be added +90 or -90 degrees?? Answer: So that the bla3 is somewhere within or equal to an opposite angle of bla5..... Confusing??? Well, lets imagine Attacking Unit is facing East direction, surely an attack in front of him would be a face to face attack right? So, the attacked unit must be facing back to him as well, which is West direction... To ensure the attacker is directly in front of attacked unit, just add +90 or -90 degrees to bla5..

tats all... :goblin_sleep:
 
Status
Not open for further replies.
Top