avibird 1 155 Posted December 8 Hi I have this snippet of code that I use in my missions it allows human and AI playable units to have unlimited oxygen while under the water no death will occur due to lack of oxygen. Code is placed in initPlayerLocal.sqf AddMissionEventHandler ["eachframe", { if (getoxygenremaining player < 0.1) then { player setoxygenremaining 0.1 }}]; I attempted to use the code to get all AI units non-playable to get unlimited oxygen while underwater but this does not work. Code was placed In server.sqf AddMissionEventHandler ["eachframe", { if (getoxygenremaining foreach allunit< 0.1) then { foreach allunit setoxygenremaining 0.1 }}]; This does not work for non playable AI units. Any help would be greatly appreciated. 1 Share this post Link to post Share on other sites
soldierXXXX 110 Posted December 8 Hi, your code has wrong syntax. Trying to call the code every frame might decrease performance and cause network traffic to be filled with requests. That would certainly cause desynchronization and potentially even game crashes. Try to put this simple code into initServer.sqf [] spawn { scriptName "OxygenSetter"; while {TRUE} do { allUnits apply {_x setOxygenRemaining 1;}; sleep 5; }; }; 1 1 Share this post Link to post Share on other sites