Jump to content
  • 0

Need help adding medical variables to script...


DangerRuss

Question

So I was looking through old scripts I have laying around and I decided to toss the good old "gut human" script on my server for fun. 

I was looking at the code and I saw the part about cutting yourself on the knife and it makes you lose blood and shake like you're in pain. I would like to add infection to that as well.. so if the player cuts himself, he will be in pain and infected and lose blood.

 if (_rnd < 0.1) then {
        r_player_inpain = true;
        r_player_infected = true;
        player setVariable["USEC_inPain",true,true];
        player setVariable["USEC_infected",true,true]; 
        r_player_blood = r_player_blood - 3000;
        cutText ["Your knife slipped and you cut your hand. You have been infected.", "PLAIN DOWN"];
    };
 
i even tried 
r_player_inpain = true;
        player setVariable["USEC_inPain",true,true];
        r_player_infected = true;
        player setVariable["USEC_infected",true,true];
 

 

but for some reason neither work. the player does lose blood however. What am I doing wrong?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

sorry for the delay I did eventually get this working although it seemed like you were ALWAYS cutting yourself which is odd. I stopped using the script because it wasn't really being used by the players.

 

 

private["_hasKnife","_qty","_item","_text","_string","_type","_loop","_meat","_timer","_infectionChance","_infectedLifeBool","_infectedLifeLost"];
_item = _this select 3;
_hasKnife =    "ItemKnife" in items player;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
 
player removeAction s_player_butcher;
s_player_butcher = -1;
 
if (_hasKnife and !_hasHarvested) then {
 
    _loop = true;
    _rnd = random 1;
    if(_rnd < 0.25)then {
        r_player_inpain = true;
        player setVariable["USEC_inPain",true,true];
        cutText ["Your knife slipped and you cut your hand.", "PLAIN DOWN"];
        if(_rnd < 0.15)then {
            r_player_infected = true;
            player setVariable["USEC_infected",true,true];
            cutText ["Your knife slipped and you cut your hand. You have been infected with AIDS.", "PLAIN DOWN"];            
        };
    };
 
 
    
 /* //Original Penalty
    if (_rnd < 0.1) then {
        r_player_inpain = true;
        r_player_infected = true;
        player setVariable["USEC_inPain",true,true];
        player setVariable["USEC_infected",true,true]; 
        r_player_blood = r_player_blood - 3000;
        cutText ["Your knife slipped and you cut your hand. You have been infected with AIDS.", "PLAIN DOWN"];
    };
 */
 
    _qty = (random 3);
 
    _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
 
    dayzHumanity = [player,-500];
    _id = dayzHumanity spawn player_humanityChange;
 
    _array = [_item,_qty];
    _meat = "FoodSteakRaw";
 
        for "_x" from 1 to _qty do {
                _item addMagazine "FoodSteakRaw";
                _result = [player,_meat] call BIS_fnc_invAdd;
                if (_result) then {
 
                } else {
                    cutText ["You don't have enough room in your inventory to carry the human meat.", "PLAIN DOWN"];
                    _x = _qty;
                }
 
        };
 
    sleep 8;
    cutText ["You have gutted another person... your hands are covered with their blood...what have you become?", "PLAIN DOWN"];
    };
};
 
 
Now Im curious about making someone hungry and thirsty.. On a different script I am trying to make a person hungry/thirsty if they use the item. I can't see to get it to work. Im going to make a separate thread about it but I figured I'd ask here first.
if (random(_Chance) < 1) then {
         
            dayz_lastDrink = time;
            dayz_thirst = 1;
 
            dayz_lastMeal = time;
            dayz_hunger = 1;
            
            player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
            
            //Ensure Control is visible
            _display = uiNamespace getVariable 'DAYZ_GUI_display';
            (_display displayCtrl 1301) ctrlShow true;
          } else {
Edited by DangerRuss
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...