[Release] Headshot Suicide

This is cool man. I was messing around with this not too long ago.

A few thoughts if I may:

Make it so that they can only suicide if 1 bullet left ( (player ammo _handGun == 1)

Using a sleep works to sync the animation and sound but can (over server time) become slower than the actual set sleep. I think you can do something like ( time > # )( or something along that line).

A very cool script. :)
 
Thanks for sharing the script, I've installed it on our Chernarus server easily enough :) also like the addition from TorturedChunk to have it as one bullet left so that should stop everyone saying "i did it by mistake can i get my gear back"

Thanks again for another great script :)
 
Oops. I did it again. Can I get my gear back?



:D
:) Heard that couple times already. I think 1 bullet option could be good way to do it and maybe still have "commit suicide" option showing with more than 1 bullet but if you click it it would say "You need to have 1 bullet in your mag to commit suicide".
 
Hey Team,

I have recently been bringing some of these scripts into the server to add a heightened macabre feel to Day Z.

Just the other day I used the suicide script as an opt out as I was infected in a building filled with Zed and was down to the last round - It was the coolest.

However, less than an hour ago I painted the inside of the hospital with my brains after accidentally triggering whilst scrolling through a gate - which was not the coolest.

Code:
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {
    hasSecondary = true;
} else {
    hasSecondary = false;
};
if (player ammo _handGun == 1) then {
    lastRound = true;
} else {
    lastRound = false;
};
if((speed player <= 1) && hasSecondary && lastRound && _canDo) then {
    if (s_player_suicide < 0) then {
        s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"suicide.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    player removeAction s_player_suicide;
    s_player_suicide = -1;
};

The commit suicide can now only be triggered if you are down to your last round - not a confirmation dialogue I know, but should stop the majority of the accidents. I hope.

Thanks to Grafzahl for breathing some increased morbidity into an already bleak platform.

Now, I just need to work out how to implement cannibalism. hmmm.
 
Grafzahl said:
Hey Guys,​
here is my little script for players who cant deal with there lifes in dayz anymore ;)
The Suicide is executed via Mouse-Wheel Option "Commit Suicide" which is only accessable if the players current weapon is a secondary-weapon with atleast 1 bullet in the magazine. Actualy there is no cancel-option, so if a player activates the self-suicide, he has 10 seconds to go to the lobby, close the game... or he is dead ;)
To use this, you have to use a custom fn_selfActions.sqf... i will not provide a tutorial here, there are enough, so here is only the code:​
Add following to your custom fn_selfActions.sqf, on the bottom of the file:​
Code:
// ---------------------------------------SUICIDE START------------------------------------
 
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {
hasSecondary = true;
} else {
hasSecondary = false;
};
if((speed player <= 1) && hasSecondary && _canDo) then {
if (s_player_suicide < 0) then {
s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"suicide.sqf",_handGun,0,false,true,"", ""];
};
} else {
player removeAction s_player_suicide;
s_player_suicide = -1;
};
 
// ---------------------------------------SUICIDE END------------------------------------


Create a file named suicide.sqf in your mission-files root-folder (not dayz_server.pbo), and paste the following code in it:​
Code:
private ["_Secondary"];
canAbort = true;
_Secondary = currentWeapon player;
player addEventHandler ["fired", {if (alive player) then { player SetDamage 1.1;};}];
cutText [format["You think about your family... 10 Seconds"], "PLAIN DOWN"];
sleep 4;
cutText [format["Your little daughter, and what happened to her... 6 Seconds"], "PLAIN DOWN"];
sleep 4;
cutText [format["You cant take this shit any longer... 2 Seconds"], "PLAIN DOWN"];
sleep 2;
cutText [format["I come to you Sahra! Goodbye cruel world!"], "PLAIN DOWN"];
canAbort = false;
player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
sleep 8.4;
player fire _Secondary;
Thats it, replace the mission-file and everything is done... if you use a anti-hack, dont forget to whitelist s_player_suicide in the dayz_actions.​

It works great, many thanks! :)
 
I can't get this to work at all.
Every time I try, I get a "suicide.sqf not found" kind of message, I can bring up the "Commit Suicide" action on the scroll wheel, but after that it tells me the .sqf is missing even though it's in my mission folder.
Any suggestions?
 
