• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Another unit facing problem

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
Ran into a roadblock with the god damn Modulo function again trying to make this ability:

attachment.php


Here is the trigger:

  • Cleave 01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BRS-4 Cleave
    • Actions
      • Set temp_point = (Position of (Triggering unit))
      • Set temp_group = (Units within 200.00 of temp_point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is Mechanical) Equal to False))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • Set temp_point2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Angle from temp_point to temp_point2) Less than (((Facing of (Triggering unit)) + 60.00) mod 360.00)
                  • (Angle from temp_point to temp_point2) Greater than (((Facing of (Triggering unit)) - 60.00) mod 360.00)
                • Then - Actions
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 25.00 damage of attack type Hero and damage type Normal
                  • Unit - Create 1 D.BRS-4 Cleave for (Owner of (Triggering unit)) at temp_point2 facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                  • Hashtable - Save (Angle from temp_point to temp_point2) as (Key angle) of (Key (Picked unit)) in H_Cleave
                  • Hashtable - Save 1.00 as (Key duration) of (Key (Picked unit)) in H_Cleave
                  • Hashtable - Save 240.00 as (Key speed) of (Key (Picked unit)) in H_Cleave
                  • Unit Group - Add (Picked unit) to G_Cleave
                • Else - Actions
              • Custom script: call RemoveLocation(udg_temp_point2)
              • Unit Group - Remove (Picked unit) from temp_group
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Cleave 02 <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on Cleave 02 <gen>
            • Else - Actions
        • Else - Actions
 

Attachments

  • WC3ScrnShot_041310_075748_02.jpg
    WC3ScrnShot_041310_075748_02.jpg
    1.3 MB · Views: 152
Level 37
Joined
Mar 6, 2006
Messages
9,240
Try this:

  • (Cos((Temp_Real_1 - (Angle from Temp_Loc_1 to Temp_Loc_3)))) Greater than (Cos(Angle))
Temp_Real_1 = Casting unit's facing
Loc_1 = Casting unit's position
Loc_3 = Other unit's position
Angle = Half the width of the "cone" in angles. If you set it to 30 °, it will check for 60 ° angle.
 
Level 8
Joined
Apr 30, 2009
Messages
338
thanks that works

  • Cleave 01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BRS-4 Cleave
    • Actions
      • Set temp_point = (Position of (Triggering unit))
      • Set temp_group = (Units within 200.00 of temp_point matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is Mechanical) Equal to False))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • Set temp_integer = 0
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • Set temp_point2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos(((Facing of (Triggering unit)) - (Angle from temp_point to temp_point2)))) Greater than (Cos(60.00))
                • Then - Actions
                  • Set temp_integer = (temp_integer + 1)
                  • Unit - Create 1 D.BRS-4 Cleave for (Owner of (Triggering unit)) at temp_point2 facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                  • Hashtable - Save (Angle from temp_point to temp_point2) as (Key angle) of (Key (Picked unit)) in H_Cleave
                  • Hashtable - Save 1.00 as (Key duration) of (Key (Picked unit)) in H_Cleave
                  • Hashtable - Save 240.00 as (Key speed) of (Key (Picked unit)) in H_Cleave
                  • Unit Group - Add (Picked unit) to G_Cleave
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from temp_group
              • Custom script: call RemoveLocation(udg_temp_point2)
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (50.00 / (Real(temp_integer))) damage of attack type Hero and damage type Normal
              • Unit Group - Remove (Picked unit) from temp_group
          • Custom script: call DestroyGroup(udg_temp_group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Cleave 02 <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on Cleave 02 <gen>
            • Else - Actions
        • Else - Actions
 
Status
Not open for further replies.
Top