Scripts / Script Execution Range Limit

Author
Message
tomjscott
User Banned
Posted: 12th Jun 2014 18:17
After struggling with an issue for days and pretty much just leaving it alone to work on other things, I finally discovered that there is a range limit to script execution. As far as I know this isn't documented anywhere so there may be others struggling with this issue as well.

The range limit is 3000, which is hard-coded in the engine. So basically this means that if the player is not within a distance of 3000 of an entity with a script that the script will not execute. It does perform the initialization and will run the main function one time at the very beginning, which is a good thing, but will never execute again until the player hits that range threshold.

If you absolutely need a script to execute all the time then you can change the Always On parameter in the entity's property pane. It's in the Physics section. This is very counter-intuitive to say the least because to me it means that physics are always on and what would that have to do with script execution anyway? But there it is. It works that way.

Hope this information can help someone else who may be struggling with this.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 12th Jun 2014 23:04
That explains a few issues I have had. Thanks for the info!



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
Avram
GameGuru TGC Backer
18
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 12th Jun 2014 23:17
Sure, it was there (the "Always On" setting) in Classic too. Guess it's just a way to improve performance, because in most cases it's not important what entities that are far away are doing and thus there is not need for them to do anything while not near the player. I said "in most cases" so in these other cases (when you need the script to run always), simply set "Always On" and it'll work as you imagined.

Login to post a reply

Server time is: 2024-09-08 03:48:36
Your offset time is: 2024-09-08 03:48:36