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

[制作教程] In-Game advent calendar (Tutorial)

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

    连续签到: 2 天

    [LV.7]常住居民III

    4446

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    INTRO:

    Inspired by the amazing advent calendars on the forum, I want to show you how you can easily make an in-game advent calendar, where your players can collect a new reward once a day, in december.

    I made a way more complicated system for an advent calendar in my card game, but I will keep it short and simple. We will use some javascript in this tutorial, but it will be just a tiny bit and you can just copy-paste the script call from my example. You can still follow this tutorial if you know absolutely nothing about javascript.

    In theory this should work for MZ as well.

    REQUIREMENTS:

    For this tutorial we need the following:

    • 1 variable
    • 1 event or common event the player can reach and trigger easily
    • 31 rewards
    Spoiler: About triggering the (common) event
    In MV, I use a plugin by Yanfly to trigger a common event every time the game is loaded, but if you don't have a plugin like that, you can give the player an item, lets say an advent calendar, which will trigger the common event on use. Or you can make an object on the world map, lets say an advent calendar, which will trigger the common event when you interact with it. You know what?  I will show you how to make a fully functional advent calendar and I will leave the trigger to your imagination.
    What is MMDD:

    MMDD is a timestamp of 3 or 4 digits. The last 2 digits are the current date, and the other 1 or 2 digits are the current month.

    We're going to use this a lot in the mini tutorial below.

    Example:
    0512 = May 12th
    1205 = December 5th

    512 = also May 12th
    125 = NOT also December 5th...
    125 = January 25th instead.

    STEP BY STEP:





    With the first condition, we check if it is even December or not.

    If it is not December, you can either show them a message (if the players trigger the calendar themselves) or do nothing (if you script the trigger for the event).

    In the second condition, we check if the MMDD in \v[140] is equal to the current MMDD. If so, the reward was already claimed, but if not, we claim the reward for today.

    Where we claim the reward, we also put the current MMDD timestamp in \v[140]. If you would run the event again, it will have the current MMDD already saved in the variable, so the second condition will prevent todays reward to be claimed again.

    For the first condition:
                    JavaScript:       
    new Date().getMonth() == 11

    This simply checks if it is December right now.

    For the second condition:
                    JavaScript:       
    (new Date().getMonth() + 1) * 100 + new Date().getDate() == $gameVariables.value(140)

    I use variable 140, but you can change that to the id of any variable you use for this.
    This checks if todays MMDD timestamp is the same as the one in the variable.

    For the Control Variables command:
                    JavaScript:       
    (new Date().getMonth() + 1) * 100 + new Date().getDate()






    I have removed the text messages. The mechanics are untouched.

    I did add a few conditions. If MMDD = 1201, give the first reward. If MMDD = 1202, give the second reward. Etc etc. You can add a message here, show some pictures, sing them a song. Whatever you want to do to dress up your calendar.

    We place this in the condition where it is indeed December, and the current timestamp is NOT equal to the old timestamp.

    Do this AFTER updating the DDMM in variable 140. This is important, otherwise the first day you get nothing, and every other day you get yesterdays reward.

    This is all. If you want, you can start dressing your advent calendar up. What it will look like, is all up to you. I just told you how it works.

    But if you think this is to simple, or you're just too lazy to give all the rewards manually, keep reading step 3!





    If your rewards are items, which have upgoing ID's, you can use this script call to automatically give the right item to your player.

    In my example, the reward for december 1 is item 21, and dec 2 is item 22, dec 3 is item 23. etc etc. Change my 21 to the item id of your december 1st reward.

    And just like before, change the 140 to whatever variable you choose to use to store MMDD.

    Script call:
                    JavaScript:       
    var itemId = 21 ; //replace this with this id of the reward for 1 december.var mmddId = 140 ; //replace this with the id of the variable you stored MMDD in.$gameParty.gainItem($dataItems[$gameVariables.value(mmddId)-1201+itemId], 1);


    Well, that was it! No need for 31 conditions, or 31 commands to give a reward. Now you can dress it up with an animation, theatrical music or you shouting: "MERRY CHRISTMAS!". Do whatever you feel is needed to make this the coolest advent calendar ever!

    THANKS FOR READING!

    I know it is a little late for this years advent and Christmas games, but it can also be used in regular games, just to have a little extra in your game during the december month.

    Happy holidays everyone!

    (Last comment... I wrote this after a day of work, and I'm tired. But I've tested everything and everything works just fine for me. But if I somehow forgot to explain something, or rushed over a detail as if it was something obvious, let me know.)


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 14:29 , Processed in 0.127039 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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