When you are moving objects with the Move/MoveWorld functions described above, you might want to obtain information on its current whereabouts. This functions work on Actors and objects. In the following sample script I used this function to control the movement of a light source (a fire) to make a fire pit where the flames actually start slowly and die down in the evening on a daily schedule – the fire objects original Z position is 511:
Begin _HB_Scheduled fire
short control_fire
; The script is attached to an NPC that guards the fire.
;******* this controls the fires schedule:
if ( GetDistance, "HB_Furn_De_Firepit_camp" < 600 )
If ( GameHour < 17 )
if ( HB_Light_Fire_camp->GetPos Z >= 400 )
HB_Light_Fire_camp->MoveWorld z, -0.1 ; Move fire down
else
HB_Light_Fire_camp->disable
endif
elseif ( GameHour >= 17)
HB_Light_Fire_camp->enable
if ( HB_Light_Fire_camp->GetPos Z < 511 )
HB_Light_Fire_camp->MoveWorld z, 0.1 ; move fire up
else
HB_Light_Fire_camp->enable
endif
endif
endif
end
GetAngle , axis(x/y/z) (returns float)
If ( Object_Id->GetAngle, z == 180 )
The GetAngle function returns the world angle, not the local angle. World angles are from 0 to 180 and 0 to -180 (see figure for z axis).
Note: This works on actors and objects, however for the player (and I assume other actors) only the z axis is relevant - GetAngle, x or y always return 0.