mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-25 01:20:49 +03:00
1.0.2.4 RC1
This commit is contained in:
141
SQF/dayz_code/actions/player_buildingDowngrade.sqf
Normal file
141
SQF/dayz_code/actions/player_buildingDowngrade.sqf
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
DayZ Base Building Upgrades
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_distance","_needText","_findNearestPoles","_findNearestPole","_IsNearPlot","_i","_invResult","_itemOut","_countOut"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Downgrade already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
player removeAction s_player_downgrade_build;
|
||||
s_player_downgrade_build = 1;
|
||||
|
||||
_distance = 30;
|
||||
_needText = "Plot Pole";
|
||||
|
||||
// check for near plot
|
||||
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
|
||||
_findNearestPole = [];
|
||||
|
||||
{
|
||||
if (alive _x) then {
|
||||
_findNearestPole set [(count _findNearestPole),_x];
|
||||
};
|
||||
} foreach _findNearestPoles;
|
||||
|
||||
_IsNearPlot = count (_findNearestPole);
|
||||
|
||||
if(_IsNearPlot == 0) then {
|
||||
_canBuildOnPlot = true;
|
||||
} else {
|
||||
|
||||
// check nearby plots ownership and then for friend status
|
||||
_nearestPole = _findNearestPole select 0;
|
||||
|
||||
// Find owner
|
||||
_ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
|
||||
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
|
||||
|
||||
// check if friendly to owner
|
||||
if(dayz_characterID == _ownerID) then {
|
||||
_canBuildOnPlot = true;
|
||||
} else {
|
||||
_friendlies = player getVariable ["friendlyTo",[]];
|
||||
// check if friendly to owner
|
||||
if(_ownerID in _friendlies) then {
|
||||
_canBuildOnPlot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// exit if not allowed due to plot pole
|
||||
if(!_canBuildOnPlot) exitWith { TradeInprogress = false; cutText [format["Unable to downgrade %1 nearby.",_needText,_distance] , "PLAIN DOWN"]; };
|
||||
|
||||
// get cursortarget from addaction
|
||||
_obj = _this select 3;
|
||||
|
||||
// Current charID
|
||||
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
||||
|
||||
if(!DZE_Lock_Door == _objectCharacterID) exitWith { TradeInprogress = false; cutText ["Unable to downgrade you do not know the combination." , "PLAIN DOWN"]; };
|
||||
|
||||
// Find objectID
|
||||
_objectID = _obj getVariable ["ObjectID","0"];
|
||||
|
||||
// Find objectUID
|
||||
_objectUID = _obj getVariable ["ObjectUID","0"];
|
||||
|
||||
if(_objectID == "0" && _objectUID == "0") exitWith {TradeInprogress = false; s_player_upgrade_build = -1; cutText ["Not setup yet.", "PLAIN DOWN"];};
|
||||
|
||||
// Get classname
|
||||
_classname = typeOf _obj;
|
||||
|
||||
// Find display name
|
||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||
|
||||
// Find next upgrade
|
||||
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "downgradeBuilding");
|
||||
|
||||
if ((count _upgrade) > 0) then {
|
||||
|
||||
_newclassname = _upgrade select 0;
|
||||
|
||||
_refund = _upgrade select 1;
|
||||
|
||||
player playActionNow "Medic";
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_invResult = false;
|
||||
_i = 0;
|
||||
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
_invResult = [player,_itemOut] call BIS_fnc_invAdd;
|
||||
if(_invResult) then {
|
||||
_i = _i + 1;
|
||||
};
|
||||
};
|
||||
|
||||
} forEach _refund;
|
||||
|
||||
// all parts removed proceed
|
||||
if(_i != 0) then {
|
||||
|
||||
// Get position
|
||||
_location = _obj getVariable["OEMPos",(getposATL _obj)];
|
||||
|
||||
// Get direction
|
||||
_dir = getDir _obj;
|
||||
|
||||
_classname = _newclassname;
|
||||
|
||||
// Create new object
|
||||
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Set direction
|
||||
_object setDir _dir;
|
||||
|
||||
// Set location
|
||||
_object setPosATL _location;
|
||||
|
||||
cutText [format["You have downgraded %1.",_text], "PLAIN DOWN", 5];
|
||||
|
||||
dayzSwapObj = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,_objectID,_objectUID];
|
||||
publicVariableServer "dayzSwapObj";
|
||||
|
||||
player reveal _object;
|
||||
|
||||
} else {
|
||||
cutText [format["\n\n%1 of %2 could not be added to your inventory. (not enough room?)", _i,_itemOut], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
cutText ["No downgrades available", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
TradeInprogress = false;
|
||||
s_player_downgrade_build = -1;
|
||||
@@ -49,6 +49,9 @@ _proceed = true;
|
||||
|
||||
if (_proceed) then {
|
||||
|
||||
player playActionNow "Medic";
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_temp_removed_array = [];
|
||||
_removed_total = 0;
|
||||
_tobe_removed_total = 0;
|
||||
|
||||
@@ -105,8 +105,7 @@ if (count(_findNearestTree) >= 1) then {
|
||||
|
||||
_item = createVehicle ["WeaponHolder", getPosATL player, [], 1, "CAN_COLLIDE"];
|
||||
_item addMagazineCargoGlobal [_itemOut,_countOut];
|
||||
_item modelToWorld getPosATL player;
|
||||
_item setdir (getDir player);
|
||||
|
||||
player reveal _item;
|
||||
|
||||
// chop down tree
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Usage: spawn player_harvestPlant;
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_isOk","_i","_objName","_objInfo","_lenInfo","_started","_finished","_animState","_isMedic","_proceed","_counter","_itemOut","_countOut","_tree","_distance2d","_distance3d","_trees","_findNearestTree"];
|
||||
private ["_isOk","_i","_objName","_started","_finished","_animState","_isMedic","_proceed","_itemOut","_countOut","_tree","_trees","_findNearestTree","_index","_invResult","_treesOutput"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["\n\nHarvest already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
@@ -112,8 +112,7 @@ if (count(_findNearestRock) >= 1) then {
|
||||
|
||||
_item = createVehicle ["WeaponHolder", getPosATL player, [], 1, "CAN_COLLIDE"];
|
||||
_item addMagazineCargoGlobal [_itemOut,_countOut];
|
||||
_item modelToWorld getPosATL player;
|
||||
_item setdir (getDir player);
|
||||
|
||||
player reveal _item;
|
||||
|
||||
/* break rock
|
||||
|
||||
@@ -96,6 +96,9 @@ if ((count _upgrade) > 0) then {
|
||||
} forEach _requirements;
|
||||
|
||||
if (_proceed) then {
|
||||
|
||||
player playActionNow "Medic";
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_temp_removed_array = [];
|
||||
_removed_total = 0;
|
||||
|
||||
@@ -1,33 +1,26 @@
|
||||
private ["_target","_ent","_rnd","_move","_isZombie"];
|
||||
_target = _this select 3;
|
||||
_ent = _target;
|
||||
private ["_ent","_rnd","_move","_isZombie"];
|
||||
|
||||
// remove menu
|
||||
player removeAction s_player_pzombiesattack;
|
||||
s_player_pzombiesattack = 1;
|
||||
if (!isNull cursorTarget) then {
|
||||
|
||||
_rnd = (round(random 9)) + 1;
|
||||
_move = "ZombieStandingAttack" + str(_rnd);
|
||||
player playMoveNow _move;
|
||||
_ent = cursorTarget;
|
||||
_rnd = (round(random 9)) + 1;
|
||||
_move = "ZombieStandingAttack" + str(_rnd);
|
||||
player playMoveNow _move;
|
||||
_isZombie = _ent isKindOf "zZombie_base";
|
||||
|
||||
_isZombie = _ent isKindOf "zZombie_base";
|
||||
if(player distance _ent < 5) then {
|
||||
|
||||
if(player distance _target < 5) then {
|
||||
if (_ent isKindOf "Animal" or _isZombie) then {
|
||||
_ent setDamage 1;
|
||||
} else {
|
||||
//["usecBreakLegs",[_target,player]] call broadcastRpcCallAll;
|
||||
usecBreakLegs = [_ent,player];
|
||||
publicVariable "usecBreakLegs";
|
||||
};
|
||||
|
||||
[player,"hit",0,false] call dayz_zombieSpeak;
|
||||
|
||||
if (_ent isKindOf "Animal" or _isZombie) then {
|
||||
_ent setDamage 1;
|
||||
} else {
|
||||
//["usecBreakLegs",[_target,player]] call broadcastRpcCallAll;
|
||||
usecBreakLegs = [_target,player];
|
||||
publicVariable "usecBreakLegs";
|
||||
};
|
||||
|
||||
[player,"hit",0,false] call dayz_zombieSpeak;
|
||||
|
||||
};
|
||||
|
||||
sleep 1;
|
||||
|
||||
player switchmove "";
|
||||
|
||||
s_player_pzombiesattack = -1;
|
||||
sleep 1;
|
||||
player switchmove "";
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
delete object from db with extra waiting by [VB]AWOL
|
||||
parameters: _obj
|
||||
*/
|
||||
private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund"];
|
||||
private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Remove already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
@@ -181,18 +181,26 @@ if (_proceed) then {
|
||||
cutText ["No parts found.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
_ipos = getPosATL player;
|
||||
|
||||
if (_ipos select 2 < 2) then {
|
||||
_ipos = [_ipos select 0,_ipos select 1,0];
|
||||
};
|
||||
|
||||
_radius = 1;
|
||||
|
||||
// give refund items
|
||||
if((count _selectedRemoveOutput) > 0 and !_preventRefund) then {
|
||||
// Put itemsg
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
{
|
||||
_itemOut = _x select 0;
|
||||
_countOut = _x select 1;
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
if (typeName _countOut == "ARRAY") then {
|
||||
_countOut = round((random (_countOut select 1)) + (_countOut select 0));
|
||||
};
|
||||
|
||||
_item addMagazineCargoGlobal [_itemOut,_countOut];
|
||||
} forEach _selectedRemoveOutput;
|
||||
cutText ["De-constructed parts are now in your inventory.", "PLAIN DOWN"];
|
||||
player reveal _item;
|
||||
};
|
||||
} else {
|
||||
cutText ["Failed object not longer exists.", "PLAIN DOWN"];
|
||||
|
||||
Reference in New Issue
Block a user