Warcraft III resources & community, 2003–2006 · archived

JASS Code Facing Issue

5 posts
#1

JASS Code Facing Issue

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.

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.
#2
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:
set a = ABU(Caster, Target)
call SetUnitFacing(Caster, a)

...the taret to face the caster:
set a = ABU(Target, Caster)
call SetUnitFacing(Target, a)
#3
EDIT: im an idiot :D
#4
that's not what he wants...
#5
sorry, lol, mbe i misunderstood then

i just read the topic title, understood that ( or so i thought ), read the script, and just assumed he was confused :?

ugh, reread, and missed that last line...