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

[制作教程] Autorun Events (Or: Why Can't I Move?)

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

    连续签到: 1 天

    [LV.7]常住居民III

    3646

    主题

    862

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 前天 15:28 | 显示全部楼层 |阅读模式
    I've seen a lot of people struggle with autorun events, and I too have done the same. Character won't move and I know I've done something wrong with that new event, but I don't really know what. It wasn't until I recently learned how events process that it all made sense, and I wanted to share that so that others can learn from my repeated mistake.

    Part 1: Event Pages

    Pages are important for autorun events. Primarily, these are how you jump out of the loop that is an autorun event. Under ideal circumstances, an autorun event will process through its commands only once and be done. Something needing to loop until a condition is met is generally the realm of parallel process events.





    When an event is processed, it actually, counterintuitively (at least to me) processes the event pages in reverse order, from the highest to the lowest. As it goes through these, it looks at your conditions for that page and will process the first one that has its conditions resulting in a true statement.

    Part 2: Event Page Conditions

    The commands on an event page will be run if its conditions are met. If they are not, the page is skipped and the next page is looked at until one is found where conditions are met. An example:





    This set of conditions means that if TestCondition1 is on and Self Switch A is on, the commands in this page can run. However, if either one of TestCondition1 or Self Switch A is off, this event page will be ignored. If the conditions on your pages are set in such a way that no page will be run, this can cause an infinite loop in your event. As such it is a good idea to have one page that has no conditions, as this will always prevent an infinite loop in your event pages.

    What does this stuff mean for your autorun? Let's have a look with an autorun event that looks at a couple of switches and sets self switches accordingly.

    Part 3: Setting Up the Autorun Commands

    The setup for this particular example are pretty simple. Obviously for switches, they would end up being controlled elsewhere, but that is outside the scope of this example.

    The commands for this autorun event look like this:





    To put it simply, If TestSwitch1 is on, turn Self Switch A on. Otherwise (meaning TestSwitch1 is off), if TestSwitch2 is on, turn Self Switch B on. Otherwise (meaning both TestSwitch1 and TestSwitch2 are off), turn Self Switch C on.

    An important point about this design is it leaves no open ends. If one or the other of the switches are on, something happens to alter event processing. Same if neither are on. Leaving an unhandled condition can open up the possibility of an infinite loop, which we're trying to avoid. This can also be handled by having the very last line of an autorun alter a switch or self switch, so long as another page of the event is set to handle that condition.

    Part 4: We Have an Autorun, But Where Does it Go?

    If you're like me when planning these, you might start by thinking of the possible end results that you want and making the pages for those first. In this case, we would set one of each of Self Switches A, B and C as the conditions for 3 different event pages.

    These pages would be set to have "Action Button" as a trigger, and no event commands. That way if the player should manage to reach the event and press the action button, nothing would happen anyway.

    So, that just leaves the 4th page for the autorun. Easy, right? Well, let's see what will happen.

    Let's assume that TestSwitch1 is on, just to make it easy.

    Event Page 4 is checked - no conditions. Trigger is autorun type. Start processing the event commands.

    - TestSwitch 1 is on - Run commands along that part of the conditional branch

      - Set Self Switch A to on.

    - End of Event Page commands.

    Return to beginning of event page check.

    Event Page 4 is checked - no conditions and autorun type. Start processing the event commands.

    ...

    See the problem there? When a set of commands is run through to the finish, the whole event starts processing from the very beginning. In this example, only page 4 will ever be run, stuck in an infinite loop.

    To fix this, the autorun event needs to be on Page 1, moving the other pages down, and making the event processing look more like this:

    Event Page 4 is checked - Self Switch C is required and off. Skipping Page 4.

    Event Page 3 is checked - Self Switch B is required and off. Skipping Page 3.

    Event Page 2 is checked - Self Switch A is required and off. Skipping Page 2.

    Event Page 1 is checked - no conditions. Trigger is autorun type. Start processing the event commands.

    - TestSwitch 1 is on - Run commands along that part of the conditional branch

      - Set Self Switch A to on.

    - End of Event Page commands.

    Return to beginning of event page check.

    Event Page 4 is checked - Self Switch C is required and off. Skipping Page 4.

    Event Page 3 is checked - Self Switch B is required and off. Skipping Page 3.

    Event Page 2 is checked - Self Switch A is required and on. Trigger is Action Button. Wait to process event commands.

    Now that is more like it! The autorun event commands will run, and then stop on Page 2. Also, because Page 2 has no commands, if the action button is pressed and triggers the event, all that will happen is the pages will be checked again, and it will stop at page 2 again. No more infinite loop!

    Conclusion

    So hopefully after all of that, creating an autorun event is a little bit clearer. The overall takeaway is pretty simple:


    • Make sure your autorun has low, or ideally no conditions on its page and is one of the first pages in the event.
    • Make sure pages with a greater number of conditions are on higher numbered pages.
    • The whole event structure will get checked over again when a set of commands is complete.
    • Make sure conditional branches and command sets in general have outcomes set to help avoid loops.
    • Plan your events carefully and you should be able to avoid infinite looping autorun events!



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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-10 02:06 , Processed in 0.099998 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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