设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 67|回复: 0

[制作教程] Russian Roulette, the lethal game of chance. Or; random eventuality

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4616

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23239
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28749

    灌水之王

    发表于 2026-7-7 15:51:26 | 显示全部楼层 |阅读模式
    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/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-16 19:05 , Processed in 0.091190 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表