Jump to content

Custom Suicide script 5/1/14


Recommended Posts

This is a simple suicide script that adds right click to the pisoals to execute the suicide.

 

How is this different?

  •  Add scream before death no extra sound file need. You can add your own sound or sounds in the script
  • Over kills the player so die if they have a SD weapon
  • Fixed it so the pistol sound is shot not the primary 
  • Easy custom config to change the sound and message
This script is still not done so please let me know what is not working.

 

Installation guide

 

skip this if you are running epoch

Not running epoch well you have to add this to the self actions at the bottom.

// ---------------------------------------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>"),"custom\suicide.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    player removeAction s_player_suicide;
    s_player_suicide = -1;
};
 
// ---------------------------------------SUICIDE END------------------------------------ 
 

 

Step one

Install right click addon/script and add this to it

Thanks to @Turtle and @FriendlyPA

class ExtraRc {
    class glock17_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };
    class M9 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class M9SD {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class Makarov {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };
    class revolver_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class UZI_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class Sa61_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class Colt1911 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };		
    class UZI_SD_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };
    class revolver_gold_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };	
    class MakarovSD {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""custom\suicide.sqf"";";
        };
    };
}; 

 

Step 2

The script

Place this script in custom folder and name it suicide.sqf

private ["_Secondary","_SMessage","_sound","_dis];
//###########################################################################################################
//#################################ASIAN KID suicide script#################################################
//###########################################################################################################
////////////CONFIG////////////
/*
0 is to set false
1 is to set true
*/
sound = 1;         //Enable if you want a message to show before the player dies
messages = 1;     //Enable if you want a message to show before the player dies
////////////////////////EXTRA////////////////////////////////////////////
customsound = 0; //If you want to use your own sound
_customsoundname = "scream"; //Must define it in the description.ext
/////////////////////////////////////////////////////////////////////////
_dis = 50;      //Distance heard by the souund
_SMessage = format["My name is %1 and I hope there is better place",format["%1", name player]];  //suicide message
//###########################################################################################################
///////////////////////////////
////////////Starting////////////
///////////////////////////////
canAbort = true; //stops people from aborting
player addEventHandler ["fired", {if (alive player) then { player SetDamage 1.1;};}];
sleep 1;
///////////////////////////////
////////////Message////////////
///////////////////////////////
if (messages == 1) then {
cutText [format[_SMessage], "PLAIN DOWN"];
};
///////////////////////////////
////////////Actions////////////
///////////////////////////////
player playmove "PlayerStand";
sleep 1.5;
player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
sleep 8.4;
///////////////////////////////
/////Scream before death///////
///////////////////////////////
if (sound == 1) then {
if (customsound == 1) then {
_sound = [_customsoundname] call bis_fnc_selectRandom;
}else{
_sound = ["z_scream_3","z_scream_"] call bis_fnc_selectRandom;
};
_nul = [nil, player, rSAY, [_sound,_dis]] call RE;
sleep 0.5;
};
///////////////////////////////
///////Player shoots///////////
///////////////////////////////
canAbort = false;
player fire _Secondary;
sleep 0.2;
///////////////////////////////
///////Over kills them/////////
///////////////////////////////
r_player_blood = r_player_blood - 13000;
player setVariable["USEC_BloodQty",r_player_blood,true];
_unit = player;
_selection = "body"; 
_damage = 1;
_unit setHit[_selection,_damage];
//###########################################################################################################
//###########################################END OF SUICDE#############################################################
//########################################################################################################### 
 

 

Report any errors and enjoy

Link to comment
Share on other sites

awesome!

Im guessing if I wanted to put in a if statement to check to see if legs are broken or blood is below say 5000 it would just have to wrap this in an if? and declare a variable to whatever player broken legs and low blood are? (new to this arma coding, so would have to look for what that is)

///////////////////////////////
////////////Actions////////////
///////////////////////////////
player playmove "AidlPpneMstpSnonWnonDnon_SleepA_standUp"
sleep 1.5;
player playmove "ActsPercMstpSnonWpstDnon_suicide1B";
sleep 8.4;
Link to comment
Share on other sites

I can't test now, but i believe the player will play the stand up animetion even if he is already standing:

player playmove "AidlPpneMstpSnonWnonDnon_SleepA_standUp"
sleep 1.5;

Don't?

 

I will release my script, tonight, when i got home. Sorry for the delay, i wish it could have helped you.

Link to comment
Share on other sites

You can kill the player with:

player setDamage 1.0;
You can make player fire (may have systax error):
player secondaryWeapon "fire";
And you can schedule player death for when he fires (may have systax error):
player addEventHandler ["fired",{player setDamage 1.0;}];
player secondaryWeapon "fire"; //will shot and launch the event scheduled above {player set Damage 1.0;}
The shot that comes from the secondary weapon do not hurt the player, what kill hin is the comand "player setDamage 1.;0".

I just need to check the syntax for the last 2 codes. I'm not at home and can't do it now.

Asian Kid, by the way, and sorry to ask, who is that person in your Avatar? He have "Xavier" in its name? Thankyou.

Link to comment
Share on other sites

///////////////////////////////
///////Over kills them/////////
///////////////////////////////
r_player_blood = r_player_blood - 13000;
player setVariable["USEC_BloodQty",r_player_blood,true];
_unit = player;
_selection = "body"; 
_damage = 1.0;
_unit setHit[_selection,_damage];
//###########################################################################################################
//###########################################END OF SUICDE#############################################################
//########################################################################################################### 
 
For me it says that the damage is 1.0 and it still doesnt kill the player
Link to comment
Share on other sites

(...)

In other cases, it is very much in the way and you can accidentally press.

Great appointment. I have one player in my server that have choosen it accidentaly while we was playing. I also did that.

I will require double selection. Hope to finish today.

Link to comment
Share on other sites

  • 2 weeks later...

Hey, only want give a hint if anybody else have it,

"z_scream_" is not declared for me, which cause that everytime a player commit suicide this anoying "sound z_scream_ not found" message is appear for everyone.

if anybody else have this problem,

make it look like this "_sound = ["z_scream_3"] call bis_fnc_selectRandom;"

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