Unit won't change facing

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
JASS:
    call SetUnitTurnSpeed(u,99999)
    if (udg_TurnKey == 1) then //Left
       call SetUnitPositionLoc(u,loc)
       call SetUnitFacing(u,face+5)
    elseif (udg_TurnKey == 2) then //Right
       call SetUnitPositionLoc(u,loc)
       call SetUnitFacing(u,face-5)
    endif
set x = GetLocationX(loc) + 30 * Cos(face * bj_DEGTORAD)     
set y = GetLocationY(loc) + 30 * Sin(face * bj_DEGTORAD)
call IssuePointOrder(u,"move",x,y)

as u see i tried increasing turn speed and setting unit position and still the unit won't change it's facing.....

why doesn't it change? :banghead:

thanks in advance :thup:
 

Flare

Stops copies me!
Reaction score
662
Well, you're changing the unit's facing angle, but ordering it to a point based on it's old angle

Code:
call SetUnitFacing(u,[B]face+5[/B])

set x = GetLocationX(loc) + 30 * Cos([B]face[/B] * bj_DEGTORAD)     
set y = GetLocationY(loc) + 30 * Sin([B]face[/B] * bj_DEGTORAD)

You should set face to face +/- 5, then make the unit's facing equal to face i.e.
JASS:
local unit u = ...
local real face = GetUnitFacing (u)
local real x
local real y
local location loc = ...
if udg_TurnKey == 1 then
  set face = face + 5
elseif udg_TurnKey == 2 then
  set face = face - 5
endif

call SetUnitFacing (u, face)
set x = GetLocationX (loc) + Cos (face * bj_DEGTORAD) * 30
set y = GetLocationY (loc) + Sin (face * bj_DEGTORAD) * 30
call IssuePointOrder(u,"move",x,y)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top