- Joined
- Sep 29, 2016
- Messages
- 43
Greetings,
as i continue to learn the World Editor mechanics with my first map, i tried to implement a Custom Cone-like Spell to damage enemies in front of the hero with a custom amount of damage.
But there is one thing that's kinda odd. Every time the Unit Group runs through to check if the units are inside the angle, usually there is 1 unit that is and all the others have some weird fked up angles instead.
If ingame looking at it, the spellcaster to unit angles are around 110° 100° 90° 80° 70° (summon angle 90°, boundaries 45°) the game tells me it was able to attack the one with 70° and lists all others with spellcaster to unit angles around 20°-30°.
You guys got any idea what i did wrong and what has to be changed to make that angle calculation work for every picked unit correctly?
as i continue to learn the World Editor mechanics with my first map, i tried to implement a Custom Cone-like Spell to damage enemies in front of the hero with a custom amount of damage.
But there is one thing that's kinda odd. Every time the Unit Group runs through to check if the units are inside the angle, usually there is 1 unit that is and all the others have some weird fked up angles instead.
If ingame looking at it, the spellcaster to unit angles are around 110° 100° 90° 80° 70° (summon angle 90°, boundaries 45°) the game tells me it was able to attack the one with 70° and lists all others with spellcaster to unit angles around 20°-30°.
-
Events
-
Conditions
-
Actions
-
-------- Position of Caster --------
-
Set Tmp_Point = (Position of (Casting unit))
-
-------- Target Point --------
-
Set Tmp_Point2 = (Target point of ability being cast)
-
-------- All Units in Circle Range --------
-
Set Tmp_UnitGroup = (Units within 500.00 of Tmp_Point matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True))
-
-------- Angle between Spellcaster and targetted Point --------
-
Set Tmp_Real = (Angle from Tmp_Point to Tmp_Point2)
-
Game - Display to (All players) the text: Angle Spellcaster->Target...
-
Game - Display to (All players) the text: (String(Tmp_Real))
-
Unit Group - Pick every unit in Tmp_UnitGroup and do (Actions)
-
Loop - Actions
-
-------- Position of the picked unit --------
-
Set Tmp_Point3 = (Position of (Picked unit))
-
-------- Angle between Spellcaster and targetted Point --------
-
Set Tmp_Real2 = (Angle from Tmp_Point to Tmp_Point3)
-
Game - Display to (All players) the text: Angle Spellcaster->Unit
-
Game - Display to (All players) the text: (String(Tmp_Real2))
-
Set Tmp_Real3 = (Tmp_Real2 - Tmp_Real)
-
Game - Display to (All players) the text: Angle Difference of 1&2
-
Game - Display to (All players) the text: (String(Tmp_Real3))
-
If (Tmp_Real3 Less than -180.00) then do (Set Tmp_Real3 = (Tmp_Real3 + 360.00)) else do (Do nothing)
-
Game - Display to (All players) the text: Angle Difference of 1&2, maybe increased by 360
-
Game - Display to (All players) the text: (String(Tmp_Real3))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Abs(Tmp_Real3)) Less than or equal to 45.00
-
-
Then - Actions
-
Game - Display to (All players) the text: Worked
-
-------- Unit inside cone --------
-
Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Normal
-
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
-
Special Effect - Destroy (Last created special effect)
-
-
Else - Actions
-
Game - Display to (All players) the text: Didn't Work
-
-------- Unit not inside cone --------
-
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
-
Special Effect - Destroy (Last created special effect)
-
-
-
Custom script: call RemoveLocation(udg_Tmp_Point)
-
-
-
Unit Group - Remove all units from Tmp_UnitGroup
-
Custom script: call RemoveLocation(udg_Tmp_Point2)
-
Custom script: call RemoveLocation(udg_Tmp_Point3)
You guys got any idea what i did wrong and what has to be changed to make that angle calculation work for every picked unit correctly?