HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Will SetUnitPositionLoc make SetUnitFacing invalid?

07-01-2008, 07:11 AM#1
shingoscar
i noticed this bj function:
Collapse JASS:
function SetUnitPositionLocFacingBJ takes unit whichUnit, location loc, real facing returns nothing
    call SetUnitPositionLoc(whichUnit, loc)
    call SetUnitFacing(whichUnit, facing)
endfunction

when i use it like this:
Collapse JASS:
call SetUnitPositionLocFacingBJ(someunit, GetUnitLoc(someunit), angle)
(don't move the unit,just let it face an angle)
you will find that unit done nothing

why?

moreover,if you exchange these 2 functions:
Collapse JASS:
call SetUnitFacing(someunit, angle)
call SetUnitPositionLoc(someunit, GetUnitLoc(someunit))
then it works well.

give me direction
07-01-2008, 07:48 AM#2
Pyrogasm
I don't really understand what you're saying...
07-01-2008, 11:29 AM#3
Anitarf
If it works, then what's the problem?
07-01-2008, 01:19 PM#4
Vexorian
You found a bug in blizzard.j join the club.

just use the one you fixed, well... just use SetUnitFacing...
07-01-2008, 01:24 PM#5
shingoscar
i mean
for example,you run
set a = 1 + 1
set b = 1 + 2
then a = 2 and b = 3
and you run
set b = 1 + 2
set a = 1 + 1
a also equal to 2 and b = 3

but SetUnitPositionLoc and SetUnitFacing don't
if SetUnitPositionLoc(and some other functions) appears earlier than SetUnitFacing,SetUnitFacing will do nothing.

i just want to know the reason

ps: i found this problem when i wanted to make a keyboard control system
07-01-2008, 08:07 PM#6
Troll-Brain
Collapse JASS:
function Trig_D__clencheur_sans_titre_001_Actions takes nothing returns nothing
    call SetUnitPositionLoc( gg_unit_hfoo_0000, GetRectCenter(GetPlayableMapRect()) )
    call SetUnitFacing(gg_unit_hfoo_0000,90.0)
endfunction

//===========================================================================
function InitTrig_D__clencheur_sans_titre_001 takes nothing returns nothing
    set gg_trg_D__clencheur_sans_titre_001 = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_D__clencheur_sans_titre_001, Player(0) )
    call TriggerAddAction( gg_trg_D__clencheur_sans_titre_001, function Trig_D__clencheur_sans_titre_001_Actions )
endfunction

Yes it is an awful gui code but it still work like it should so i don't understand what's your problem.

You know that SetUnitFacing takes a "little" time to apply the angle ?
07-02-2008, 06:27 AM#7
shingoscar
yes,it does right in most cases.but when the second parameter of SetUnitPositionLoc is the same place(location) of manipulated unit(first parameter),function SetUnitFacing won't do anything.
this's what i want to show

you can play AzerothGrandPrix(in frozenthrone scenario)
press left/right when you don't press up,the car won't turn
blizzard use function SetUnitPositionLocFacingBJ