[Release] Vampire's Russian Roulette

Vampire

OpenDayZ Rockstar!
Vampire's Russian Roulette
Version 1.0
What it does....
Ever found yourself a little bored on dayz? You have a group of friends and you're tired of running from zombies, and killing bambi's? Ever wanted something a little daring to do? This is the script for you.​
This script adds the ability to play Russian Roulette with your 6 shot revolver. You have a 1/6th chance of losing, shooting yourself. When you win, an audible gun dry fire is heard by nearby players. You must have a revolver and at least one round to play.​
Using this, you can gamble with your friends for loot, or other things.​
This is currently designed for Epoch, but will work fine with any Dayz mod.​
If someone wants to PM me a list of classnames of revolvers in Overwatch, I can start to work on that.​
Requirements
Basic knowledge of installing dayz mods.​
  • Easy = Blue <10

Installation Steps -

1. You must have a custom compiles.sqf and fn_selfActions. I'm not going to redo the multiple tutorials out there on how to do this. If you need help doing it, use the search function.

2. You need to add this code to your fn_selfActions.sqf. Underneath of this line:
Code:
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);

Add this code:
Code:
// ---------------------------------------RUSSIAN ROULETTE START------------------------------------
 
private ["_handGun"];
_handGun = currentWeapon player;
if ((_handGun in ["revolver_EP1","revolver_gold_EP1"]) && ("6Rnd_45ACP" in magazines player)) then {
    hasSecondary = true;
} else {
    hasSecondary = false;
};
if((speed player <= 1) && hasSecondary && _canDo) then {
    if (s_player_russianr < 0) then {
        s_player_russianr = player addaction[("<t color=""#ff0000"">" + ("Play Russian Roulette") +"</t>"),"Custom\russianr.sqf",_handGun,0,false,true,"", ""];
    };
} else {
    player removeAction s_player_russianr;
    s_player_russianr = -1;
};
 
// ---------------------------------------RUSSIAN ROULETTE END------------------------------------

3. Next you need to create a folder in your mission.pbo called Custom. Inside of that folder you need to create a file called "russianr.sqf" with this code inside of it.
Code:
//////////////////////////////////////////////////////////////////
// Russian Roulette (AKA Lets Gamble our loot!) v1.1 by Vampire //
// Many thanks to Headshot Suicide by Grafzahl on OpenDayz.net ///
// It made a great code base to start with. //////////////////////
//////////////////////////////////////////////////////////////////
private ["_Secondary"];
_Secondary = currentWeapon player;
DucksR = (floor(random 7)); // Get a random number and floor it. It will always resolve as 1-6 equally
GooseR = 3; // The goose number. Anything 1-6 would work.
 
cutText [format["You take your revolver, spin the wheel, and stick it to your temple."], "PLAIN DOWN"];
sleep 3; // suspense...
player addEventHandler ["fired", {if (alive player) then { player SetDamage 1.1;};}];
 
// If they are a goose then
if (DucksR == GooseR) then {
    canAbort = false;
    cutText [format["You pull the trigger and it happens to be your time."], "PLAIN DOWN"];
    sleep .5; // Give them time to read
    // The goose is cooked
    player fire _Secondary;
    player playmove "AdthPercMstpSrasWpstDnon_A3";
    sleep 2;
    player removeAllEventHandlers "fired";
    // No Survivors
    if (alive player) then {
        player SetDamage 1.1;
    };
} else {
    // If they are a duck, let them know
    _nul = [objNull, player, rSAY, "gunclick"] call RE;
    cutText [format["You pull the trigger and it clicks."], "PLAIN DOWN"];
    player removeAllEventHandlers "fired";
};

4. Next you need to add the gun dry fire sound to your Description.ext. The download for the sound file is here.

Place the sound file (gunclick.ogg) in the Custom folder with the russianr.sqf.

Then open your Description.ext in your Mission.pbo and find this line.
Code:
class RscLoadingText : RscText

And place this code above it.
Code:
class CfgSounds
{
    sounds[] =
    {
    gunclick
    };
    class gunclick
    {
    name="gunclick";
    sound[]={Custom\gunclick.ogg,0.7,1};
    titles[] = {};
    };
};

After you've done that, all should be working when you upload your PBO's.
You must have a revolver with at least one round to get the scroll menu option to play Russian Roulette.

- FAQ -
Q. How do I do X?​
A. Post in the support thread.​
---​
Q. It isn't working. What did I do wrong?​
A. Post in the support thread.​
---​
Q. How do I add a custom fn_selfActions and compiles?​
A. Use the search function.​
---​
Q. I have a question not answered in your Faqs. What do I do?​
A. Post in the support thread.​
- Credits -
Headshot Suicide by Grafzahl​
I used his script as a base for mine, although it's pretty modified now.​
 
Back
Top