CBA ACE AI Surrender Script
This composition consists of a game logic and comment describing the contents.
When placed in your mission, the game logic allows players to force AI to surrender and drop their current weapon, ready to be taken prisoner. Unattended captives might try to escape, and might arm themselves if the area isn’t free of weapons. Affects both civilians and enemy AI, but not players or friendly AI. Compatible with ACE and RHS flashbangs to encourage surrendering when AI are in the affected radius. Well equipped, high morale, or AI that are part of a large group might not surrender immediately. Additionally, "hardcore" AI might not surrender unless outnumbered, outgunned, out of ammo, caught by surprise, or injured.
Note that if you want certain AI to be unaffected by the script, make that AI a "captive" in its attributes. The script is compatible with agents as well, so using the civilian presence module is okay, and generated agents will surrender as expected, although might behave oddly sometimes. AI will show a "hint" when surrendering which can be edited in the script to suit your tastes.
Uses CBA and ACE which is required for both server and clients. Compatible with both singleplayer and multiplayer, including dedicated servers. Can also work with headless clients, but you must be sure that ownership of groups and units do not change too frequently. Only the mission-maker needs the composition: once placed in a mission and the mission published/distributed, the script is copied to clients and servers via the mission file itself just like any other game logic, module, or mission object.
Should be compatible with AI mods like VCOM, but not guaranteed.
To use, under modules -> compositions -> steam workshop, find this composition and place it in your mission. Then as a player, have a weapon and get close enough to a non-captive civilian or enemy AI to threaten it with your weapon. To update an existing mission with the game logic already placed, just delete the old composition and place the updated composition then save/publish your mission again.