(Keeps Hive Alive)
The Hive Workshop
 Remember Me?
 Register FAQ Members List Calendar Mark Forums Read

 World Editor Help Zone Ask general questions about World Editor features and use in this forum. If you need help fixing a trigger, please post it in Triggers & Scripts. Please review the forum rules before posting.

 09-04-2009, 06:35 AM #1 (permalink) Killd0zer Recoloring ninja.     Join Date: Jun 2009 Posts: 194 Need some more help...... 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 :))
Maker
I...make things

Resource Moderator

Join Date: Mar 2006
Posts: 7,585
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
__________________
Current project:
Resources

 09-04-2009, 12:21 PM #3 (permalink) Killd0zer Recoloring ninja.     Join Date: Jun 2009 Posts: 194 thanks a ton, I spent a good 30 minutes just trying to get it but for some reason, not being able to.
Maker
I...make things

Resource Moderator

Join Date: Mar 2006
Posts: 7,585
Let me know what you think of this:

trigger
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)

trigger
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
Attached Files
 test.w3x (17.4 KB, 10 views)
__________________
Current project:
Resources

 Bookmarks

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are Off Refbacks are Off Forum Rules

All times are GMT. The time now is 07:03 PM.

 -- Low Graphics ---- Night Elf ---- Terran (Beta) Contact Us - The Hive Workshop - The Warcraft 3 Modding Site - Archive - Top