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

[制作教程] Generate Bank Interest (with Demo!)

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

    连续签到: 2 天

    [LV.7]常住居民III

    4456

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    So I've seen many tutorials about eventing a banking system but there are no tutorials about implementing an interest system.

    The player needs a good reason to want to store money in the bank. So I fiddled around with the eventing options and came up with a way to generate interest over a period of time. This can be number of steps or play time. This interest system is fully evented and requires no scripts whatsoever.

    I'll try to make this as noob-friendly as possible. But since this is my first ever tutorial, there aren't any guarantees 



    Here's a small demo to show you how it works. I also added comments in the event pages to try to explain what I did, so look through that if you're having trouble.
    The demo contains the full banking system, complete with Withdraw, Deposit, Review Balance and Add Interest.
    Download Demo Here

    First of all, you'll need 6 variables:






    *Note: Variable 6 "Bank Steps" is not required. I noticed it after completing everything, so couldn't change it. Just imagine it was never there.

    Since this tutorial is about implementing interest, I won't go into detail on the basic banking process. There are plenty of tutorials floating out there that can teach you how to do that.

    So the first three variables are required for the basic banking. For the interest, we'll be using variables 4 (Global Steps), 5 (Local Steps) and 7 (Bank Interest)

    The first part of the event should look like this:





    Now, let me explain how this works.





    Here, we will be calculating how many steps the player took since the last time the bank was accessed. You wouldn't want the interest to keep increasing as the game steps increase to a massive amount!
    This willl probably be the most difficult part of the event. So try to understand it clearly.

    *Note: If you want to generate interest by game time instead of steps, simply replace steps with play time when binding it to a variable.

    First we will bind the total steps the player took throughout the game to a variable. In this example, that would be variable 4 "Global Steps".
    To bind a variable to game steps(or time), simply choose 'Variable Operation' and substitute the variable with the 'Game Data' option in the variables menu.
    Then we will subtract the amount stored from the last time the bank was accessed. That would be binded to a new variable. In this example, variable 5 "Local Steps" was used for that purpose. If the bank was accessed for the first time, the value would obviously be zero, thus no change whatsover.After subtraction, the "Local Steps" variable will receive the game steps again. This means it now recorded the new number of steps.

    Here's an example of how this works. Lets say the first time the player accessed the bank, he had already walked 220 steps. If you follow the event properly, this is what happens:

    > GS (Global Steps Variable) recieves 220 (number of steps)
    > GS - LS (Local Steps variable). Since LS = 0, GS is still 220
    > LS receives 220

    Then the next time the player accessed the bank, he walked another 300 steps.

    > GS receives 520 (the 220 from before and the additional 300)
    > GS - LS. LS now equals 220 from last time. So 520 - 220 = 300 steps! (Success! Yay 

     )
    > LS receives a new value of 520

    So this is how you calculate the number of additional steps from the last time the bank was accessed.

    Congratulations! You have completed the most difficult part of the event! The rest is simple mathematics 








    Now for some old school maths. Yes, finally those painful lessons will pay off 



    To calculate interest, we will use the simple mathematical formula of I = PRT/100 (I'm sure everyone knows this)
    We already got the tricky part, the time, and the principle is just the amount you have in the bank, So that leaves us with just the rate!
    The rate is completely your choice. In this example, I'll be using 1 per 15 steps.ie: 1/15. If you choose 1 per 20 steps, it'll be 1/20 and so on.

    So if you look at the event, first we multiply the time we achieved with the Bank Gold. DO NOT MULTIPLY BANK GOLD BY TIME, IT MUST BE TIME BY BANK GOLD. The obvious reason is not to change the Bank Gold Variable.Anyways, we then multiply it by the rate as the formula says. Since the rate is 1/ 15, the number actually gets divided by 15. So thats how we get PRT. Now we divide this by 100. To simplify things, as you can see in the screenshot, I simply divided it whole by 1500 instead of dividing by 15 and again dividing by 100. So if you're rate is 1/15, its No. of steps multiplied by Bank Gold and the answer divided by 1500. If its 1/20, its divided by 2000. Piece of cake.

    Now you simply add your answer to a new variable. In this case, its Variable 7 "Bank Interest". REMEMBER TO ADD IT. ITS A COMMON MISTAKE TO SUBSTITUTE THE VALUE. YOU SHOULD ADD THE VALUE, NOT REPLACE IT.

    Then you just continue to regular banking:







    Now there is just one simple step left. You have to create an option, something like "Add Interest", to the banking event.





    You display a text stating the interest that was generated using the Bank Interest Variable, then give the player the choice to add the interest to the bank money. If he chooses 'Yes', simply add the interest variable to the Bank Gold and then empty the Bank Interest Variable (see screenshot above)



    So after the long eventing process, you're event should look like this(the banking part isn't included here.Check the demo if you need it)

    *The Input Number and Party Gold are needed for the main banking purposes, not for generating an interest








    Phew! That was a long tutorial. Hope I was able to help and explain clearly.
    Feel free to ask anything!


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 15:47 , Processed in 0.092288 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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