Search the Community
Showing results for tags 'cord'.
Found 1 result
-
DETONATING CORD Hi all, This topic gave me the idea to script a little for a detonating cord. So, you can add this code in init.sqf or else. Just be sure your unit(s) created before running the code. Parameters: UNITS / PROJECTILE / SAFETY DISTANCE / CORD LENGTH MGI_fnc_detCord = { params [["_units",[],[objNull,[]]],["_thrownEnd","SmokeShellOrange"],["_safetyDist",15],["_cordLength",60]]; if (_units isEqualType objNull) then {_units = [_units]}; MGI_passToEhCord = [_thrownEnd,_safetyDist,_cordLength]; { _x addEventHandler ["firedMan", { params ["_unit", "", "", "", "", "_magazine", "_projectile"]; MGI_passToEhCord params ["_thrownEnd","_safetyDist","_cordLength"]; if (_magazine == _thrownEnd) then { [_unit,_projectile,_safetyDist,_cordLength] spawn { params ["_unit","_projectile","_safetyDist","_cordLength"]; private _veh = if (isNull objectParent _unit) then [{"B_UAV_01_F" createVehicleLocal getpos _unit},{objectParent _unit}]; if (_veh isKindOf "B_UAV_01_F") then {_veh hideObject true}; private _rope = ropeCreate [_veh,[0,0,0],_projectile,[0,0,0],_cordLength,["",[0,0,10]]]; uisleep 6; private _segs = (_veh nearObjects ["ropesegment",_cordLength]) select {_x distanceSqr _veh > _safetyDist^2}; if !(_segs isEqualTo []) then { _unit addAction ["detonate cord",{ params ["_target", "_caller", "_id", "_args","_exploEnd"]; _args params ["_rope","_veh","_segs","_projectile"]; _target removeAction _id; for "_i" from 0 to count _segs -1 do { _explo = createVehicle ["mini_grenade",getpos (_segs #_i),[],0,"CAN_COLLIDE"]; _explo hideObjectGlobal true; if (_i == count _segs -1) then {_exploEnd = _explo}; }; waitUntil {isNull _exploEnd}; if (_veh isKindOf "B_UAV_01_F") then {deleteVehicle _veh}; deleteVehicle _rope; deleteVehicle _projectile; },[_rope,_veh,_segs,_projectile],0,true,false,"","alive _target"]; }; }; }; }]; } forEach _units; }; player call MGI_fnc_detCord; // example Have fun!