Long ago in my vanilla Chernarus servers I used a simple mission file script tied to a mission sensor to remove zeds from my player bases.
These days that would run afoul of today's enhanced client-side BE filters, and the sensors are fairly computationally intensive. I thought I might try a simple server-side loop that would execute periodically.
In init.sqf I include this call in one of the if (isServer) blocks:
if ( isServer ) then { ..... // the new server loop to manage zed-free zones, etc [] execVM "\z\addons\dayz_server\system\server_loop.sqf"; };
And in the same folder as server_cleanup.fsm and server_monitor.sqf I've placed my new server_loop.sqf:
// a server loop to remove zombies from trader city BASH private [ "_zombies" , "_count" , "_iloop" , "_posCenterBash" ]; ..... // the approximate center of trader city Bash _posCenterBash = [ 4063.0 , 11672.0 , 0.0 ]; // do forever while { true } do { ..... // get the list of zombies _zombies = _posCenterBash nearEntities [ "zZombie_new_Base" , 30 ]; // count that list's contents _count = count _zombies; // traverse them for "_iloop" from 0 to ( _count -1 ) do { // pick this zombie _zombie = _zombies select _iloop; // move them somewhere else ( drop them out of the sky near the Cherno supermarket entrance, for the sake of humor.... ) _zombie setPos [6564.708, 2249.1897, 100.0]; }; // wait five seconds sleep 5; };
My thinking is that I can add and tweak on this file without forcing players to download new mission files. I know the script is firing and looping because I'm also using it to blast an elapsed server run time calculated on the server via publicVariable to the clients.
It doesn't work. I've previously had issue with scripts recognizing arrays as positions unless they've been set to a position value by a call to a function that returns a position value, but I have little to no experience with server-side scripts, so I don't know if that's the only issue, an issue at all, or whatever.
I've fixed the Bash zed problem by simply removing the C130 and Ural wrecks -- the only geometry in the area that appear in CfgBuildingPos.hpp -- that sit in the field behind the traders, but I'd still like to figure this out.