Jump to content
  • 0

[WIP] Body armor script - Needing help!


Reaper5150

Question

I'm currently working on a body armor script based off right click functions with Ceramic plates. I'm having a bit of an issue getting it to work though cause of the variables for increasing the players blood.

Here is the bit I have in variables.sqf but can't figure out where to put it? 

_pb = player getVariable["pb",0];
    if (isNil "_pb") then {
        _pb = 0;
    };
    _bloodCap = 12000;
    if (_pb== 1) then {
        _bloodCap = 13500;
    };
    r_player_blood = _bloodCap;
    r_player_bloodTotal = r_player_blood;
};

 

The script i have so far: Will be released when I can get it working! :)

 

private ["_humanity","_humanity2","_item","_inVehicle","_countplayers","_hasitems","P_hasarmor"];

_humanity = player getVariable["humanity", 5000];
_humanity2 = player getVariable["humanity", -5000];
_item = ["ItemCeramicParts"];
_hasitems = [_item] call player_checkItems;
_inVehicle = (_vehicle = player);
_countplayers = count nearestObjects [player, ["CAManBase"], 1];


    // Check if player is in skin with armor plate carrier
    
    while {true} do {
    if (_humanity >= 2500) exitWith {
    cutText [format["You need 5000 humanity to do that!"], "PLAIN DOWN"]; 
    };
    
    if (_humanity2 <= -2500) exitWith {
    cutText [format["You need -5000 humanity to do that!"], "PLAIN DOWN"]; 
    };

    // Let's check if they are in a vehicle
    
    if (_inVehicle) exitWith {
    cutText [format["You can't put on armor in a vehicle!"], "PLAIN DOWN"]; 
    };
    
    // No players should be around them
    
    if (_countplayers > 1) exitWith {
    cutText [format["You are too close to another player!"], "PLAIN DOWN"];
    };

    // Remove item from the gear
    
    if (call {_hasitems}) then {
    player removeMagazine "ItemCeramicParts";
    sleep 2;
    player playActionNow "PutDown";
    };
    
   // Player has armor on - Let others know
   P_hasarmor = "Sign_sphere10cm_EP1" createVehicle position player;
   P_hasarmor attachto [player,[0, 0.10, 0] "RightHandMiddle1"];

   // Let's change blood value and act as armor
   _pb = player getVariable["pb",0];
   r_player_bloodTotal = 12000;
   if (_pb == 1) then {
   r_player_bloodTotal = 13500;
   };

   // Adds nice text
   [format["<t size='1.2' color='#960000'size='0.9'>You have put on Body Armor</t>"],0,0,4,1] spawn BIS_fnc_dynamicText; 

   
   // Has player died - Then remove marker
   if (r_player_bloodTotal = 0) then { 
        deleteVehicle P_hasarmor;    
    };

 

I will give credit for those who want to help out here? Thanks 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I would look at "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; around like 181 and below I believe is where it's calculating damage, just something like if (player has armor) { damage = damage/2); or something like that, you could even make different types of armor and have percentages of resistance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...