Ibragim A 148 Posted October 9, 2021 Literally the script works like this: Each enemy unit receives a suppression event handler. If the enemy flees and get a certain value of suppression, he drops his weapon and surrenders. Then player can approach the surrendered enemy and take him as a captive using the hold menu. PC_script_captive_system = { params ["_units",["_fleeing_coef", 0.5],["_suppression_coef", 0.8]]; { _x allowFleeing _fleeing_coef; _x addEventHandler ["Suppressed", { params ["_unit", "_distance", "_shooter", "_instigator", "_ammoObject", "_ammoClassName", "_ammoConfig"]; if (!(fleeing _unit) || !(isNull objectParent _unit)) exitWith {}; if (getSuppression _unit < _suppression_coef) exitWith {}; /// Get down and surrender: 0 = [_unit] spawn { params ["_unit"]; [_unit] joinSilent grpNull; _unit setCaptive true; _unit setCombatBehaviour "CARELESS"; _unit setUnitCombatMode "BLUE"; _unit setUnitPos "MIDDLE"; waitUntil { (animationState _unit find "amovpknlmstps" != -1) && (((weaponState _unit) select 6) isEqualTo 0); }; if (currentWeapon _unit != "") then { switch (currentWeapon _unit) do { case (primaryWeapon _unit): { _wh_primary = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_primary, primaryWeapon _unit]; sleep 0.7; }; case (secondaryWeapon _unit): { _wh_secondary = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_secondary, secondaryWeapon _unit]; sleep 0.7; }; case (handgunWeapon _unit): { _wh_handgun = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_handgun, handgunWeapon _unit]; sleep 0.7; }; }; }; if (primaryWeapon _unit != "") then { _wh_primary = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_primary, primaryWeapon _unit]; }; if (secondaryWeapon _unit != "") then { _wh_secondary = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_secondary, secondaryWeapon _unit]; }; if (handgunWeapon _unit != "") then { _wh_handgun = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropWeapon", _wh_handgun, handgunWeapon _unit]; }; { if (([_x] call BIS_fnc_itemType select 1) == "Grenade") then { sleep 0.2; _wh_grenade = "GroundWeaponHolder_Scripted" createVehicle position _unit; _unit action ["DropMagazine", _wh_grenade, _x]; }; } forEach itemsWithMagazines _unit; sleep 1.0; _unit playMoveNow "AmovPpneMstpSnonWnonDnon"; _unit setUnitPos "DOWN"; waitUntil { (animationState _unit find "amovppnemstp" != -1) }; _unit playMoveNow "AmovPpneMstpSnonWnonDnon"; sleep 0.5; _unit switchMove "ApanPpneMstpSnonWnonDnon"; sleep 0.5; _unit playMoveNow selectRandom ["ApanPpneMstpSnonWnonDnon_G01","ApanPpneMstpSnonWnonDnon_G02","ApanPpneMstpSnonWnonDnon_G03"]; /// add EH: [ _unit, "Take captive", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", "(player distance2D _target < 2) && (cursorTarget isEqualTo _target)", "(player distance2D _target < 2) && (cursorTarget isEqualTo _target)", { _caller playAction "gestureFollow"; }, {}, { params ["_target", "_caller", "_actionId", "_arguments"]; _captives = missionNamespace getVariable ["PC_captives", []]; missionNamespace setVariable ["PC_captives", _captives + [_target], true]; [_target] spawn { params ["_target"]; //_target setCaptive false; _target allowFleeing 0.4; _target setCombatBehaviour "CARELESS"; _target disableAI "AUTOTARGET"; _target disableAI "FSM"; _target disableAI "CHECKVISIBLE"; [_target] joinSilent group player; _target setUnitPos "AUTO"; _target playMoveNow "AmovPpneMstpSnonWnonDnon_AmovPknlMstpSnonWnonDnon"; waitUntil { animationState _target isEqualTo "apanpercmstpsnonwnondnon"; }; sleep 0.25; _target switchMove selectRandom ["ApanPercMstpSnonWnonDnon_G01","ApanPercMstpSnonWnonDnon_G02","ApanPercMstpSnonWnonDnon_G03"]; //_target switchMove "amovpercmstpsnonwnondnon"; _target doFollow player; _anim_speed = getAnimSpeedCoef _target; _target setAnimSpeedCoef _anim_speed * 0.75; _target playAction "GestureAgonyCargo"; }; }, {}, [], 0.9, nil, true, false ] call BIS_fnc_holdActionAdd; }; }]; } forEach _units; }; _units = (allUnits select {side _x in [WEST, EAST]}); _allowFleeing = 1; _suppress_coef = 0.8; [_units, _allowFleeing, _suppress_coef] spawn PC_script_captive_system; Array (missionNamespace getVariable ["PC_captives", []]) returns everyone captured by the player. 4 2 Share this post Link to post Share on other sites
johnnyboy 3741 Posted October 9, 2021 I like it! Good work dude!👍 Share this post Link to post Share on other sites
Ibragim A 148 Posted October 10, 2021 The panic animation is very moody. It is easy to apply, but difficult to disable. I'm sure there are animation gurus here who could look at the script and change the animations in it to smoother ones. Share this post Link to post Share on other sites