Scripts / Flying script help

Author
Message
Emrys
11
Years of Service
User Offline
Joined: 4th Nov 2013
Location: UK
Posted: 20th Dec 2015 18:49 Edited at: 20th Dec 2015 18:50
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.

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
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Dec 2015 20:05
I've tried your script and it works as expected, at least for me.

I've placed player closest to entity, run test mode, and entity has move far away, of course player has to walk in order to run inside the entity range, to run script again.

Maybe you has to add another flag variable, so run script is not exclusively regarded to player dist.

Quote: "if playerDist == 50000 and yourflag == 0 then
do something
else
do nothing or something else
end"


3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Dec 2015 22:12
open the properties and turn the object to always active = yes
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
wermer
9
Years of Service
User Offline
Joined: 18th Sep 2015
Location:
Posted: 20th Dec 2015 23:10
I think smallg is right - 'Always Active = Yes' is what you want, but that will make the entities continue to fly off into space forever.
You might want to clean them up when they get out of view:

if PlayerDist > 30000 then
Destroy(e)
SwitchScript(e,'default.lua')
end

(Destroy seems to only hide the entity, so SwitchScript to default is to stop PlayerDist from counting until something breaks.)

Windows 10 Home 64-bit / Intel i5 2500k @ 4.4Ghz + Asetek 510LC / Intel DP67DE / Intel 530 Series 240GB SSD / 12GB Kingston KVR 1333 / XFX Radeon R9 285 / Corsair TX 650 / Antec 300
PM
Emrys
11
Years of Service
User Offline
Joined: 4th Nov 2013
Location: UK
Posted: 21st Dec 2015 14:05
Thanks guys, that gives me a bit more work with. I'll let you know how I get on.
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
PM

Login to post a reply

Server time is: 2024-12-22 10:06:21
Your offset time is: 2024-12-22 10:06:21