• 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.

[JASS] JASS Code Facing Issue

Status
Not open for further replies.
Level 1
Joined
Oct 16, 2006
Messages
4
I have a piece of code that emjir3 gave me.
(I think hes on this forum)
I'm not sure if i'm useing it right.

JASS:
function ABU takes unit a, unit b returns real 
     return bj_RADTODEG * Atan2(GetUnitY( b )  - GetUnitY( a ) , GetUnitX( b )  - GetUnitX( a ) ) 
endfunction

//The below if part of the actions

        set angle = ABU(Caster, Target)
        call SetUnitFacing( Caster, angle )

The variables angle, Caster and Target have been set. Let me know if you want the whole trigger, though I think this is enough.
 
Level 11
Joined
Jul 12, 2005
Messages
764
JASS:
function AngleBetweenUnits takes unit a, unit b returns real
    return Atan2(GetUnitY(b)-GetUnitY(a),GetUnitX(b)-GetUnitX(a))*(180.0/3.14159)
endfunction
This one might be working.

Edit: oh no, it's the same as above...
But then? Hmmm. Maybe:
if you want...
...the caster to face its target:
JASS:
set a = ABU(Caster, Target)
call SetUnitFacing(Caster, a)
...the taret to face the caster:
JASS:
set a = ABU(Target, Caster)
call SetUnitFacing(Target, a)
 
Status
Not open for further replies.
Top