Search the Community
Showing results for tags 'captive'.
Found 2 results
-
A simple script that makes player able to capture fleeing enemies
Ibragim A posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
So basically trying to make a mission where team sneaks into the area and meets up with a local asset. The asset is simply there to deliver a local "civilian" truck for them to use to travel safely into city undercover. Basically what I was thinking was in the init of the vic, putting something like: "foreach unit set captive true;" however realized that probably wouldn't work because then they are liable to be set captive rest of mission. So basically looking for something that sets captive state true while units are in the vic but once they disembark the vic captive state switches back to false, with a like a two second buffer before the switch happens. Any help would be great as my search wasn't very fruitful.
- 4 replies
-
- setcaptive
- captive
-
(and 1 more)
Tagged with: