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

[制作教程] NoScript Slot Machine

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

    连续签到: 2 天

    [LV.7]常住居民III

    4551

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    DorkLord's (aka BossGalaga) VX Ace NoScript Slot Machine

    (...or Fun With Variables)​

     ​

    Download the Fully Editable Project File from:


    *In case Thread Attach doesn't work*

    **If anyone has questions about this or using this in their own project, feel free to drop me a PM**​

     ​




     ​

    A video showing off the Slot Machine from my recent game, Cliche Quest.




     ​

    FEATURES:

    Fully commented event code
    3 Reel Slot Machine, Fully animated!
    Spins are randomized on each reel.
    Controlled by one event, about 20 pages worth of event code but easier than it looks.
    Fully configurable prize combinations, side prizes and random prizes.
    Unique (one time) prizes! (prizes that can only be won once)
    Configurable odds/payout rate by adding custom
    Addicting!
    *Now Ralph has a gambling problem*

    WHAT IS IT?
    This is a sample project showing off a no script 3 reel Slot Machine that I created for my new episodic game Cliche Quest.  This Slot Machine was fully evented from scratch.  Would it have been easier to script it instead?  Probably...a little but still would have used the same method.

    HOW IT WORKS

    To understand how this works you should have at least a basic understanding of using switches, variables, labels and conditional branching.  The slot machine uses 9 variables, 5 switches and 3 events.

    Switches: FreePullUsed, SlotPrizeWon, UniquePrize1, 2 and 3.

    Variables: Slot1position, 2, 3, Slot1random, 2, 3, Slot1spintime, 2, 3

    1 event serves to reset the slot position variables when a player enters the room/map.

    3 events are used to display the reels on the slot machine.  These are empty events that only serve to display a graphic.  1 event controls the prize chest, which opens up and gives the player a prize if they've won a main prize and finally, the event attached to the lever is what controls the entire slot machine.  1 additional event is called animation-placeholder. This is an empty event that we use as a target for a Show Animation effect if the player gets a jackpot or 2 or 3 skulls in a row.

    The machine uses an edited charset with the 8 slot symbols copy&pasted in each character set, that way when using Set Move Route to change the graphic, we don't have to use the Turn command to set it to a specific frame. 

    So our goal is to have a slot machine, with 3 reels with 8 symbols on each reel, that spin around and then stop at a random position and see if we won a prize or not.  This is all done inside a loop until the machine has finished spinning and checking to see if a prize was won.

    The machine starts by using Control Variable to set slot1/2/3random variables to a random number between 0 and 15.

    Then those variables are set to equal our Slot1/2/3 spintime variables, which are used to determine how long to spin the reels for.

    Since we want to spin the reels for more than 0-15 frames we also add 128, 144 and 160 extra spintime to each variable.  This gives us a healthy amount of spin on the reels and also makes it so the first reel will countdown to 0 first, followed by the second and then the third.

    Conditional Branching which checks the Slot1/2/3position variables is used to update the graphics displayed on the reels.  Then an increasing Wait time is added after the graphics update phase so the reels appear to slow down the closer they get to finishing their spins.

    As long as the slotXspintime doesn't = 0, we increment the slot position.  If it was at position 7, we add +1 and move it to position 8.  If the position has reached 9 (remember we have 8 symbols) then we use Control Variable again and set that slotposition to 1, because it has completed a full revolution.

    Finally, we -1 from each spintime variable.

    After this is done, we enter the prize checking phase and use Conditional Branches to see if Slot1, 2 and 3 match any of the prize combinations that we have previously set.  For instance, in this example 2, 2, 2 is 3 coins which is a jackpot.

    If the player has won a main prize, I set the slotprize variable to the prize I want them to win, set the SlotPrizeWon switch to on and then tell the player they have won and can get their prize from the chest, then use a Jump to Label command to send them to the end of the event code and avoid checking for any other matches or side prizes.  It's not necessary to use the chest to dole out prizes but that's just how I chose to make it.  If you don't want to use the chest you can delete it and make some slight edits to the prize checking part of the event code.

    I also have "side prizes" enabled on the machine.  If the player doesn't have a winning combination from the set of main prize combinations then I check to see if they at least a side by side pair.  If they do they get either a small prize or a random prize.

    And that's basically it.  I encourage you, if you're interested to download the project, check it out, play with it and study the event coding.  The concepts used in this project can be applied to various other projects as well.

    Extra Challenges: 2/2

    Control the Reel Stops: By adding a conditional branch that checks for a keypress by the player, we can make it so the player has to press a key to stop each reel.  After a keypress has been detected we can decide on how much longer that reel should spin and then stop it after that set amount of spintime.

    Vegas Odds: By "rolling" a weighted random variable at the beginning we can increase the player's odds of getting a specific symbol on each reel.  So for example, I would roll a random variable between 1 and 8.  If it's a 1 or 2 then Slot X will be set to stop on a Skull. If it's a 3, 4 or 5 Slot X will be set to stop on a Potion.  If it's a 6, 7, 8, 9 or 10 then slot X will be rolled again (1-8) and set to any random symbol.  This way, the player will have a higher chance of getting either a skull or a potion on any given reel.  This could increase the rate of smaller prizes won but also increase the danger of getting skulls.  After we have predetermined what slotposition we want each reel to stop at we would simply add or subtract from the spintimer for each reel so it will end on that predetermined reel, after which we would enter into the actual reel spinning loop.

    Think you can do better? imProve it!

    Yes, there are some things here that could have been done more efficiently.  Feel free to tinker with it, share back or post comments, suggestions and other feedback.

    Terms of Use:
    Free to use/modify/improve in Commercial/Non-Commercial Projects.
    Give Credit to Richard Colletta aka DorkLord @ RPGMaker.Net/RPGMakerWeb
    Do not redistribute as your own work.


    本贴来自国际rpgmaker官方论坛作者:DorkLord处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/noscript-slot-machine.25111/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-15 19:04 , Processed in 0.120674 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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