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

[转载发布] Sensor SelfSwitch

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

    连续签到: 2 天

    [LV.7]常住居民III

    9072

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-26 22:07:34 | 显示全部楼层 |阅读模式
    Sensor SelfSwitch v3.3.3


    by Lyson


    Introduction


            This plugin activates a self switch when a player is in a certain proximity of an event. It uses a notetag in the note of the event or in event page comments to set the proximity.


    Features


            - Automagic Selfswitching based on player location in relation to tagged event!


            - Comment or Event Notetags!


            - Comment tags can have their own Self Switch identified!


            - Line, Cone, Rectangular or Circular sensor zones!


            - Blackout Regions!


            - Game Variables for any sensor type!


            - Game Variable for Blackout Regions!


            - Game Switch to enable/disable Blackout Regions!


            - Plugin Commands!


    Video

    Spoilerhttps://www.youtube.com/watch?v=-jdkohB8C6A


                            I showed the zones with colored areas, so you could get a clear idea of how the zones work





             


    How to Use

    SpoilerParameter Usage




                                             




                                                            Event Self Switch


                                                            Set the self switch to be triggered by the event tag when a player enters the range. Options are A, B, C, and D. Default is D.


                                                            If you are using the Event notes tag, it is recommended to have a simple blank page as the first page, you can set a move route and all but nothing in the contents area will activate. Unless you are running parallel process.




                                                    Event tags provide 2 way functionality, they will turn off the switch when the player leaves the event's range.



                                                            Comment Self Switch


                                                            Set the self switch to be triggered by the comment tag when a player enters the range. Options are A, B, C, and D. Default is D.


                                                            The Comment tags will only be used when the page containing the comment is active, this will not activate any of the items (before or after) in the contents. 




                                                    Comment tags only provide 1 way switching, they will NOT turn off the Self Switch when the player leaves the event's range 



                                                             

                                                                    Blackout Region


                                                                    The region number that will stop the selfswitch. Number between 1 and 255


                                                                    ackout Region is the number of the region where you want the sensor to be ineffectual.

     


                                                                    Blackout Variable


                                                                    Set Blackout Region to be the a variable number. NO - false, YES - true





                                                    When Blackout Variable is true, Blackout Region is the variable number whose value contains the desired region number, anything other than a number set to the variable will most likely cause errors.


                                                     




                                                                    Blackout Switch


                                                                    Set Blackout Region to trigger by a switch (set below). NO - false, YES - true


                                                                    When Blackout Switch is true and the switch (set in Blackout Switch Number) is off, the region established for Blackout Region will not alter the functions of the sensor.

     


                                                                    Blackout Switch Number


                                                                    Set the number of the switch to trigger the Blackout Region. This will not be used unless Blackout Switch is set to true.





                                                    When it is ON the established region will prevent triggering the self switch.








                            Notetags Usage

    SpoilerThese notetags go in the note box for the event or in a comment on an event page. Add "!" (without quotes) in front of any number to make it use the variable of that number. So if you want to use the value of variable 7 then use <Sensor: !7>


                                                <Sensor: x>


                                            Where x is the number of tiles away that the selfswitch will be triggered.


                                               <SensorLV: x>

    This makes it so that the selfswitch will only be triggered in a straight line in the direction the event is facing.


                                            Where x is the number of tiles away that the selfswitch will be triggered.


                                             


                                                <SensorCV: x>


                                            This makes it so that the selfswitch will be triggered in a cone, the direction the event is looking.


                                            Where x is the number of tiles away the cone extends.


                                             


                                                <SensorRV: x, y>


                                            This makes it so that the selfswitch will only be triggered in a rectangular line in the direction the event is facing.


                                             Where x is the number of tiles to both sides of the event's looking direction, and y is the number of tiles away that the selfswitch will be triggered.








                            Plugin Command Usage

    SpoilerChange your sensors on the fly! Use Plugin Commands to alter any aspect of sensors on your event.


                                            You could even ADD or REMOVE sensors to/from an event.


                                            LSensor event property value


                                            LSensor page property value

      Okay, this is the Plugin command LSensor is required, as is either event or page. If you don't have at least one property and value after these, why are you using the plugin command??


                                            You can have any number of properties and values in the Plugin command, but only 1 event or page identifier.


                                            The event identifier is equivalent to using/modifying the event note tag.


                                            The page identifier is equivalent to using/modifying a comment tag.


                                            Here is the list and limits of the properties:


                                             


    Property    Values


    Id       x (number)


    Type     b, cv, lv, rv, null


    Range    x (number)


    RangeVar x (number)


    Width    x (number)


    WidthVar x (number)


    Dir      d, l, r, u, down, left, right, up


    ThisDir  true


    Id x (number)


                                               The Id of the event to be affected, this is not needed if the change is 


                                               to happen on the current event. Do NOT include preceding 0's.


    Type b, cv, lv, rv, null


                                               These are basic, coneview, lineview, rectangleview, the shorthand MUST be


                                               used. Width/WidthVar will be ignored on b, cv, and lv types. The command


                                               null will prevent the sensor from working, effectively removing it.


    Range x (number)


                                               Know that if you set this and then RangeVar, Range will be overwritten.


    RangeVar x (number)


                                               This is the variable number whose value will be used for the sensor Range.


    Width x (number)


                                               Know that if you set this and then WidthVar, Width will be overwritten.


    WidthVar x (number)


                                               This is the variable number whose value will be used for the sensor Width.


    Dir d, l, r, u, down, left, right, up


                                               Shorthand or full word can be used with Dir. This will set the direction that the sensor will use.


    ThisDir true


                                                This will set the sensor to use the direction of the event itself.


    Do NOT use both this and the Dir commands. This will lead to errors.


                                            ## A note about page sensor changes. The changes will only occur for the current page, and will not persist through page changes, even if the page that was changed comes back up. The plugin will use the original tag, if there was one, to make a sensor on page changes.






                             









    Plugin


            v 1.2 Download from pastebin


            v 3.2.2 Download from pastebin - Demo


            v 3.3.3  Download from pastebin


    Rate it here


    Changes

    Spoiler 



    v1.1





                                    1. Refactored the code a bit.



                                            2. Added a few lines to prevent the tag checking and sensor functions from running if the player hasn't moved.


                                            3. Added estroile's fix to the tag processing function.





                             


    v1.2



                                    1. Plugin name independent



                                            2. This is for anyone looking for just basic circle sensor implementation.




    v2.1




                                            1. Added support for comment tags to be used.


                                            2. Added option for comment tags to use a different Self Switch


                                            3. Added Line View sensor option.


                                            4. Added the ability to use Game Variable values as the sensor range for basic sensor.


                                            5. Added the ability to use Game Variable values as the sensor range for Line View sensor.




                                     


    v3.0



                                            1. Added Cone View sensor option.

    2. Added Rectangle View sensor option.


                                            3. Added Blackout Regions


                                            4. Fixed up some logic to improve performance and readability.




                                     


    v3.1



                                            1. Fixed an error that occured if an event's first page had conditions.


                                            2. Fixed a problem with blackout zone switches operating incorrectly.


                                            3. Made the plugin file name independent. Nah, just broke the whole darn thing.


                                             


    v3.1.1



                                                    1. Rebuilt tag checking.


                                                    2. Commas are no longer required in tags.


                                                    4. Removed Var tags for a more friendly use of ! variable identifier.


                                                    5. Added Plugin Commands so you can add/remove/modify sensors on the fly


                                                     


    v3.2.1



                                                            1. Removed some unused code.


                                                            2. Added On/Off plugin commands


                                                            3. Fixed issue with blank Blackout Regions.


    v3.2.2



    1. Fixed an issue found with a plugin command.


    v3.3.3



                                                                            1. Sensor tags may now hold multiple directions, spaces between directions are optional. Shorthand (first letter) or longform (full word) are accepted as well.


                                                                            2. Plugin commands now take multiple directions, spaces are required. Shorthand or Longform accepted. Ex: LSensor event dir left r down


                                                                            3. Changes made to sensors from another event now store properly between menu/map changes.


                                                                            4. Help section mentions multiple directions in both the tag and plugin command information.











             


             








    Incompatabilities





                            Pixel Movement/Collision plugins are likely not going to work with this.


                            Untested with different tile sizes.






    Credit


                    - Lyson


    Terms


                    - Free for commercial or non-commercial with credit to Lyson.


                    - Do not post anywhere without permission. If you want to translate into another language, ask me and provide a link to the site you wish to post it on.


    Special thanks to estriole and Gilles!!


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-22 07:51 , Processed in 0.139662 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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