I'm trying to make a script that makes a entity fly off once the player is a certain distance away.
My script below works but only if the player keeps moving. Is there away to make the script run without the player moving after the distance is achieved?
Thanks.
local wait_duration = 1000
flying = {}
function fly_init(e)
flying[e] = 0
end
function fly_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 5000 then
flying[e] = 1
end
if flying[e] == 1 then
CollisionOff(e)
GravityOff(e)
MoveUp(e,1200)
RotateY(e,180)
RotateX(e,-1)
StartTimer(e)
flying[e] = 2
end
if GetTimer(e) >= wait_duration and flying[e] == 2 then
MoveForward(e,50000)
end
end
PC - Windows 7 64bit, Intel i5, 12Gb Ram, 1TB WD Black, Evga Geforce 760gtx 2GB
Laptop - Windows 8.1 64 Bit, Core i7-3632QM processor, 8GB of RAM, 1Tb Hdd, Nvidia Geforce GT 740m