Script: Disarm and Surrender
Posted: Wed Jan 23, 2013 9:02 pm
Reading those fantastic tales of prisoner taking (and executing) in the last AAR just made me want to finish this quick script solution for disarming wounded enemies and surrendering.
This gives anyone the ability to disarm a wounded enemy, so that he can then be healed safely, and, why not, used as a human shield. It can also give the ability to anyone to surrender, by putting your arms on your head and dropping all of your weapons to the floor.
I have found no use to it yet, but maybe one of the mission makers around will.
This script pack is ready to be included in any mission and is designed to be used in adversarials.
All three scripts are to be put in a Custom folder, at the root of your mission.
BM_disarmInit.sqf
BM_disarm.sqf
BM_surrender.sqf
This would be called in the init.sqf, the first parameter activates the disarming system, the second the surrender system.
This would launch both systems.
This gives anyone the ability to disarm a wounded enemy, so that he can then be healed safely, and, why not, used as a human shield. It can also give the ability to anyone to surrender, by putting your arms on your head and dropping all of your weapons to the floor.
I have found no use to it yet, but maybe one of the mission makers around will.
This script pack is ready to be included in any mission and is designed to be used in adversarials.
All three scripts are to be put in a Custom folder, at the root of your mission.
BM_disarmInit.sqf
Code: Select all
_isDisarmEnabled = _this select 0;
_isSurrenderEnabled = _this select 1;
BM_Disarmed = "";
if (_isDisarmEnabled) then {
if (!isDedicated) then {
{
if (side _x != side player) then {
_act = _x addAction ["Search/Disarm", "Custom\BM_disarm.sqf", [], 6, false, true, "", "lifeState _target == ""UNCONSCIOUS"""];
};
} forEach playableUnits;
BM_fn_disarm = {
_unit = _this;
{_unit action ["dropWeapon", _unit, _x] } forEach (weapons _unit);
{_unit action ["DropMagazine", _unit, _x] } forEach (magazines _unit);
};
"BM_Disarmed" addPublicVariableEventHandler {
_unit = _this select 1;
_unit call BM_fn_disarm;
BM_Disarmed = "";
};
};
if (isServer) then {
"BM_Disarmed" addPublicVariableEventHandler {
_unit = _this select 1;
_owner = owner _unit;
_owner publicVariableClient "BM_Disarmed";
BM_Disarmed = "";
};
};
};
if (_isSurrenderEnabled && !isDedicated) then {
player addAction ["Surrender", "Custom\BM_surrender.sqf", [], 3, false, true];
};
Code: Select all
private ["_unit"];
_unit = _this select 0;
if (local _unit) then {
{_unit action ["dropWeapon", _unit, _x] } forEach (weapons _unit);
{_unit action ["DropMagazine", _unit, _x] } forEach (magazines _unit);
} else {
if (isServer) then {
_owner = owner _unit;
BM_Disarmed = _unit;
_owner publicVariableClient "BM_Disarmed";
BM_Disarmed = "";
} else {
BM_Disarmed = _unit;
publicVariableServer "BM_Disarmed";
BM_Disarmed = "";
};
};
Code: Select all
{player action ["dropWeapon", player, _x] } forEach (weapons player);
{player action ["DropMagazine", player, _x] } forEach (magazines player);
player playmove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
Code: Select all
[true, true] execVM "Custom\BM_disarmInit.sqf";