Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scriptName "Functions\misc\fn_selfActions.sqf";
- /***********************************************************
- ADD ACTIONS FOR SELF
- - Function
- - [] call fnc_usec_selfActions;
- ************************************************************/
- _vehicle = vehicle player;
- _inVehicle = (_vehicle != player);
- _cursorTarget = cursorTarget;
- _primaryWeapon = primaryWeapon player;
- _currentWeapon = currentWeapon player;
- _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
- _nearLight = nearestObject [player,"LitObject"];
- _canPickLight = false;
- if (!isNull _nearLight) then {
- if (_nearLight distance player < 4) then {
- _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
- };
- };
- _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
- // -------------------------------------- Deploy Bike --------------------------------------
- _weapons = [currentWeapon player] + (weapons player) + (magazines player);
- _isBike = typeOf cursorTarget in ["Old_bike_TK_INS_EP1","Old_bike_TK_CIV_EP1"];
- // -------------------------------------- Deploy Bike --------------------------------------
- _weapons = [currentWeapon player] + (weapons player) + (magazines player);
- _isBike = typeOf cursorTarget in ["Old_bike_TK_INS_EP1","Old_bike_TK_CIV_EP1"];
- // -------------------------------------- BIKE DEPLOY --------------------------------------
- if ("ItemToolbox" in _weapons) then {
- hasBikeItem = true;
- } else { hasBikeItem = false;};
- if((speed player <= 1) && hasBikeItem && _canDo) then {
- if (s_player_deploybike < 0) then {
- s_player_deploybike = player addaction[("<t color=""#b4b700"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
- };
- } else {
- player removeAction s_player_deploybike;
- s_player_deploybike = -1;
- };
- // -------------------------------------- PACK BIKE --------------------------------------
- if((_isBike) and _canDo) then {
- if (s_player_deploybike2 < 0) then {
- s_player_deploybike2 = player addaction[("<t color=""#b4b700"">" + ("Re-Pack Bike") +"</t>"),"deploys\bike\pack.sqf","",5,false,true,"", ""];
- };
- } else {
- player removeAction s_player_deploybike2;
- s_player_deploybike2 = -1;
- };
- // -------------------------------------- PACK BIKE --------------------------------------
- // Krixes Self Bloodbag
- if ("ItemBloodbag" in _mags) then {
- hasBagItem = true;
- } else { hasBagItem = false;};
- if((speed player <= 1) && hasBagItem && _canDo) then {
- if (s_player_selfBloodbag < 0) then {
- s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"Scripts\player_selfbloodbag.sqf","",5,false,true,"", ""];
- };
- } else {
- player removeAction s_player_selfBloodbag;
- s_player_selfBloodbag = -1;
- };
- //Grab Flare
- if (_canPickLight and !dayz_hasLight) then {
- if (s_player_grabflare < 0) then {
- _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
- s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
- s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
- };
- } else {
- player removeAction s_player_grabflare;
- player removeAction s_player_removeflare;
- s_player_grabflare = -1;
- s_player_removeflare = -1;
- };
- if (dayz_onBack != "" && !dayz_onBackActive && !_inVehicle && !_onLadder && !r_player_unconscious) then {
- if (s_player_equip_carry < 0) then {
- _text = getText (configFile >> "CfgWeapons" >> dayz_onBack >> "displayName");
- s_player_equip_carry = player addAction [format[localize "STR_ACTIONS_WEAPON", _text], "\z\addons\dayz_code\actions\player_switchWeapon.sqf", "action", 0.5, false, true];
- };
- } else {
- player removeAction s_player_equip_carry;
- s_player_equip_carry = -1;
- };
- //fishing
- if ((_currentWeapon in Dayz_fishingItems) && !dayz_fishingInprogress && !_inVehicle && !dayz_isSwimming) then {
- if (s_player_fishing < 0) then {
- s_player_fishing = player addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",player, 0.5, false, true];
- };
- } else {
- player removeAction s_player_fishing;
- s_player_fishing = -1;
- };
- if ((_primaryWeapon in Dayz_fishingItems) && !dayz_fishingInprogress && (_inVehicle and (driver _vehicle != player))) then {
- if (s_player_fishing_veh < 0) then {
- s_player_fishing_veh = _vehicle addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",_vehicle, 0.5, false, true];
- };
- } else {
- _vehicle removeAction s_player_fishing_veh;
- s_player_fishing_veh = -1;
- };
- if (!isNull _cursorTarget and !_inVehicle and (player distance _cursorTarget < 4)) then { //Has some kind of target
- _isVehicle = _cursorTarget isKindOf "AllVehicles";
- _isMan = _cursorTarget isKindOf "Man";
- _isAnimal = _cursorTarget isKindOf "Animal";
- _isZombie = _cursorTarget isKindOf "zZombie_base";
- _isDestructable = _cursorTarget isKindOf "BuiltItems";
- _isTent = _cursorTarget isKindOf "TentStorage";
- _isStash = _cursorTarget isKindOf "StashSmall";
- _isMediumStash = _cursorTarget isKindOf "StashMedium";
- _isHarvested = _cursorTarget getVariable["meatHarvested",false];
- _ownerID = _cursorTarget getVariable ["characterID","0"];
- _isVehicletype = typeOf _cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
- _isFuel = false;
- _hasFuel20 = "ItemJerrycan" in magazines player;
- _hasFuel5 = "ItemFuelcan" in magazines player;
- _hasFuelE20 = "ItemJerrycanEmpty" in magazines player;
- _hasFuelE5 = "ItemFuelcanEmpty" in magazines player;
- _hasKnife = "ItemKnife" in items player;
- _hasToolbox = "ItemToolbox" in items player;
- _hasbottleitem = "ItemWaterbottle" in magazines player;
- _isAlive = alive _cursorTarget;
- _canmove = canmove _cursorTarget;
- _text = getText (configFile >> "CfgVehicles" >> typeOf _cursorTarget >> "displayName");
- _isPlant = typeOf _cursorTarget in Dayz_plants;
- if (_hasFuelE20 or _hasFuelE5) then {
- _isFuel = (_cursorTarget isKindOf "Land_Ind_TankSmall") or (_cursorTarget isKindOf "Land_fuel_tank_big") or (_cursorTarget isKindOf "Land_fuel_tank_stairs") or (_cursorTarget isKindOf "Land_wagon_tanker");
- };
- //gather
- if(_isPlant and _canDo) then {
- if (s_player_gather < 0) then {
- _text = getText (configFile >> "CfgVehicles" >> typeOf _cursorTarget >> "displayName");
- s_player_gather = player addAction [format[localize "str_actions_gather",_text], "\z\addons\dayz_code\actions\player_gather.sqf",_cursorTarget, 1, true, true, "", ""];
- };
- } else {
- player removeAction s_player_gather;
- s_player_gather = -1;
- };
- //Allow player to delete objects
- if(_isDestructable and _hasToolbox and _canDo) then {
- if (s_player_deleteBuild < 0) then {
- s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
- };
- } else {
- player removeAction s_player_deleteBuild;
- s_player_deleteBuild = -1;
- };
- //Allow player to force save
- if((_isVehicle or _isTent or _isStash or _isMediumStash) and _canDo and !_isMan and (damage _cursorTarget < 1)) then {
- if (s_player_forceSave < 0) then {
- s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
- };
- } else {
- player removeAction s_player_forceSave;
- s_player_forceSave = -1;
- };
- //flip vehicle
- if ((_isVehicletype) and !_canmove and _isAlive and (player distance _cursorTarget >= 2) and (count (crew _cursorTarget))== 0 and ((vectorUp _cursorTarget) select 2) < 0.5) then {
- if (s_player_flipveh < 0) then {
- s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
- };
- } else {
- player removeAction s_player_flipveh;
- s_player_flipveh = -1;
- };
- //Allow player to fill Fuel can
- if((_hasFuelE20 or _hasFuelE5) and _isFuel and !_isZombie and !_isAnimal and !_isMan and _canDo and !a_player_jerryfilling) then {
- if (s_player_fillfuel < 0) then {
- s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
- };
- } else {
- player removeAction s_player_fillfuel;
- s_player_fillfuel = -1;
- };
- //Allow player to fill vehicle 20L
- if(_hasFuel20 and _canDo and !_isZombie and !_isAnimal and !_isMan and _isVehicle and (fuel _cursorTarget < 1) and (damage _cursorTarget < 1)) then {
- if (s_player_fillfuel20 < 0) then {
- s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10",_text,"20"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan"], 0, true, true, "", "'ItemJerrycan' in magazines player"];
- };
- } else {
- player removeAction s_player_fillfuel20;
- s_player_fillfuel20 = -1;
- };
- //Allow player to fill vehicle 5L
- if(_hasFuel5 and _canDo and !_isZombie and !_isAnimal and !_isMan and _isVehicle and (fuel _cursorTarget < 1)) then {
- if (s_player_fillfuel5 < 0) then {
- s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10",_text,"5"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan"], 0, true, true, "", "'ItemFuelcan' in magazines player"];
- };
- } else {
- player removeAction s_player_fillfuel5;
- s_player_fillfuel5 = -1;
- };
- //Allow player to spihon vehicles
- if ((_hasFuelE20 or _hasFuelE5) and !_isZombie and !_isAnimal and !_isMan and _isVehicle and _canDo and !a_player_jerryfilling and (fuel _cursorTarget > 0) and (damage _cursorTarget < 1)) then {
- if (s_player_siphonfuel < 0) then {
- s_player_siphonfuel = player addAction [format[localize "str_siphon_start"], "\z\addons\dayz_code\actions\siphonFuel.sqf",_cursorTarget, 0, true, true, "", ""];
- };
- } else {
- player removeAction s_player_siphonfuel;
- s_player_siphonfuel = -1;
- };
- //Hostage menu
- if ((player getVariable"humanity") >= 5000) then {
- if(_isMan && !_isZombie && _canDo && _isAlive) then {
- if (s_player_arrest < 0) then {
- s_player_arrest = player addaction ['<t color="#0074E8">' + "Hostage Menu" + '</t>', "Scripts\Investigation\investigation.sqf","",100,false,true,"", ""];
- };
- } else {
- player removeAction s_player_arrest;
- s_player_arrest = -1;
- };
- };
- //Harvested
- if (!alive _cursorTarget and _isAnimal and _hasKnife and !_isHarvested and _canDo) then {
- if (s_player_butcher < 0) then {
- s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
- };
- } else {
- player removeAction s_player_butcher;
- s_player_butcher = -1;
- };
- //Fireplace Actions check
- if (inflamed _cursorTarget and _canDo) then {
- /*
- {
- if (_x in magazines player) then {
- _hastinitem = true;
- };
- } forEach boil_tin_cans;
- _rawmeat = meatraw;
- _hasRawMeat = false;
- {
- if (_x in magazines player) then {
- _hasRawMeat = true;
- };
- } forEach _rawmeat;
- */
- _hasRawMeat = {_x in meatraw} count magazines player > 0;
- _hastinitem = {_x in boil_tin_cans} count magazines player > 0;
- //Cook Meat
- if (_hasRawMeat and !a_player_cooking) then {
- if (s_player_cook < 0) then {
- s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
- };
- };
- //Boil Water
- if (_hastinitem and _hasbottleitem and !a_player_boil) then {
- if (s_player_boil < 0) then {
- s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
- };
- };
- } else {
- if (a_player_cooking) then {
- player removeAction s_player_cook;
- s_player_cook = -1;
- };
- if (a_player_boil) then {
- player removeAction s_player_boil;
- s_player_boil = -1;
- };
- };
- if(_cursorTarget == dayz_hasFire and _canDo) then {
- if ((s_player_fireout < 0) and !(inflamed _cursorTarget) and (player distance _cursorTarget < 3)) then {
- s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
- };
- } else {
- player removeAction s_player_fireout;
- s_player_fireout = -1;
- };
- //Burn Tent
- if(_isTent and _hasMatches and _canDo and !_isMan) then {
- if (s_player_igniteTent < 0) then {
- s_player_igniteTent = player addAction [format["Ignite Tent"], "scripts\tent_ignite.sqf",cursorTarget, 1, true, true, "", ""];
- };
- } else {
- player removeAction s_player_igniteTent;
- s_player_igniteTent = -1;
- };
- //Packing my tent
- if(_cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
- if ((s_player_packtent < 0) and (player distance _cursorTarget < 3)) then {
- s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
- };
- } else {
- player removeAction s_player_packtent;
- s_player_packtent = -1;
- };
- //Sleep
- if(_cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
- if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
- s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
- };
- } else {
- player removeAction s_player_sleep;
- s_player_sleep = -1;
- };
- _clothesTaken = cursorTarget getVariable["clothesTaken",false];
- //take clothes
- if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
- if (s_player_clothes < 0) then {
- s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\player_takeClothes.sqf",cursorTarget, -10, false, true, "",""];
- };
- } else {
- player removeAction s_player_clothes;
- s_player_clothes = -1;
- };
- //Salvage
- if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
- _vehicle = cursorTarget;
- _invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor");
- if( !_invalidVehicle ) then {
- {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
- s_player_removeActions = [];
- silver_myCursorTarget = _vehicle;
- _hitpoints = _vehicle call vehicle_getHitpoints;
- {
- _damage = [_vehicle,_x] call object_getHit;
- if( _damage < 0.25 ) then {
- _cmpt = toArray (_x);
- _cmpt set [0,20];
- _cmpt set [1,toArray ("-") select 0];
- _cmpt set [2,20];
- _cmpt = toString _cmpt;
- _skip = true;
- if( _skip and _x == "HitFuel" ) then { _skip = false; _part = "PartFueltank"; _cmpt = _cmpt + "tank"};
- if( _skip and _x == "HitEngine" ) then { _skip = false; _part = "PartEngine"; };
- if( _skip and _x == "HitLFWheel" ) then { _skip = false; _part = "PartWheel"; };
- if( _skip and _x == "HitRFWheel" ) then { _skip = false; _part = "PartWheel"; };
- if( _skip and _x == "HitLBWheel" ) then { _skip = false; _part = "PartWheel"; };
- if( _skip and _x == "HitRBWheel" ) then { _skip = false; _part = "PartWheel"; };
- if( _skip and _x == "HitGlass1" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitGlass2" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitGlass3" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitGlass4" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitGlass5" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitGlass6" ) then { _skip = false; _part = "PartGlass"; };
- if( _skip and _x == "HitHRotor" ) then { _skip = false; _part = "PartVRotor"; };
- if (!_skip ) then {
- _string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color];
- _handle = silver_myCursorTarget addAction [_string, "scripts\Salvage\ss_remove.sqf",[_vehicle,_part,_x], 0, true, true, "",""];
- s_player_removeActions set [count s_player_removeActions,_handle];
- };
- };
- } forEach _hitpoints;
- };
- };
- //Repairing Vehicles
- if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
- if (s_player_repair_crtl < 0) then {
- dayz_myCursorTarget = _cursorTarget;
- _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
- //_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
- s_player_repairActions set [count s_player_repairActions,_menu];
- //s_player_repairActions set [count s_player_repairActions,_menu1];
- s_player_repair_crtl = 1;
- } else {
- {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
- s_player_repair_crtl = -1;
- };
- };
- //Gut human
- if (!_isAlive and !_isZombie and !_isAnimal and !_isHarvested and _isMan and _hasKnife and _canDo) then {
- if (s_player_butcher_human < 0) then {
- s_player_butcher_human = player addAction [format["<t color='#42426F'>Gut Human%1</t>"], "Cannibalism\gather_meat_human.sqf",cursorTarget, 3, true, true, "", ""];
- };
- } else {
- player removeAction s_player_butcher_human;
- s_player_butcher_human = -1;
- };
- if (_isMan and !_isAlive and !_isZombie and !_isAnimal) then {
- if (s_player_studybody < 0) then {
- s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
- };
- } else {
- player removeAction s_player_studybody;
- s_player_studybody = -1;
- };
- } else {
- //Engineering
- {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
- silver_myCursorTarget = objNull;
- {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
- player removeAction s_player_repair_crtl;
- s_player_repair_crtl = -1;
- dayz_myCursorTarget = objNull;
- //Others
- player removeAction s_player_arrest;
- s_player_arrest = -1;
- player removeAction s_player_release;
- s_player_release = -1;
- player removeAction s_player_escort;
- s_player_escort = -1;
- player removeAction s_player_search;
- s_player_search = -1;
- player removeAction s_player_forceSave;
- s_player_forceSave = -1;
- player removeAction s_player_flipveh;
- s_player_flipveh = -1;
- player removeAction s_player_butcher_human;
- s_player_butcher_human = -1;
- player removeAction s_player_sleep;
- s_player_sleep = -1;
- player removeAction s_player_deleteBuild;
- s_player_deleteBuild = -1;
- player removeAction s_player_butcher;
- s_player_butcher = -1;
- player removeAction s_player_cook;
- s_player_cook = -1;
- player removeAction s_player_boil;
- s_player_boil = -1;
- player removeAction s_player_fireout;
- s_player_fireout = -1;
- player removeAction s_player_packtent;
- s_player_packtent = -1;
- player removeAction s_player_igniteTent;
- s_player_igniteTent = -1;
- player removeAction s_player_fillfuel;
- s_player_fillfuel = -1;
- player removeAction s_player_studybody;
- s_player_studybody = -1;
- //fuel
- player removeAction s_player_fillfuel20;
- s_player_fillfuel20 = -1;
- player removeAction s_player_fillfuel5;
- s_player_fillfuel5 = -1;
- player removeAction s_player_clothes;
- s_player_clothes = -1;
- //Allow player to siphon vehicle fuel
- player removeAction s_player_siphonfuel;
- s_player_siphonfuel = -1;
- //Allow player to gather
- player removeAction s_player_gather;
- s_player_gather = -1;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement