Sensor SelfSwitch

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
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

https://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

Parameter 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

These 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

Change 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

 



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!!
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
339
First Language
indonesian
first of all... nice plugin... this plugin is really useful. in ACE i use Moghunter's similar plugin for my project.

i would surely use this.

EDIT: nevermind... it's my plugin problem apparently :D . i mistake it for yours '=.
 
Last edited by a moderator:

DavidFoxfire

Veteran
Veteran
Joined
Feb 28, 2014
Messages
224
Reaction score
44
Primarily Uses
This plugin's a Godsend.  I have a game where clues appear on screen when the player moves toward them.  This will make that effect a bit easy for me.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
339
First Language
indonesian
this plugin is not compatible with any event cloner

(either my plugin or Hudel plugin)

my plugin: http://forums.rpgmakerweb.com/index.php?/topic/48073-est-clone-transform-delete-event/

Hudell plugin: http://forums.rpgmakerweb.com/index.php?/topic/46527-orange-custom-events/

i'm not aware of any event cloner / adder other than ours two plugin... tell me if there is.

your plugin will not recognize changed on map like new event / transformed and then crash when looking for the new event page...

to make it compatible... change:

Lyson.Sensor.processEventNotetags = function (evObj) {    if (!$dataMap) {        console.log("No map!")        return;    }    var event = $dataMap.events[evObj._eventId];    if (event.note) {        var note1 = /<(?:SENSOR):[ ](\d+)>/i;        var notedata = event.note.split(/(?:>)[ ]/);        for (var i = 0; i < notedata.length; i++) {            var tag = notedata;            if (tag.match(note1)) {                evObj._sensorRange = parseInt(RegExp.$1)            }        }    }};TO:

Lyson.Sensor.processEventNotetags = function (evObj) {    if (!$dataMap) {        console.log("No map!")        return;    }    var event = evObj.event();    if (event.note) {        var note1 = /<(?:SENSOR):[ ](\d+)>/i;        var notedata = event.note.split(/(?:>)[ ]/);        for (var i = 0; i < notedata.length; i++) {            var tag = notedata;            if (tag.match(note1)) {                evObj._sensorRange = parseInt(RegExp.$1)            }        }    }};EDIT: edited so it's only 1 line change

i can put that compatibility patch code in my plugin to overwrite your method (placing my plugin below yours)... but it would be better if the code placed on your plugin instead.... first of all since Hudell plugin also not compatible with your plugin without those modification.

second... it's because i dislike overwriting other people code (it would be bad when later you decide to change the code structure. it will break the compatibility patch inside my plugin)...
 
Last edited by a moderator:

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
Ah, nice catch. I'll fix my plugin as soon as I can. Been having problems with my computer.

Glad you guys like it.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
339
First Language
indonesian
this plugin is really useful for making the scene in a game...

for example making an enemy which will chase you when you enter certain range, etc...

this could also combo with my http://forums.rpgmakerweb.com/index.php?/topic/48891-est-event-size-and-trigger/

by making event that when we close to it... make the event to disappear / teleport us back to entrance... then make the map impossible to pass without entering the range.... then we can use my plugin extra trigger to activate the event without getting close and do something to the event like erasing them, etc.... :D .

example:

Guard Event... when we enter certain range... SelfSwitch D = ON.

>Page with SelfSwitch D ON => show message "You Got Caught by the Guard and bribe him 1000 gold to release you" 

   the character then moved to entrance of the map...

>Normal Page (First activated page) => show message "you pull the trap switch"... show message "guard got hit by trap...etc etc", erase event.

btw... any way to extend this script to recognize current page comment instead using event note.

so we could make more complex eventing...

some example:

- activate the event via extra fix trigger... make the guard blind and reduce sensor range. by using note it's not possible. :D . but if every page have unique sensor... it would be possible. :D .

- (this requires me to update my plugin above - make dynamic trigger that based on event direction... will create it soon i guess...).

we could create a guard with sensor 3 make him patrol the map. make him have extra trigger at exactly 3 tiles BEHIND him... when activating the event... do some BADASS Tenchu / Metal Gear Solid scene to kill the guard for good. :D .
 
Last edited by a moderator:

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
Yeah, I was using a simple self switcher for Ace, that's why I wanted to make this one. It's short, sweet and opens a lot of usage variety.

