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

[制作教程] Eventing Respawning Foraging Nodes and Enemies Using Script Calls

[复制链接]
累计送礼:
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

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    Hello! In this tutorial we will be using events to represent on-map enemy encounters and foraging/mining nodes, turning on their self switch after the event executes, then call a common event at some point (like using an inn) to reset the self switches for those events on their map to allow them to "respawn" or "replenish".

    The alternative method I've heard of to do this and have previously used involves designating a variable for each node/enemy to check if they've been depleted/killed (set to 1) and the empty 2nd event page triggers when the var is 1, then resetting (all the variables within a range) to zero in a common event for them to respawn. It is probably easier to do that, but it would take up valuable variable slots if you expect a looooooot of forage/ore nodes and enemies in your game, so I tested the script call to modify self switches "remotely" in a common event, it worked, and I use this system now.

    According to the script call megasheet, this tutorial could also work in MZ since MZ seems to use the same script calls as MV. Some more useful script calls like the one in this tutorial can be found there too. I found that it's sometimes faster to fill in the blank for some of these rather than clicking a hundred times in the eventing commands menu to do something simple lol.






    For enemies, the first page should look like the first picture, and the second event page should look like the second.
    The first page turns on the self switch A after winning the battle so that event page 2 triggers and the enemy despawns.




    Making foraging and ore nodes should have similar event pages just without the battle processing.




    Take note of the event id on the upper left corner within the event editor.




    Exit the event editor and check the lower left corner of the map editor, take note of the map id the event is located on.





    Now we will put these values in a script call in the common event you designate to reset these events.





    Paste and modify the template into the script call box.

    var key = [mapId, eventId, 'A']$gameSelfSwitches.setValue(key, false);

    Replace map Id and eventId with their respective numbers.

    Example:
    var key = [20, 4, 'A']$gameSelfSwitches.setValue(key, false);

    ((The comment is just there to provide a template for you to be able to quickly copy and paste from instead of having to refer to the script call sheet again and again.





    Add another script call for each event that needs to respawn within that common event.

    And call that common event whenever you need them to respawn.





    There you have it, a way to use control self switch script calls to remotely reset self switches of events.
    I'd also recommend keeping track of these event and map ids on a spreadsheet so you know which events whose self switches need to be turned back off, or whenever you want to make a change to any of them.

    If you would like to do it the more efficient way, you could also directly use the script call:

    $gameSelfSwitches.setValue([20, 4, 'A'], false)


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 14:21 , Processed in 0.090362 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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