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

Need some more help......

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
I want to make a spell that causes the targeted units to be blasted backwards, I can do most of it but one part: It needs to some how get the opposite angle from the point I target (its AoE)

For Example, I target an area and an unit affected is directally south of the center of the targeted area, the unit needs to be moved from the center point, but I can't seem to find a way to do this,

I set the center as a variable, but How do I then set a point thats behind the targeted unit at the right angle?


Center Is here * Unit here * thrown back here*


Unit here*

thrown here *

(Distences are not right Just showing what I mean, If you need more info, please ask :))
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Temp_Loc_1 = Caster's position
Temp_Loc_ 2= Point of ability being cast/ Position of unit of ability being cast
Temp_Real = Angle between Temp_Loc_1 and Temp_Loc_2

In another trigger

Every 0.03 seconds

Temp_Loc_1 = Unit's position
Temp_Loc_ 2= Temp_Loc 1 offset by x.xx towards Temp_Real (point with polar offset)
Move unit instantly to Temp_Loc_2
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Let me know what you think of this:

  • Ability X
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Pushback
    • Actions
      • -------- Area of effect --------
      • Set Temp_Real_1 = (150.00 + (50.00 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • -------- How far units get pushed back. Base + level upgrade. --------
      • Set Temp_Real_2 = (400.00 + (50.00 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • -------- Damage of the spell. base + level upgrade --------
      • Set Temp_Real_3 = (100.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))
      • Set Temp_Loc_1 = (Target point of ability being cast)
      • -------- -------------------- --------
      • Set Temp_Group = (Units within Temp_Real_1 of Temp_Loc_1 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True))))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Loc_2 = (Position of (Picked unit))
          • -------- -------------------- --------
          • Set Temp_Real_4 = (Angle from Temp_Loc_1 to Temp_Loc_2)
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing Temp_Real_3 damage of attack type Hero and damage type Magic
          • -------- -------------------- --------
          • Unit - Pause (Picked unit)
          • Unit Group - Add (Picked unit) to Ability_X_Group
          • -------- -------------------- --------
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Tornado\Tornado_Target.mdl
          • -------- -------------------- --------
          • Hashtable - Save 0.00 as (Key loop) of (Key (Picked unit)) in Abitlity_X_Hash
          • Hashtable - Save 0.00 as (Key offset) of (Key (Picked unit)) in Abitlity_X_Hash
          • Hashtable - Save Temp_Real_2 as (Key range) of (Key (Picked unit)) in Abitlity_X_Hash
          • Hashtable - Save Temp_Real_4 as (Key angle) of (Key (Picked unit)) in Abitlity_X_Hash
          • Hashtable - Save Handle Of(Last created special effect) as (Key eff) of (Key (Picked unit)) in Abitlity_X_Hash
          • -------- -------------------- --------
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- -------------------- --------
          • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • -------- -------------------- --------
      • Trigger - Turn on Ability Knockback <gen>
      • -------- -------------------- --------
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
  • Ability Knockback
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Ability_X_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Loc_1 = (Position of (Picked unit))
          • Set Temp_Real_1 = (Load (Key loop) of (Key (Picked unit)) from Abitlity_X_Hash)
          • Set Temp_Real_2 = (Load (Key angle) of (Key (Picked unit)) from Abitlity_X_Hash)
          • Set Temp_Real_3 = (Load (Key offset) of (Key (Picked unit)) from Abitlity_X_Hash)
          • Set Temp_Real_4 = (Load (Key range) of (Key (Picked unit)) from Abitlity_X_Hash)
          • -------- -------------------- --------
          • Set Temp_Real_1 = (Temp_Real_1 + 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Real_3 Less than Temp_Real_4
            • Then - Actions
              • Set Temp_Real_3 = (Temp_Real_3 + ((Temp_Real_4 x 0.12) x (Power(0.90, Temp_Real_1))))
              • Set Temp_Real_5 = ((Temp_Real_4 x 0.12) x (Power(0.90, Temp_Real_1)))
              • Set Temp_Loc_2 = (Temp_Loc_1 offset by Temp_Real_5 towards Temp_Real_2 degrees)
              • -------- -------------------- --------
              • Unit - Move (Picked unit) instantly to Temp_Loc_2
              • -------- -------------------- --------
              • Set Temp_Integer_1 = (Random integer number between 1 and 4)
              • -------- -------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Integer_1 Equal to 1
                • Then - Actions
                  • Unit - Make (Picked unit) face ((Facing of (Picked unit)) - 180.00) over 0.00 seconds
                • Else - Actions
            • Else - Actions
              • Unit - Unpause (Picked unit)
              • Set Temp_Effect = (Load (Key eff) of (Key (Picked unit)) in Abitlity_X_Hash)
              • Special Effect - Destroy Temp_Effect
              • Unit Group - Remove (Picked unit) from Ability_X_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Abitlity_X_Hash
          • -------- -------------------- --------
          • Hashtable - Save Temp_Real_1 as (Key loop) of (Key (Picked unit)) in Abitlity_X_Hash
          • Hashtable - Save Temp_Real_3 as (Key offset) of (Key (Picked unit)) in Abitlity_X_Hash
          • -------- -------------------- --------
          • Custom script: call RemoveLocation(udg_Temp_Loc_1)
          • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • -------- -------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Ability_X_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Attachments

  • test.w3x
    17.4 KB · Views: 62
Status
Not open for further replies.
Top