I enjoy the script. Thanks for putting it together. Here's my code for making it work with all the rh pistols from rmod 2:
Code:
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","RH_bull","RH_uspm","RH_m9","RH_m9c","RH_m93r","RH_m9sd","RH_m9csd","RH_browninghp","RH_Deagleg","RH_Deaglem","RH_Deaglemzb","RH_Deaglemz","RH_Deagles","RH_g17","RH_g17sd","RH_g18","RH_g19","RH_g19t","RH_tec9","RH_m1911sd","RH_muzi","RH_mk22","RH_mk22sd","RH_mk22v","RH_mk22vsd","RH_p38","RH_ppk","RH_mk2","RH_p226","RH_p226s","RH_tt33","RH_aps","RH_apssd","RH_pmsd","RH_mac10p","RH_pp2000p","RH_mp7p","RH_mp5kp","RH_anac","RH_pm","RH_m1911old","RH_Deagles","RH_m1911","RH_m9sd","RH_python","RH_usp","RH_uspsd","RH_anacg","RH_muzi","RH_vz61","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {

I'm going through and personally killing myself with each of those guns. Got most of them tested but I'll update if I find any errors.
 
thx for this i's working ,and i really thank grafzahl and SmokeyMeadow for sharing your code for Rmod2.1 weapons ,and thx to Frank Mcgee for the little fix !

using mod.bliss DayZ CC
 
I am trying to put this in an Origins server but the option to suicide appears only when i am looking at an object (car, person, etc) and not in general when i have 1 bullet left....i am using :

Code:
private ["_handGun"];
_handGun = currentWeapon player;
if (_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) then {
  hasSecondary = true;
} else { hasSecondary = false;};
  if((player ammo _handGun) == 1) then {
            if((speed player <= 1) && hasSecondary && _canDo) then {
                if (s_player_suicide < 0) then {
                    s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"custom_scripts\suicide.sqf","",0,false,true,"", ""];
                };
            } else {
                player removeAction s_player_suicide;
                s_player_suicide = -1;
            };
  };
 
// ---------------------------------------SUICIDE END------------------------------------
 
i cant get this to work. ive installed everything correctly to...it just wont show up when i use my scroll wheel..the only other thing i have in fn_selfactions.sqf is the vehicle strip part script. wich also uses the scroll wheel.
im using dayz.st anyone else having this problem?

here is the added script from the strip vehicle part script

Code:
// Remove Parts from Vehicles - By SilverShot.
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"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
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.15 ) then {
 
//change "HitPart" to " - Part" rather than complicated string replace
_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]; //Remove - Part
_handle = silver_myCursorTarget addAction [_string, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};
 
} forEach _hitpoints;
};
};

and here is the end
Code:
//Extras
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;
    //Engineering
    {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
    dayz_myCursorTarget = objNull;
    //Others
    player removeAction s_player_forceSave;
    s_player_forceSave = -1;
    player removeAction s_player_flipveh;
    s_player_flipveh = -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_fillfuel;
    s_player_fillfuel = -1;
    player removeAction s_player_studybody;
    s_player_studybody = -1;
    /*
    //Drag Body
    player removeAction s_player_dragbody;
    s_player_dragbody = -1;
    */
    //fuel
    player removeAction s_player_fillfuel20;
    s_player_fillfuel20 = -1;
    player removeAction s_player_fillfuel5;
    s_player_fillfuel5 = -1;
 
    //Dog
    //player removeAction s_player_tamedog;
    //s_player_tamedog = -1;
    player removeAction s_player_feeddog;
    s_player_feeddog = -1;
    player removeAction s_player_waterdog;
    s_player_waterdog = -1;
    player removeAction s_player_staydog;
    s_player_staydog = -1;
    player removeAction s_player_trackdog;
    s_player_trackdog = -1;
    player removeAction s_player_barkdog;
    s_player_barkdog = -1;
    player removeAction s_player_warndog;
    s_player_warndog = -1;
    player removeAction s_player_followdog;
    s_player_followdog = -1;
};
// ---------------------------------------SUICIDE START------------------------------------
 
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {
    hasSecondary = true;
} else {
    hasSecondary = false;
};
if((speed player <= 1) && hasSecondary && _canDo) then {
    if (s_player_suicide < 0) then {
        s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"suicide.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    player removeAction s_player_suicide;
    s_player_suicide = -1;
};
 
// ---------------------------------------SUICIDE END------------------------------------

any ideas on this? ill try to remove the vehicle strip parts tomorrow and see if that is maybe stopping it
 
i cant get this to work. ive installed everything correctly to...it just wont show up when i use my scroll wheel..the only other thing i have in fn_selfactions.sqf is the vehicle strip part script. wich also uses the scroll wheel.
im using dayz.st anyone else having this problem?

here is the added script from the strip vehicle part script

Code:
// Remove Parts from Vehicles - By SilverShot.
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"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
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.15 ) then {
 
//change "HitPart" to " - Part" rather than complicated string replace
_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]; //Remove - Part
_handle = silver_myCursorTarget addAction [_string, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};
 
} forEach _hitpoints;
};
};