I already had plans for the next version and the comments checking was on that list.

Another feature was game variables for sensor range. Tags would be simple enough <SensorX: y> x = variable #, y = some basic modification of the value of x variable.

I'm also considering adding a region tile check to block the sensor, but that may be a bit beyond my abilities. Currently, this only checks the player's x/y in relation to the event's x/y, so making it avoid being active past a certain tile would be hard. I could, however, check if the player is on a region, and if so it wouldn't trigger the switch. The obvious complication there is that if you needed that area to be painted another region for whatever purpose.
 
Last edited by a moderator:

Gilles

Veteran
Veteran
Joined
Oct 31, 2015
Messages
41
Reaction score
33
First Language
German
Cool Plugin. I thought about extending it. You know the event system for Pokemon Trainers?

If the player is x tiles in front of your view direction an event is triggered. And the event should only strike again when the player walks 1 step.

---------

Update:

I just finished the plugin functions. They work really good. I sent you a private message so you can have a look at it :)
 
Last edited by a moderator:

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
New version released, Wambajamba!! I kept the old one up for people who just want the quick and simple functionality. OP is updated with changes and such.
 

Dinamic Creates

Project Stealth | Project Dungeon Trios
Veteran
Joined
Nov 27, 2014
Messages
69
Reaction score
24
First Language
Spanish
Primarily Uses
RMMV
This has two things I looked for: 
-Sensors for Stealth

-Region blackouts for ''Roguelike'' things.

You are Awesome
 

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
Wambajamba!! Version 3.0 is up on the OP, changes reflected. I'll be adding some screenshots later. Hope you guys like the new digs!

Ah, just fixed a small issue that gave an error on comment tags. -_-;
 
Last edited by a moderator:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
339
First Language
indonesian
Wambajamba!! Version 3.0 is up on the OP, changes reflected. I'll be adding some screenshots later. Hope you guys like the new digs!

Ah, just fixed a small issue that gave an error on comment tags. -_-;
NICE UPDATE... will check the new version a.s.a.p :D
 

pirateheart

Veteran
Veteran
Joined
Jan 5, 2014
Messages
26
Reaction score
4
First Language
English
Primarily Uses
I can't download it. It says "publisher could not be verified." >_< How do I fix this?
 

Lyson

Potholders!
Veteran
Joined
Sep 4, 2012
Messages
91
Reaction score
36
First Language
English
Primarily Uses
Is the file named properly? pastebin seems to name it differently if you click the download link.

The file name should be Sensor SelfSwitch.js

Exactly how it appears on the top of the pastebin page.
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
339
First Language
indonesian
Last edited by a moderator:

gamerxp

Veteran
Veteran
Joined
Oct 28, 2015
Messages
30
Reaction score
5
First Language
Russian
Primarily Uses
Ow, it's true... thought only problem with name was double ".js" in the end that made it fail to load even in editor. I see now. Thank you.
 

Roguedeus

It's never too late to procrastinate...
Veteran
Joined
Mar 19, 2013
Messages
532
Reaction score
107
First Language
English
Primarily Uses
N/A
Last edited by a moderator:

gamerxp

Veteran
Veteran
Joined
Oct 28, 2015
Messages
30
Reaction score
5
First Language
Russian
Primarily Uses
Renaming helped me, but...

https://gyazo.com/d40ab87bf8367ba924c475dc5916fc54

I get this when I try to move with some event configurations.

For example, I get it when I got event on the map that does not have unconditional page - no matter is it's sensor or not.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

This is Krizzirk Toeuia Aeslan, I'm picking up transmission. Draftwingeds on, duty on, exhaust ready.
Ami
i wonder what system tab 2?
Rpg MZ looking good! Not much of a fan of the graphics for world tiles, but love the changes for sprites and movement preview!
Before I am done with even one game, I am going to need Psychiatric assistance after doing all these sprites!
Still I am improving, Spriting not mental fortitude.
It's still early days, and I was going to keep this under wraps until development is a bit further along, but I'm just so damn proud of how robust the integrity-checking in this plugin is that I have to share it.

Forum statistics

Threads
99,267
Messages
963,687
Members
130,866
Latest member
minminmin
Top