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

[转载发布] Remote Event Counting and Control by Name *dead, see Universal Remote Control*

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

    连续签到: 2 天

    [LV.7]常住居民III

    8280

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Remote Event Counting and Control
    by Dahlys
    Download Link

    *Update 09/24: This plugin is dead. Please see my Universal Remote Control instead

    Introduction:

    Count number of events with Event Name = "insert_name" and store their event IDs into an array.
    Remotely activate self-switches based on event names.

    Features:

    • Count the number and log the IDs of Event Names containing the word(s) of interest.

      • e.g. If all NPCs have NPC in their event name, you can store their Event IDs in a variable as an array. The total number of NPCs on the map can also be stored into a variable.
      • An array of strings ["Tom", "Dick", "Harry"] can be used as input as well as individual strings "Tom", "Dick", "Harry"

    • Remote control Self-switches by matching Event Names, works for Yanfly's self-switch plugin!

      • e.g. If all children have "child" in their event name, you can turn on their self-switch to make them all flee from you at once in a game of tag. No need for a common event/global switch and parallel processes all over the place.
      • e.g. If you type a string or array of strings into a variable (via another plugin (http://biud436.tistory.com/58) or script call), you can drop a lightning bolt on "EnterNameHere" anywhere on the same map.

    • Set your own conditions to whether the Event ID will be included or not.

      • Some javascript knowledge required
      • Script calls from other plugins can be used in conditions. I have not yet found any conflicts with Yanfly, LTN, Galv, Hime, Khas, and Orange.
      • e.g. Choose to exclude dead NPCs who have self-switch "D" on.

    • Once Event IDs are stored in a variable, they can be used as a source array for further functions. This prevents having to loop through every single event on the map when you just want to activate/search through a subset of events.
    • More detail on plugin functions and usage is found in the plugin help box.

      • Please read carefully especially when using conditions involving Event IDs. e.g. Checking if their dead/alive self-switch is on. Also watch out for special javascript characters.

    Screenshots:





    How to use:

    Dump the .js file in your project plugins folder and add it to your plugin manager. The order this plugin is loaded shouldn't matter.

    Thanks to:

    Soulpour777 for his scripting tutorial!

    Author's Notes:

    Spoiler: My Script Calls: Before and After
    My script calls used to look like:
                    Code:       
    1. //On map entry
    2. var npc = [];
    3. for (i = 1; i < 999; i++) {
    4.     if ($dataMap.events[i] == null) {
    5.         break;
    6.     }
    7.     else if ($dataMap.events[i].name.includes("NPC") && !this.getSelfSwitchValue(this._mapId, i, 18)) {
    8.         npc.push(i);
    9.     }
    10. }
    11. $gameVariables.setValue(65, npc)
    12. $gameVariables.setValue(64, npc.length)
    13. //Parallel common event
    14. var npc = $gameVariables.value(65);
    15. var nearby = [];
    16. for (i = 0; i < npc.length; i++) {
    17.     if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("Policeman") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
    18.         nearby.push(npc[i]);
    19.     }
    20. }
    21. if (nearby.length > 0) {$gameVariables.setValue(83, nearby)}
    22. for (i = 0; i < npc.length; i++) {
    23.     if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("FBI") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
    24.         nearby.push(npc[i]);
    25.     }
    26. }
    27. if (nearby.length > 0) {$gameVariables.setValue(84, nearby)}
    28. var victimfamilies = $gameVariables.value(85);
    29. for (i = 0; i < npc.length; i++) {
    30.     for (j = 0; j < victimfamilies.length; j++) {
    31.         if (Galv.DETECT.event(npc[i], $gameVariables.value(11), true) && $dataMap.events[npc[i]].name.includes(victimfamilies[j]) && this.getSelfSwitchValue(this._mapId, npc[i], 18) == false) {
    32.             nearby.push(npc[i]);
    33.         }
    34. }}
    35. if (nearby.length > 0) {$gameVariables.setValue(86, nearby)}
    复制代码


    ...Okay, bad. And I do this OVER and OVER again?

    What the script calls now look like:
                    Code:       
    1. this.countevent("NPC", 64, 65, "!this.getSelfSwitchValue(this._mapId, id, 18)");
    2. this.counteventarray("Policeman", 0, 83, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
    3. this.counteventarray("FBI", 0, 84, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
    4. var victimfamilies = $gameVariables.value(85);
    5. this.counteventarray(victimfamilies, 0, 86, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
    复制代码


    Er... Somewhat better I guess!?
    I hope this plugin will be helpful to some people! This has been super useful to me in shortening script calls in my "Police vs Thief" game.

    If you look through the script, it's not the most elegant thing. I highly welcome any suggestions to improve. This is my first ever rpg maker plugin, and my first time writing in javascript (I used to use the monster called C++, that was 5 years ago when I was still in school). Perhaps the next update will add more functions such as the ability to activate multiple switches. I've been playing with rmmv for... 2 weeks?


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 19:43 , Processed in 0.086284 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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