Jump to content
  • 0

Suicide Script Help - Add Humanity to the Script


xtr3m3

Question

Hello everyone,

 

i have a question. How can i add minus or plus humanity to the suicide script.

 

I am using the suicide script from the Custom Action Menu ->

 

I tried it with this code:

if (_humanity > 1) then {
dayzHumanity = [player,-1000];
_id = dayzHumanity spawn player_humanityChange;
};

The Code itself works, but the problem is, that the new Humanity dont save after the player logs in after suicide. The Player has the old Humanity like before the suicide.

My Scripting skills are very low, but i dont know what to do with _id or player_humanityChange;

 

Full Suicide Script:

private ["_Secondary"];
_Secondary = currentWeapon player;
_humanity = player getVariable "humanity";
_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);

    
suicide_answer=nil;
if(_canDo) then {
    DamiSpawn =
    [
        ["Suicide Confirmation",true],
        ["Are you sure?", [-1], "", -5, [["expression", ""]], "1", "0"],
        ["", [-1], "", -5,         [["expression", ""]], "1", "0"],
        ["No", [2], "", -5,     [["expression", "suicide_answer=false;"]], "1", "1"],
        ["Yes", [3], "", -5,     [["expression", "suicide_answer=true;"]], "1", "1"],
        ["", [-1], "", -5,         [["expression", ""]], "1", "0"],
        ["Exit", [-1], "", -3,     [["expression", "suicide_answer=false;"]], "1", "1"]
    ];
    showCommandingMenu "#USER:DamiSpawn";
    waitUntil {((!isNil 'suicide_answer')||(commandingMenu == ""))};
    if (isNil 'suicide_answer') then {suicide_answer=false;};
    

    
    if (suicide_answer) then
    {
    
    if (_humanity > 1)  then {
dayzHumanity = [player,-1000];
_id = dayzHumanity spawn player_humanityChange;
};
if (_humanity < -1) then {
dayzHumanity = [player,+1000];
_id = dayzHumanity spawn player_humanityChange;
};

        cutText["Really? Suicide? Be a Man and Run!","PLAIN DOWN"];
        player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
        sleep 8.4;
        player fire _Secondary;
        _selection = "body";
        player setHit["body",1];
        
    };
} else {
    cutText ["You are already performing an action","PLAIN DOWN"];
};

Thx for help!

 

greets

xtr3m3

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...