Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- Stealthstick's "Explosive-To-Vehicle" Script adapted by second_coming and DarthRogue to
- Allow players to attach their explosive charges to any vehicle or lockable Epoch door.
- Modified for Exile by READTHESCROLL & Darth_Rogue
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- Copy script and paste in your editor of choice. Save as ExileEtV.sqf
- Place script in your mission file in a folder called "addons".
- Paste this at the VERY BOTTOM of init.sqf. Merge with existing and move to bottom of init.sqf if you already have a
- if (!isDedicated and hasInterface) then block.
- if (!isDedicated and hasInterface) then {
- // waitUntil Client Is Actually Loaded In Game
- waitUntil {!isNil "ExileClientLoadedIn"};
- [] execVM "addons\ExileEtV.sqf";
- // waitUntil ExileEtVInitialized is populated by ExileEtV.sqf
- waitUntil {!isNil "ExileEtVInitialized"};
- [player] call EtV_actions;
- };
- */
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- EtV_ChargeCheck =
- {
- _charge = _this select 0;
- _unit = _this select 1;
- _hasIt = _charge in (magazines _unit);
- _nearVehs = nearestObjects [_unit,["Air","Ship","LandVehicle","Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static"],5];
- _return = (_hasIt && count _nearVehs > 0 && alive _unit && !ExilePlayerInSafezone);
- _return
- };
- EtV_TouchOff =
- {
- _array = _this select 3;
- _unit = _array select 0;
- _explosives = _unit getVariable ["charges",[]];
- SZ_Markers = [
- "TraderCityMarker",
- "TraderZoneSilderas",
- "TraderZoneFolia"
- ];
- SZ_Radius = 300;
- if(alive _x && !ExilePlayerInSafezone) then { //Checks if player is not in safe zone
- if ({_explosives distance getMarkerPos _x < SZ_Radius} count SZ_Markers > 0) then { //Checks if demo charge is in sz marker
- deleteVehicle _explosives; //Deletes explosive if it is in sz
- call ExileClient_gui_safezone_fired; //Hint message
- }
- else //Demo charge is not in safe zone & player is not in safe zone. Proceed...
- {
- _nearVehicle = (nearestObjects [_x,["Air","Ship","LandVehicle","Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static","Exile_Construction_WoodDoor_Reinforced_Static","Exile_Construction_WoodGate_Reinforced_Static"],5]) select 0;
- "HelicopterExploSmall" createVehicle (position _x);
- deleteVehicle _x;
- _existingDamage = damage _nearVehicle;
- if ((typeOf _nearVehicle) in ["Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static"]) then //Wooden Gates/Doors
- {
- _nearVehicle setDamage _existingDamage + 0.10;
- };
- if ((typeOf _nearVehicle) in ["Air","Ship","LandVehicle"]) then //Vehicles
- {
- _nearVehicle setDamage _existingDamage + 1;
- };
- if ((typeOf _nearVehicle) in ["Exile_Construction_WoodDoor_Reinforced_Static","Exile_Construction_WoodGate_Reinforced_Static"]) then //Reinforced Gates/Doors
- {
- _nearVehicle setDamage _existingDamage + 0.05;
- };
- _destroyed = damage _nearvehicle > 0.99;
- if ((typeOf _nearVehicle) in ["Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static","Exile_Construction_WoodDoor_Reinforced_Static","Exile_Construction_WoodGate_Reinforced_Static"] == (_destroyed)) then //if (_destroyed) then
- {
- _nearVehicle call ExileServer_object_construction_database_delete;
- }
- else
- {
- _nearVehicle call ExileServer_object_vehicle_remove;
- };
- };
- };
- } forEach _explosives;
- _unit setVariable ["charges",[]];
- };
- EtV_UnitCheck =
- {
- private "_return";
- _unit = _this select 0;
- _explosives = _unit getVariable ["charges",[]];
- if(count _explosives > 0) then
- {
- _return = true;
- }
- else
- {
- _return = false;
- };
- _return
- };
- EtV_TimedCharge =
- {
- _explosive = _this select 0;
- _unit = _this select 1;
- //_illogic = group server createUnit ["logic", Position _explosive, [], 0, "FORM"];
- _grp = createGroup sidelogic;
- _illogic = _grp createUnit ["logic", Position _explosive, [], 0, "FORM"];
- [_illogic] join _grp;
- _illogic attachTo [_explosive];
- while {alive _explosive} do
- {
- waitUntil {!isNil {_illogic getVariable "timer"};};
- if(_illogic getVariable "timer" == 0) exitWith
- {
- _charges = _unit getVariable ["charges",[]];
- _unit setVariable ["charges",_charges - [_explosive]];
- "HelicopterExploSmall" createVehicle (position _explosive);
- deleteVehicle _explosive;
- };
- sleep 1;
- _oldTime = _illogic getVariable "timer";
- _illogic setVariable ["timer",_oldTime - 1];
- };
- };
- EtV_AttachCharge =
- {
- _array = _this select 3;
- _charge = _array select 0;
- _unit = _array select 1;
- private "_class";
- _unit removeMagazine _charge;
- _unit playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
- switch _charge do
- {
- case "DemoCharge_Remote_Mag":
- {
- _class = "DemoCharge_Remote_Ammo";
- };
- };
- _nearVehicle = (nearestObjects [_unit,["Air","Ship","LandVehicle","Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static"],5]) select 0;
- _explosive = _class createVehicle [0,0,0];
- _explosive attachTo [_unit,[0,0,0],"leftHand"];
- _random0 = random 180;
- _random1 = random 180;
- [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank;
- [_explosive,_nearVehicle,_unit,_random0,_random1] spawn
- {
- _explosive = _this select 0;
- _nearVehicle = _this select 1;
- _unit = _this select 2;
- _random0 = _this select 3;
- _random1 = _this select 4;
- sleep 1.5;
- if ((typeOf _nearVehicle) in ["Exile_Construction_WoodGate_Static","Exile_Construction_WoodDoor_Static"]) then
- {
- _explosive attachTo [_nearVehicle, [0,0,0.6]];
- }
- else
- {
- _explosive attachTo [_nearVehicle, [0,0,0.2]];
- };
- [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank;
- _unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]];
- //[_explosive,_unit] spawn EtV_TimedCharge;
- };
- };
- EtV_ClosestExplosive =
- {
- _unit = _this select 0;
- _charges = _unit getVariable ["charges",[]];
- _newArray = [];
- {_newArray = _newArray + [player distance _x];} forEach _charges;
- _closest = _newArray call BIS_fnc_lowestNum;
- _selection = _newArray find _closest;
- _charge = _charges select _selection;
- _charge
- };
- EtV_Timer =
- {
- private "_explosive";
- _array = _this select 3;
- _unit = _array select 0;
- _explosive = [_unit] call EtV_ClosestExplosive;
- _illogic = (nearestObjects [_explosive,["Logic"],50]) select 0;
- if(!isNil "_illogic") then
- {
- _oldTime = _illogic getVariable ["timer",0];
- _illogic setVariable ["timer",_oldTime + 30];
- _newTime = _illogic getVariable "timer";
- hint format ["Explosive timer set to %1 seconds.",_newTime];
- };
- };
- EtV_UnitCheckTimer =
- {
- private "_return";
- _unit = _this select 0;
- _explosives = _unit getVariable ["charges",[]];
- _return = false;
- {if(_unit distance _x <= 5) exitWith {_return = true;};} forEach _explosives;
- _return
- };
- //[unit] spawn EtV_Actions;
- EtV_Actions =
- {
- private ["_unit"];
- _unit = _this select 0;
- _unit addAction ["<t color=""#FFE496"">" +"Attach Explosives", EtV_AttachCharge, ["DemoCharge_Remote_Mag",_unit], 1, true, true, "","['DemoCharge_Remote_Mag',_target] call EtV_ChargeCheck"];
- _unit addAction ["<t color=""#CC3300"">" +"Set-Off Explosives", EtV_TouchOff, [_unit], 1, true, true, "","[_target] call EtV_UnitCheck"];
- //_unit addAction ["<t color=""#CC3300"">" +"Set Timer for 30 Sec", EtV_Timer, [_unit], 1, true, true, "","[_target] call EtV_UnitCheckTimer"];
- };
- //=======================
- //[player] call EtV_Actions;
- ExileEtVInitialized = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement