Russian Roulette is a lethal game of chance made famous by the movie The Deer Hunter, and has been seen in Prison Architect, Lisa: The Painful, the visual novel Axanael, and in the form of various party games such as a shot glass containing high-proof vodka or a specific pizza slice being spiked with tabasco. Russian Roulette is traditionally played with a single bullet in a six-chambered revolver. You spin the barrel, put it at your head, and pull the trigger. Depending on the rules, you may have to pull it repeatedly without spinning the barrel, or have the barrel spun between each attempt.
The notable part about repeatedly pulling the trigger is that your odds of death increase each time, eventually reaching 100%. This tutorial replicates this phenomenon. The full text code is located at the end of the post.
Requirements
- Two variables.
- One common event.
- Knowledge on how to do basic changes on scripts.
- Knowledge on how to use labels.
- Able to comprehend the metaphorical significance of the revolver.
Setting it up
First, you will need two variables, call them
"Chamber" and
"Bullet Check". These are not literal, but rather an abstract of the metaphorical gun.
Chamber is the total number of slots, and
Bullet Check will be rolled at random each time in an increasingly narrow band of numbers. Once this is done, make a common event called
Russian Roulette.
For our example we will assume the gun has six
chambers and one bullet. Set the
Chamber variable to 6 in the common event, place a label under it called
Choice, then make a choice with three options, "Pull the trigger", "Spin the barrel", and "Put the gun away".
Pull the trigger choice
Please note this assumes that Chamber is Variable 1, if it is not, change $gameVariables.value(1)'s bracketed number to the appropriate value.
Under "Pull the trigger", add in a Control Variable and select
Bullet Check, and select Script. Place this into the Script.
Math.floor(Math.random() * ($gameVariables.value(1) - 1 + 1))+1;
This selects a random number between
Chamber and
1, the basic anatomy of the script is explained below.
Math.floor(Math.random() * (MaximumNumber - MinimumNumber + 1)) + Minimum Number;
Under this, add a conditional statement. Have it check if
Bullet Check is equal to
1 and allow for an Else case. If
Bullet Check <= 1, that means the gun has fired, so place the lethal consequences, for example a loud gunshot, the screen turning red, and a game over message.
The Else case is where this differs from simply rolling 1/6 to die. In the Else case, place a sound effect of a click, and then
Control Variables: Chamber -1. Immediately after that, put in
Jump to Label: Choice.
If you want more bullets in the chamber, change the fork condition to 2, or even set aside a third variable to compare it to.
Spin the barrel choice
In here, put in a sound effect of the barrel spinning,
Control Variables: Chamber = 6, and
Jump to Label: Choice.
Put the gun away choice
Just leave this blank.
And that's it, a simple Russian Roulette minigame. Simply call the common event any time you want to spin the wheel.
Simple Explanation
The Bullet Check variable is rolled randomly between 1 and Chamber. Each time the trigger is pulled, Chamber reduces by 1, increasing the odds of the next one firing the bullet. By setting the If statement to a higher number, you can load more bullets into the gun.
Other Uses For This Technique
Searching for a randomly-placed object:
If you roll 1-10 for an item's location, you will have to place down ten events each with a fork condition checking for a different number, or you'll have a single random number that counts down each time until it hits 1. By applying this tutorial's technique you can make a single event and drop it in as many places as you want, setting the location variable to the number of possible locations.
Faulty items:
Someone just gave you some grenades, how generous. Except
one of them is rigged to explode the instant you pull the safety pin. Which one? Who knows, Schrodinger's grenade is lurking in your inventory.
Poisoned Provisions:
A total jerk of an assassin has told you that
one of your provisions have been laced with poison. You have thirty provisions and only five Poison-B-Shown™, will you risk poisoning? When will you consider the risk high enough to start checking for poison? Or will you just destroy your provisions? (This in particular is advanced, and will likely require scripting or even rewrites of how items work)
"Wouldn't it be easier to just pick a number that counts down each time?"
One advantage to this over a number that is chosen randomly and then ticks down is that this cannot be savescummed to acquire hidden knowledge. You wont know what chest the item is in or what grenade will explode since it'll be random every time you look. This is especially important in the Poisoned Provisions example above. This makes the randomness somewhat quantum in nature, like Schrodinger and his zombie cat.
The Code
Spoiler: Russian Roulette
◆Control Variables:#0001 Chamber = 6 ◆Label:Choice ◆Show Choices:Pull the trigger., Spin the barrel., Put the gun away. (Window, Right, #1, #3) :When Pull the trigger. ◆Control Variables:#0002 Bullet Check = Math.floor(Math.random() * ($gameVariables.value(1) - 1 + 1))+1; ◆If:Bullet Check <= 1 ◆Play SE:Gun1 (100, 100, 0) ◆Tint Screen:(255,-255,-255,0), 5 frames (Wait) ◆Text:None, Window, Bottom :Text:You killed yourself, congratulations. ◆Game Over ◆ :Else ◆Play SE:Open1 (100, 120, 0) ◆Wait:60 frames ◆Control Variables:#0001 Chamber -= 1 ◆Jump to Label:Choice ◆ :End ◆ :When Spin the barrel. ◆Play SE:Switch2 (90, 100, 0) ◆Control Variables:#0001 Chamber = 6 ◆Jump to Label:Choice ◆ :When Put the gun away. ◆ :End
本贴来自国际rpgmaker官方论坛作者:RianQuenlin处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/russian-roulette-the-lethal-game-of-chance-or-random-eventuality.149925/