Converted script for Epoch. Before testing

This commit is contained in:
Zepheris 2020-02-23 18:51:30 -07:00
parent 3d88c195e0
commit a65fbddc73
4 changed files with 215 additions and 223 deletions

View File

@ -1,197 +1,156 @@
/* /*
DragBody script by BangaBob (H8erMaker) v1.2 DragBody script by BangaBob (H8erMaker) v1.2
http://www.armaholic.com/page.php?id=26578
Description
Drag dead bodies out of sight to avoid detection. JIP/MP/SP/Dedicated compatible Modified by Zepheris to work with A3 Epoch's Dyna Menu System
Instructions
Add this line into the init.sqf. This will add a drag action to all editor placed units.
null = allUnits execVM "H8_dragBody.sqf";
Functions
[UNIT1,UNIT2,UNIT3] spawn H8_addDrag;
Add living units into the script. (Useful for units spawned mid-mission).
*/ */
#define H8_DRAGTEXT "Drag Body" // AddAction text for drag body
#define H8_DROPTEXT "Release Body" // AddAction text for dropping body
#define H8_LOADTEXT "Load Body" // AddAction text for dropping body
#define H8_UNLOTEXT "Unload Body" // AddAction text for dropping body
H8_fnc_Action = {
_dragCond = "vehicle _this != vehicle _target and isNull attachedTo _target and count attachedObjects _this == 0 and _target distance _this < 3";
{
_x addaction [H8_DRAGTEXT,{call H8_DragAction},nil,6,false,false,"",_dragCond];
}forEach _this;
};
H8_DragAction = {
_unit = (_this select 0);
// GLOBAL CODE
_unitID = _unit getVariable "H8_increm";
[[_unit, vehicle player,_unitID],"H8_fnc_attach",true] call BIS_fnc_MP;
_unit attachTo [player,[0,1,0]];
// CLIENT SIDE
player playAction "grabDrag";
player forceWalk true;
_dropID= player addAction [H8_DROPTEXT,{call H8_dropAction},_unit,6];
_hideID =player addAction [H8_LOADTEXT,{call H8_putIncar},_unit,6,false,false,"","_target distance _this < 8 and cursorTarget isKindOf ""LandVehicle"""];
player setVariable ["H8hideVeh",_hideID];
player setVariable ["H8dropact",_dropID];
};
H8_putIncar = {
_hideID = (_this select 2);
_dropID = player getVariable "H8dropact";
_unit = (_this select 3);
_vehicle = cursorTarget;
_loadedBody =_vehicle getVariable "H8loadedBody";
if (isNil "_loadedBody") then {
// CLIENT CODE
player playMove "amovpknlmstpsraswrfldnon";
player forceWalk false;
player removeAction _hideID;
player removeAction _dropID;
// GLOBAL CODE
_unitID = _unit getVariable "H8_increm";
0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP;
sleep 1;
deTach _unit;
_unit setPos [0,0,0];
_vehicle setVariable ["H8loadedBody",_unit,true];
[[_vehicle],"H8_carAction",true] call BIS_fnc_MP;
}else{
hint "Vehicle already has a body loaded";
};
};
H8_carAction = {
_vehicle = (_this select 0);
_vehicle addAction [H8_UNLOTEXT,{call H8_removeBody},nil,0,false,false,"","_this distance _target < 8"];
};
H8_carRemoveAction = {
_vehicle = (_this select 0);
_id = (_this select 1);
_vehicle removeAction _id;
};
H8_removeBody = {
_vehicle = (_this select 0);
_player = (_this select 1);
_id = (_this select 2);
[[_vehicle,_id],"H8_carRemoveAction",true] call BIS_fnc_MP;
_unit = _vehicle getVariable "H8loadedBody";
_vehicle setVariable ["H8loadedBody",Nil];
_pos = _player modelToWorld [1,0,0];
_unit setPos _pos;
_unit switchMove "AinjPpneMstpSnonWrflDb_release";
};
H8_dropAction = {
_dropID = (_this select 2);
_hideID = player getVariable "H8hideVeh";
_unit = (_this select 3);
// GLOBAL CODE
_unitID = _unit getVariable "H8_increm";
0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP;
deTach _unit;
// CLIENT SIDE
player removeAction _hideID;
player removeAction _dropID;
player playMove "amovpknlmstpsraswrfldnon";
player forceWalk false;
};
H8_fnc_attach = {
_unit = (_this select 0);
_player = (_this select 1);
_unitID = (_this select 2);
_id = format ["h8EF%1",_unitID];
0 = [_id, "onEachFrame", "H8_fnc_moveBody",[_unit,_player]] call BIS_fnc_addStackedEventHandler;
};
H8_fnc_detach = {
_unit = (_this select 0);
_player = (_this select 1);
_unitID = (_this select 2);
_id = format ["h8EF%1",_unitID];
0 = [_id, "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
sleep 0.05;
_relD = [_unit,_player] call BIS_fnc_dirTo;
_unit switchMove "AinjPpneMstpSnonWrflDb_release";
_unit setDir _relD;
};
H8_fnc_moveBody = {
_unit = (_this select 0);
_player = (_this select 1);
// CREDIT TOO Das Attorney FOR CODE
_pos = _player modelToWorld [0,1,0];
_unit setPos _pos;
_unit setDir 180;
_unit switchMove "AinjPpneMrunSnonWnonDb";
};
H8_addDrag = { H8_DragAction = {
{ _unit = (_this select 0);
H8_increments = H8_increments + 1; _epochID = (_this select 1);
_x setVariable ["H8_increm",H8_increments,true];
H8_dragUnitArray set [count H8_dragUnitArray, _x]; //[[_unit, vehicle player,_unitID],"H8_fnc_attach",true] call BIS_fnc_MP;
}forEach _this; [_unit, vehicle player, _epochID] remoteExec ["H8_fnc_attach", 2, false];
_unit attachTo [player,[0,1,0]];
[_this,"H8_fnc_Action",TRUE] call BIS_fnc_MP;
player playAction "grabDrag";
publicVariable "H8_increments"; player forceWalk true;
publicVariable "H8_dragUnitArray"; };
};
H8_fnc_attach = {
_unit = (_this select 0);
_player = (_this select 1);
_unitID = (_this select 2);
_id = format ["h8EF%1",_unitID];
0 = [_id, "onEachFrame", "H8_fnc_moveBody",[_unit,_player]] call BIS_fnc_addStackedEventHandler;
};
H8_fnc_moveBody = {
_unit = (_this select 0);
_player = (_this select 1);
// CREDIT TOO Das Attorney FOR CODE
_pos = _player modelToWorld [0,1,0];
_unit setPos _pos;
_unit setDir 180;
_unit switchMove "AinjPpneMrunSnonWnonDb";
};
H8_dropAction = {
_dropID = (_this select 0);
_epochID = (_this select 1);
// GLOBAL CODE
//0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP;
[_unit, vehicle player, _epochID] remoteExec ["H8_fnc_detach",2,false];
detach _unit;
// CLIENT SIDE
player playMove "amovpknlmstpsraswrfldnon";
player forceWalk false;
};
H8_fnc_detach = {
_unit = (_this select 0);
_player = (_this select 1);
_unitID = (_this select 2);
_id = format ["h8EF%1",_unitID];
0 = [_id, "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
sleep 0.05;
_relD = [_unit,_player] call BIS_fnc_dirTo;
_unit switchMove "AinjPpneMstpSnonWrflDb_release";
_unit setDir _relD;
};
/*
H8_putIncar = {
_hideID = (_this select 2);
_dropID = player getVariable "H8dropact";
_unit = (_this select 3);
_vehicle = cursorTarget;
_loadedBody =_vehicle getVariable "H8loadedBody";
if (isNil "_loadedBody") then {
// CLIENT CODE
player playMove "amovpknlmstpsraswrfldnon";
player forceWalk false;
player removeAction _hideID;
player removeAction _dropID;
// GLOBAL CODE
_unitID = _unit getVariable "H8_increm";
0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP;
sleep 1;
deTach _unit;
_unit setPos [0,0,0];
_vehicle setVariable ["H8loadedBody",_unit,true];
[[_vehicle],"H8_carAction",true] call BIS_fnc_MP;
}else{
hint "Vehicle already has a body loaded";
};
};
H8_carAction = {
_vehicle = (_this select 0);
_vehicle addAction [H8_UNLOTEXT,{call H8_removeBody},nil,0,false,false,"","_this distance _target < 8"];
};
H8_carRemoveAction = {
_vehicle = (_this select 0);
_id = (_this select 1);
_vehicle removeAction _id;
};
H8_removeBody = {
_vehicle = (_this select 0);
_player = (_this select 1);
_id = (_this select 2);
[[_vehicle,_id],"H8_carRemoveAction",true] call BIS_fnc_MP;
_unit = _vehicle getVariable "H8loadedBody";
_vehicle setVariable ["H8loadedBody",Nil];
_pos = _player modelToWorld [1,0,0];
_unit setPos _pos;
_unit switchMove "AinjPpneMstpSnonWrflDb_release";
};
H8_addDrag = {
{
H8_increments = H8_increments + 1;
_x setVariable ["H8_increm",H8_increments,true];
H8_dragUnitArray set [count H8_dragUnitArray, _x];
}forEach _this;
[_this,"H8_fnc_Action",TRUE] call BIS_fnc_MP;
publicVariable "H8_increments";
publicVariable "H8_dragUnitArray";
};
if (isServer) then { if (isServer) then {
if (isNil ("H8_dragUnitArray")) then { if (isNil ("H8_dragUnitArray")) then {
H8_dragUnitArray = []; H8_dragUnitArray = [];
H8_increments = 0;}; H8_increments = 0;};
{
{ H8_increments = H8_increments + 1;
H8_increments = H8_increments + 1; _x setVariable ["H8_increm",H8_increments,true];
_x setVariable ["H8_increm",H8_increments,true]; H8_dragUnitArray set [count H8_dragUnitArray, _x];
H8_dragUnitArray set [count H8_dragUnitArray, _x]; }forEach _this;
}forEach _this; publicVariable "H8_increments";
publicVariable "H8_dragUnitArray";
publicVariable "H8_increments"; };
publicVariable "H8_dragUnitArray";
};
if (!isServer && (player != player)) then { waitUntil {player == player}; waitUntil {time > 15};}; if (!isServer && (player != player)) then { waitUntil {player == player}; waitUntil {time > 15};};
if (!isDedicated) then { if (!isDedicated) then {
0 = H8_dragUnitArray spawn H8_fnc_Action; 0 = H8_dragUnitArray spawn H8_fnc_Action;
}; };
/*

View File

@ -24,7 +24,28 @@ class flip_vic
}; };
*/ */
//end added by Zepheris //end added by Zepheris
class drag_Stuff
{
condition = "true";
action = "";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\epoch_bluekey.paa";
tooltip= "Drag Test";
class drag_body
{
condition = "true";
action = "[dyna_cursorTarget,Epoch_personalToken] call H8_dragAction;";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\epoch_brownkey.paa";
tooltip = "Grab Test";
};
class drop_body
{
condition = "true";
action = "[dyna_cursorTarget,Epoch_personalToken] call H8_dropAction;";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\epoch_coralkey.paa";
tooltip = "Release Test";
};
};
class build_upgrade class build_upgrade
{ {
condition = "dyna_buildMode select 0"; condition = "dyna_buildMode select 0";

View File

@ -26,26 +26,26 @@ class CfgRemoteExec
{ {
mode = 1; mode = 1;
jip = 0; jip = 0;
class EPOCH_server_spawnLoot class EPOCH_server_spawnLoot
{ {
allowedTargets=2; allowedTargets=2;
jip = 0; jip = 0;
}; };
class EPOCH_server_PaintVehicle class EPOCH_server_PaintVehicle
{ {
allowedTargets=2; allowedTargets=2;
jip = 0; jip = 0;
}; };
class EPOCH_server_PutCrypto class EPOCH_server_PutCrypto
{ {
allowedTargets=2; allowedTargets=2;
jip = 0; jip = 0;
}; };
class EPOCH_server_SetFinalPlayerPos class EPOCH_server_SetFinalPlayerPos
{ {
allowedTargets=2; allowedTargets=2;
jip = 0; jip = 0;
}; };
class bis_fnc_reviveinitaddplayer class bis_fnc_reviveinitaddplayer
{ {
allowedTargets = 2; allowedTargets = 2;
@ -321,51 +321,61 @@ class CfgRemoteExec
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_upgrade_vehicle class EPOCH_server_upgrade_vehicle
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_fnc_updatePlayerStats class EPOCH_fnc_updatePlayerStats
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_client_updatePlayerStat class EPOCH_client_updatePlayerStat
{ {
allowedTargets = 1; allowedTargets = 1;
jip = 0; jip = 0;
}; };
class EPOCH_server_createTempGroup class EPOCH_server_createTempGroup
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_invitePlayerTempGroup class EPOCH_server_invitePlayerTempGroup
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_updatePlayerTempGroup class EPOCH_server_updatePlayerTempGroup
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_deleteTempGroup class EPOCH_server_deleteTempGroup
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_upgradeTempGroup class EPOCH_server_upgradeTempGroup
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class EPOCH_server_DefuseBomb class EPOCH_server_DefuseBomb
{ {
allowedTargets = 2; allowedTargets = 2;
jip = 0; jip = 0;
}; };
class H8_fnc_attach
{
allowedTargets = 0;
jip = 0;
};
class H8_fnc_detach
{
allowedTargets = 0;
jip = 0;
};
}; };
class Commands class Commands
{ {

View File

@ -30,3 +30,5 @@ call compile preprocessFileLineNumbers (TCL_Path+"TCL_Preprocess.sqf");
// 7. B_Heli_Transport_01_F = Transport helicopter for the mission system // 7. B_Heli_Transport_01_F = Transport helicopter for the mission system
EPOCH_spawnLimits = [0, 1, 0, 0, 1, 0, 1]; EPOCH_spawnLimits = [0, 1, 0, 0, 1, 0, 1];
execVM "addons\drag_body\H8_dragBody.sqf";