Turret Safety System allows the pilot to control whether or not the mounted-turret operators are able to fire the Miniguns.
Fully compatible in both Singleplayer and Multiplayer.
Handy for those times when you don't want the AI to be firing at the guns at all.
Also handy to prevent players from unwanted discharging of the Minigun weapon system.
Decided to publish this script as a late Christmas gift to the community. I suck at naming things (and dont have things named when I use them), so I'll call it the Turret Safety System. Some of you who frequent the (currently) more popular Invade Annex servers will likely have already have experienced this script.
It was developed a couple months ago in haste, the day before a 'Free Weekend' event. On the co-op public servers, these Free Weekends result in mass numbers of trolls and invalids entering the game. They jump into a turret seat of the helicopter and proceed to fire at anything and everything. Not only does this cause great lag due to the sound issue with Miniguns, but also the pilot has no control over this, and a frustrated yelling match ensues between the pilot, innocent victims, admins, and usually the troll on the gun keeps quiet. The catch is, the pilot would often get the teamkill logged against them, as the 'effectiveCommander' of the vehicle. This confuses some of my anti-teamkill logging and management, and I really believe if you are the 'effectiveCommander' of a vehicle, you ought to have the ability to decide whether the turret is fire-able or not, since you ARE responsible and your rating is adjusted by the game engine as a result of the gunners actions.
It is especially important on common transport vehicles where it is common for players to get into the turret seats and use them as extra cargo seats.
If this script proves popular (it is already popular in public I&A), I'll add support for other vehicle types as well.
Technical mumbo jumbo:
This is basically an add-action script wrapper for the 'addWeaponTurret/removeWeaponTurret' commands.
There are a number of functions, the reason for this is that addAction conditions are evaluated very often, so for performance reasons I limit the number of evaluations per condition by splitting the required evaluations into a number of functions, rather than lumping them all into one condition function and having a stack of evaluations occurring very frequently. Basically, a small eval for each action, rather than a big eval for many actions.
Also, when not in use, the exposed 'surface area' of the code is only one addAction. Upon use, it expands into a few relevant actions. After use, back to one action. This keeps evaluations to a minimum to save CPU for other stuff. Client CPU is not the MP bottleneck so there is actually a bit of flexibility, and as such things like this are virtually 'free' performance-wise.
Completely client-side, no server loading. It has to do some MP broadcast of the lock/unlock toggle, since the code must execute also on the owner of the turret and for anybody who might jump into the turret seat after, so it does have to synchronize.
UH-80 Ghosthawk (both variants)
CH-67 Huron (armed variant)
Easily add modded helicopters to the system, in the config section of the script.
Installation / Usage:
Simply initialize it in the client initialization process. No server-side component and will work on any vehicle of the correct types. Works in any gamemode, TvT, PvP, SP, COOP, etc.
You can control whether everyone has access, or only pilot roles. Open the file, scroll down to the Config section and edit the 'TRUE/FALSE' variable for this.
Place the below line in 'initPlayerLocal.sqf' in your main mission directory:
 execVM 'QS_TurretSafetySystem.sqf';
Credits & Thanks:
Script developed on this public server: 188.8.131.52:2302 DEVGRU US #1
License / Disclaimer:
You may modify the 'Last modified' section.
All the copyright stuff, etc.
- Replaced use of BIS_fnc_MP with new remoteExec command.
- Slight optimization
- Made easier to add modded helicopters to the system.
- Pilot can now toggle the turrets even from the co-pilot seat.
- first release
- BI forums