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

[转载发布] Event Radius Check

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

    连续签到: 2 天

    [LV.7]常住居民III

    5778

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 08:23 | 显示全部楼层 |阅读模式
    Event Radius Check v1.0
            Dolarmak
    Introduction
    This plugin will allow you to have events detect one another.

    Features
    Set custom event name detectionSet radius of detectionSet which Self Switch detection activates

    How to Use
    Set the Self Switch you want to active in the Plugin Manager.Use the Plugin Command : EventRadiusCheck name_of_event_to_check #_of_tiles_awayThis will then check if the event name_of_event_to_check is within the # of tiles you specified.

    Script
             


    //=========================================================
    // Event Radius Check
    // EventRadiusCheck.js
    // Version: 1.00
    //=========================================================
    /*:
    * @author Dolarmak
    * @plugindesc Checks if an Event2 with a specific name is within a desired radius of the Event1
    Sets the Event1's selfswitch to A, B, C or D
    *
    *
    *@param Self Switch
    *@desc Set Self Switch of Event if it detects the desired Event.
    A, B, C, or D.
    *@default A
    *
    * @help
    * =============================================================================
    * What does it do?
    * =============================================================================
    *
    * Checks if an Event2 with a specific name is within a desired radius of the
    Event1. Sets the Event1's self switch to A, B, C or D. If it fails to detect the
    Event2, it turns OFF the self switch.
    *
    * =============================================================================
    * Usage
    * =============================================================================
    * To check for Event2 with a specific name around the Event1 use the
    Plugin Command: EventRadiusCheck name_of_event_to_check #_of_tiles_away
    *
    * This will then check if the event name_of_event_to_check is with the # of
    tiles you specified.
    *
    * =============================================================================
    */

    var parameters = PluginManager.parameters('EventRadiusCheck');
    var ev_which_switch = parameters['Self Switch'];
    var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;

    Game_Interpreter.prototype.pluginCommand = function(command, args)
    {
            aliasPluginCommand.call(this, command, args);

            if(command == "EventRadiusCheck")
            {

                    var ev_event_x = $gameMap._events[this._eventId]._x;
                    var ev_event_y = $gameMap._events[this._eventId]._y;
                    var ev_event_true = false;
                    var ev_event_name = String(args[0]);
                    var ev_radius = Number(args[1]);

                    for(var ev_event_y_check = (ev_event_y - ev_radius); ev_event_y_check < (ev_event_y + ev_radius + 1); ev_event_y_check = (ev_event_y_check + 1))
                    {
                            for(var ev_event_x_check = (ev_event_x - ev_radius); ev_event_x_check < (ev_event_x + ev_radius + 1); ev_event_x_check = (ev_event_x_check + 1))
                            {
                                    if ($gameMap.isXyHasEventName(ev_event_name,ev_event_x_check,ev_event_y_check) == 1)
                                    {
                                            var ev_event_true = true;
                                    }

                            }
                    }

                    //----- End Result ----//       
                    if (ev_event_true == true)
                    {
                            //----Event is in Range ----//
                            $gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], true);

                    }
                    else
                    {
                            //----Event is not in Range ----//
                            $gameSelfSwitches.setValue([this._mapId, this._eventId, String(ev_which_switch)], false);

                    }

            }

    }





    FAQCredit and Thanks- Dolarmak (Wylie Capp)- Marked Author's Notes


            This was build for my own project, but I figured it might be useful for other people.


    Terms of Use


            Free for use in non-commercial projects with credits.Contact me for commercial use.


    本贴来自国际rpgmaker官方论坛作者:dolarmak处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/event-radius-check.57905/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-26 04:54 , Processed in 0.111685 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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