• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Facing of Unit

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
A unit starts the effect of an ability

This ability creates two units


Unit 1| Caster | Unit 2


How to make units face the angle opposite to the caster ? Mean

<--- Face here Unit 1| Caster | Unit 2 ----> face here
 
Level 5
Joined
Jan 27, 2014
Messages
164
Code:
Actions
    Set PointCaster = (Position of (Triggering unit))
    Set Point1 = (PointCaster offset by 256.00 towards (Facing of (Triggering unit)) degrees)
    Set Point2 = (PointCaster offset by 256.00 towards ((Facing of (Triggering unit)) + 180.00) degrees)
    Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point1 facing (Angle from PointCaster to Point1) degrees
    Unit - Create 1 Footman for (Owner of (Triggering unit)) at Point2 facing (Angle from PointCaster to Point2) degrees

You can try something like the above.
 
  • Like
Reactions: hdm
That will only work if the caster is facing 0 to 180 degrees. The Set Point2 part that is.
Because if the units i facing 181 degrees Point2 will equal to 361 degrees and that is not possible.

You have to throw in an If/then/else.
Set Real2 = (PointCaster offset by 256.00 towards ((Facing of (Triggering unit)) + 180.00) degrees)
If - Real2 is Greater than 360
Then - Set Real2 = Real2 - 360
Else -

And go from there.
 
  • Like
Reactions: ILH
It seems you are correct.
I just tried this:
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing qw as An exact match
    • Conditions
    • Actions
      • Unit - Order Tauren Chieftain 0000 <gen> to Orc Tauren Chieftain - Shockwave ((Position of Tauren Chieftain 0000 <gen>) offset by 256.00 towards 450.00 degrees)
And he does indeed cast towards 90 degrees.
I'm sorry.

Though I am pretty sure I have encountered problems with degrees above 360. Some cone spell if memory serves me.
 
Level 5
Joined
Jan 27, 2014
Messages
164
> I have encountered problems with degrees above 360

This is only true if you compare 'unit facing angle' with 'angle between points'.
In WC3, the latter detects angle between -180 and 180. The former detects angle between 0 and 360. So problem will only arise if you use real comparison between both types of angle.
 
Status
Not open for further replies.
Top