I am new to server customization and understanding what scripting is. I found it fairly difficult to get some things working on my server and this suicide script was one of them. So i will try to lay out a very accessible walk through.
For this you will want PBO Manager, or cPBO but i am not familiar with that program. A lot of tutorials will tell you that you will want to unpack and repack your PBO's but i find this method doesnt corrupt the PBO.
The first thing you will want to do is to make a 'custom' fn_selfActions.sqf .
To do this navigate to where your server is installed. we will call it DayZserver. There you will see a folder near the top titled @Epoch. Open this and inside open the Addons folder.
Scroll down a little bit until you see the PBO called dayz_code when you double click it should open automatically with PBO Manager, if it doesnt right click it, say open with and select PBO manager.
in the dayz_code open compile and scroll down until you see fn_selfActions.sqf, right click and extract to a safe place. I like to use a folder on my desktop.
open the extracted fn_selfActions.sqf with notepad++, scroll to the bottom and place this bit of 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------------------------------------
make sure there is a space between the ; and the start of the script so the top will look like this and save
Copy this newly edited and saved file. Travel to MPMissions\Dayz_Epoch_11.Chernarus (for example) and paste inside. This will sometimes be referred to as the Missions PBO or root folder or something of the same ilk.
Next, go back into the dayz_code with PBO Manager open init and extract the compiles.sqf, you can deposit this into the root folder.
Open the newly deposited compiles.sqf with notepad++ and find the line
Lastly you will want to open notepad++ go to file new. In this new file paste the following code
//Suicide script by Grafzahl edited by axeman to allow coming back from the brink.
//File name: suicide.sqf
private ["_Secondary","_lostHope","_plEH","_actSuicide"];
_Secondary = currentWeapon player;
_plEH = player addEventHandler ["fired", "player SetDamage 1.1"];
_lostHope = time;
r_interrupt = false;
cutText [format["You think about your family... 10 Seconds"], "PLAIN DOWN"];
sleep 2;
player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
_actSuicide = 1;
while {alive player}do{
if(r_interrupt)exitWith{
player playMoveNow "AmovPercMstpSlowWrflDnon_AmovPsitMstpSlowWrflDnon";
cutText [format["She wouldn't have wanted it to end this way.."], "PLAIN DOWN"];
while{true}do{
if(!((animationState player) in ["AmovPercMstpSlowWrflDnon_AmovPsitMstpSlowWrflDnon"]) && (alive player))exitWith{player removeEventHandler["fired", _plEH];sleep 1;player switchmove "";sleep 1;PVDZE_plr_Save = [player,[],true,true];publicVariableServer "PVDZE_plr_Save";};
};
};
if(time - _lostHope > 2 && _actSuicide < 2)then{
cutText [format["Your little daughter, and what happened to her... 6 Seconds"], "PLAIN DOWN"];
_actSuicide = 2;
};
if(time - _lostHope > 6 && _actSuicide < 3)then{
cutText [format["You cant take this shit any longer... 2 Seconds"], "PLAIN DOWN"];
_actSuicide = 3;
};
if(time - _lostHope > 7 && _actSuicide <4)then{
cutText [format["I come to you Sahra! Goodbye cruel world!"], "PLAIN DOWN"];
_actSuicide = 4;
};
if(time - _lostHope > 9.2 && _actSuicide > 3)exitWith{
player fire _Secondary;
};
sleep .1;
};
Go to save as, name it suicide.sqf and save it to your root folder. You should be ready to go at this point!
Thanks be to Sukkaed for showing a noob the way. Thanks be to axeman for scripting the ability to cancel suicide. And to Grafzahl for the original Headshot Suicide script.
I hope this is helpful, tis my first tutorial. Enjoy.
Question
Dactyl
I am new to server customization and understanding what scripting is. I found it fairly difficult to get some things working on my server and this suicide script was one of them. So i will try to lay out a very accessible walk through.
For this you will want PBO Manager, or cPBO but i am not familiar with that program. A lot of tutorials will tell you that you will want to unpack and repack your PBO's but i find this method doesnt corrupt the PBO.
You will also want Notepad++
---------------------------------------------------------------------------------------------------------------------------------------------------------
The first thing you will want to do is to make a 'custom' fn_selfActions.sqf .
To do this navigate to where your server is installed. we will call it DayZserver. There you will see a folder near the top titled @Epoch. Open this and inside open the Addons folder.
Scroll down a little bit until you see the PBO called dayz_code when you double click it should open automatically with PBO Manager, if it doesnt right click it, say open with and select PBO manager.
in the dayz_code open compile and scroll down until you see fn_selfActions.sqf, right click and extract to a safe place. I like to use a folder on my desktop.
open the extracted fn_selfActions.sqf with notepad++, scroll to the bottom and place this bit of code
make sure there is a space between the ; and the start of the script so the top will look like this and save
Copy this newly edited and saved file. Travel to MPMissions\Dayz_Epoch_11.Chernarus (for example) and paste inside. This will sometimes be referred to as the Missions PBO or root folder or something of the same ilk.
Next, go back into the dayz_code with PBO Manager open init and extract the compiles.sqf, you can deposit this into the root folder.
Open the newly deposited compiles.sqf with notepad++ and find the line
and change it to look like
save and exit.
Go into the init.sqf in your root folder and find the line
change it to look like
Save and exit.
Lastly you will want to open notepad++ go to file new. In this new file paste the following code
Go to save as, name it suicide.sqf and save it to your root folder. You should be ready to go at this point!
Thanks be to Sukkaed for showing a noob the way. Thanks be to axeman for scripting the ability to cancel suicide. And to Grafzahl for the original Headshot Suicide script.
I hope this is helpful, tis my first tutorial. Enjoy.
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now