and here is the end
Code:
//Extras
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;
    //Engineering
    {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
    dayz_myCursorTarget = objNull;
    //Others
    player removeAction s_player_forceSave;
    s_player_forceSave = -1;
    player removeAction s_player_flipveh;
    s_player_flipveh = -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_fillfuel;
    s_player_fillfuel = -1;
    player removeAction s_player_studybody;
    s_player_studybody = -1;
    /*
    //Drag Body
    player removeAction s_player_dragbody;
    s_player_dragbody = -1;
    */
    //fuel
    player removeAction s_player_fillfuel20;
    s_player_fillfuel20 = -1;
    player removeAction s_player_fillfuel5;
    s_player_fillfuel5 = -1;
 
    //Dog
    //player removeAction s_player_tamedog;
    //s_player_tamedog = -1;
    player removeAction s_player_feeddog;
    s_player_feeddog = -1;
    player removeAction s_player_waterdog;
    s_player_waterdog = -1;
    player removeAction s_player_staydog;
    s_player_staydog = -1;
    player removeAction s_player_trackdog;
    s_player_trackdog = -1;
    player removeAction s_player_barkdog;
    s_player_barkdog = -1;
    player removeAction s_player_warndog;
    s_player_warndog = -1;
    player removeAction s_player_followdog;
    s_player_followdog = -1;
};
// ---------------------------------------SUICIDE START------------------------------------
 
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["glock17_EP1","M9","M9SD","Makarov","MakarovSD","revolver_EP1","UZI_EP1","Sa61_EP1","Colt1911"]) && (player ammo _handGun > 0)) then {
    hasSecondary = true;
} else {
    hasSecondary = false;
};
if((speed player <= 1) && hasSecondary && _canDo) then {
    if (s_player_suicide < 0) then {
        s_player_suicide = player addaction[("<t color=""#ff0000"">" + ("Commit Suicide") +"</t>"),"suicide.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    player removeAction s_player_suicide;
    s_player_suicide = -1;
};
 
// ---------------------------------------SUICIDE END------------------------------------

any ideas on this? ill try to remove the vehicle strip parts tomorrow and see if that is maybe stopping it

i'm on hfb and recently none of my fn_selfActions have either been showing up and not working, or just not showing up. Started out of nowhere
 
ok so i tried using fn_selfactions without any other script implemented in it other than headshot suicide. still nothing.

how do i go abouts whitelisting the script in antihacks on a dayz.st private hive
 
ok so i tried using fn_selfactions without any other script implemented in it other than headshot suicide. still nothing.

how do i go abouts whitelisting the script in antihacks on a dayz.st private hive

well, if you use blurs antihack find where it lists all the dayz_actions (should be a list of s_player_blahblahblah's) then find the action in the fn_selfAction ( for suicide it is s_player_suicide, for self blood bagging it is s_player_selfBloodbag) and just add those onto the list
 
ok so adding this
player_suicide = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\s_player_suicide.sqf";
under actions didnt help anything still not showing up with scroll wheel
 
another thing. tried krixes self bloodbag.. that wont even show up...im not sure i get what is going on here. yet i can get vehicle parts strip to work
 
I'm trying to make a confirmation dialog to stop suicide if the player want.
I take a lout on an interesting part of Enhanced Water Bottle Filling script.
Code:
// Loop thru required time to fill and check for interruptions
    while {r_doLoop} do {
        if (!r_interrupt) then {
            if ((time - _startRefillTime) <= _RefillTime) then {
                player playActionNow "PutDown";
            } else {                 
                r_doLoop = false;
            };
            _RainAmt = drn_var_DynamicWeather_Rain; // Check for rain stopping
           
            if (_RainAmt < 0.025) then {
                cutText [format["The rain has stopped. Water bottle filling has been interrupted."], "PLAIN DOWN"];
                r_doLoop = false;
                r_action = false;
                _interrupted = true;
            };
        };
        // If the player is interrupted, break out of the loop and set flags to cease remainder of filling
        if (r_interrupt) then {
            cutText [format["Water bottle filling interrupted."], "PLAIN DOWN"];
            r_doLoop = false;
            r_action = false;
            _interrupted = true;
        };   
    }; // end (timed) while loop
    r_doLoop = false;

It's possible to add same system for suicide?
Is variable "r_interrupt" is provide by Dayz or Arma?
 
I have been trying to get this to work on my server all day. I am running a Taviana server, and have done everything to the t. However, the scroll wheel option does not show up at all. I have tried switching to different sidearms and have had no luck. Anyone who has been able to get this working on Taviana able to share some insight? It would be hugely appreciated!
 
Back
Top