I tried to make a script to rotate an entity onto itself (Y axis) using the timer to always have constant speed rotation.
Unfortunately, this doesn't work, and the entity begins to spin faster and faster !
----------------------------------------------
local delay = {}
local init_delay = {}
local rotation = {}
GravityOff(e)
function rotation_objet_init(e)
delay[e] = 25
init_delay[e] = delay[e]
rotation = 0
end
function rotation_objet_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 500 then
if GetTimer(e) > delay[e] then
delay[e] = GetTimer(e) + init_delay[e]
RotateY(e,rotation)
rotation = rotation + 1
end
Prompt(rotation)
else
RotateY(e,0)
rotation = 0
end
end
-----------------------------------------------------
Please help me for this script!
Thank you !