When OK is pressed... Disable hold

Now if you have so many events in the map, this would be super clunky to write that it will better to shorten it up with script calls that will loop thru all events in the map.



To write a script that run the same code for each event, you can do something like this (example below)

Code:
for (i = 1; i < $gameMap._events.length; i++){
 console.log($gameMap._events[i]._x); // Read X position of event i
 console.log($gameMap._events[i]._y); // Read Y position of event i 
}
Hi Crabs!


but where do I ctrl+v this code? Do I have to change some information in some lines?


Thank you!
Ah, sorry, it was just an example to show how to access all event data in the map with scripts.


And I just figured that there's a plugin which will solve your issue.


http://yanfly.moe/2015/10/19/yep-17-region-events/
It's a very very very nice plugin!! I will use this for sure in my RPG! This plugin gives a lot of possibilities!


But use this in the action system that I'm doing, I think it won't be good. it's better use a parallel process, because the event will walk through the map. And the region event is


limited.


Thank you very much!
@Crabs - yeah, region events wont work for him cause what he is doing is an event that should capture the press of a button, region events is basically a plugin that allows you to activate a CE once you step on the region from the outside. BTW thanks for the code XD  


So you should be having something like this:


Conditional Branch: if Input.isTriggered(ok)


  Change Variables: Player X = Player's Map X


  Change Variables: Player Y = Player's Map Y


  Script Call: for (i = 1; i < $gameMap._events.length; i++){


                          $gameVariables.setValue(Event X Variable ID, $gameMap._events._x);


                          $gameVariables.setValue(Event Y Variable ID, $gameMap._events._y); 


  //


  Put your if Player is facing ifs here


  //


  Script call: } //Do not forget this


End


Wait some frame //Add a few frame of wait just so this doesn't run every update, to save some processing power


 


Take note though that you might want to add some more check for the events to be included coz right now this will check ALL events in your map.
I couldn't understand very well. But it seems to be the same of the event thing.


I thought that using script, I wouldn't need create variables for every enemi event anymore. But if I'm not wrong, this "variable ID" has to be renamed for every event


enemi. I'm correct?                     $gameVariables.setValue(Event X Variable ID, $gameMap._events._x); 


Why it's better use script instead of events?


Thank you and sorry if I'm doing stupid questions!
Why it's better use script instead of events?



Uhm, you will use it inside the parallel process event... You place the "script" parts using the Script Event Command, then everything else are just your basic Event Commands.


Basically, what it does is it checks EVERY EVENT on the map, it will only use those two variables for all events (one for Enemy X, and one for Enemy Y) to simplify your checking.
I'm sorry, I'm a noob when it's about scripts. I did this, but when I "press ok" a syntax error shows up.

WRONG.png

Original thread: https://forums.rpgmakerweb.com/threads/when-ok-is-pressed-disable-hold.73393/