Always update off-screen events

Hi everyone,


Not a bug, but disrupts gameplay!
This is actually something that happened to me when I used to work with RPG Ace. That time I was helped by another rpg community who made a few lines of code to "fix" (change) parameters of the game.



UPDATE: A friend helped me in the comments and refreshed my memory about the Anti Lag script for RPG Ace (Here I found Victor's, very similar to what I need: link )


I like creating puzzle games that not necessarily uses RPG features like battles or equipments. So my focus is always on the map and how things work (move) on it.


So what I want for the Plugin?
All events tagged with <update> (Just an example of how it could work) should be working even if it's out of the screen. By default, RPG Maker only start an event content or custom route when it's on screen (or very close). This may be intencional, because avoids to much work for the hardware and process to deal with.



It's the same idea as Ace's Anti-Lag script! https://victorenginescripts.wordpress.com/rpg-maker-vx-ace/anti-lag/


Why this will help me?
In one of my puzzles, guards have custom route set and should start their movement as early as possible so all guards can cover places of the map in the right timing. Otherwise the level gets to easy or to hard to be acomplished because depends on where the player have passed or is standing.



In another example, objects that have synchronized movements end up getting misaligned and disrupting a gameplay or even preventing the continuity of the game.
fd4a06af92.jpg



Obs.: When using big maps, the screen will "reveals" the nearest rocks movements while the farthest remain frozen. Setting all the rocks to be always updating could solve the problem!


Is it possible?


This seems to be something very useful and I didn't found anything for MV yet. That makes me think that maybe is kinda complex to do it, but I'll let you scripters tell me that! :x


Can someone help me?


Thankss!
 
I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.
I suggest you modify that request to work in the same way as the solution used by Ace' anti-lag-scripts, because otherwise it will cause too much lag in games.


The key here is that the makers (Ace same as MV) have a "operation distance" to decide when to move an event and when not (it's actually a bit larger than the screen, but not full map). If you change that number to a larger one (or eliminate the filter completely), then everything will affect the lag.


The better anti-lag scripts in Ace not only gave that number a custom value, but also added a filter to allow events to be excepted from that filter.


Using that, you would place those notetags on the boulder events, making them always move without making every decorative event on the entire map doing the same.


That solution is a bit more complex than simply changing the execution range to the entire map, but better in the long run.
I suggest you modify that request to work in the same way as the solution used by Ace' anti-lag-scripts, because otherwise it will cause too much lag in games.


The key here is that the makers (Ace same as MV) have a "operation distance" to decide when to move an event and when not (it's actually a bit larger than the screen, but not full map). If you change that number to a larger one (or eliminate the filter completely), then everything will affect the lag.


The better anti-lag scripts in Ace not only gave that number a custom value, but also added a filter to allow events to be excepted from that filter.


Using that, you would place those notetags on the boulder events, making them always move without making every decorative event on the entire map doing the same.


That solution is a bit more complex than simply changing the execution range to the entire map, but better in the long run.



Oh I see..so you saying that I should request a look alike script used by Ace to correct the lag problems? This is actually a very smart idea!


Thanks for your support!
I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

Sorry! I really thought I was on the right place. I'll pay more attention next time! :')
@Diguito, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Also, you don't need to quote an entire post to answer - do that only if you want to reply to specific points.


In the normal cases, the @username convention like I used above is better.


As for your questions - the anti-lag scripts where just a reference, you should not copy them to MV because MV has some places where it works differently on purpose (has to do with enabling web functionality). The better way would be to work from the other side - request a script that allows tagged events to be always executed (to excempt them from the stop filter) as that would be a lot easier and has less chance of causing problems with the game loop.
@Andar Oh sh**! New here '🙂  


Got it! And done!


Thank you!
Yanfly has just released a new plugin.


Move route core.


"These are some notetags you can utilize for your events.


Event Notetags:


<Always Update Movement>



– Most events don’t update unless they’re close to the screen. But any event with this notetag will always be updating regardless of whether they are close to the screen or not."


If this is useful to you.
Try this.  I haven't tested it, so if you get an error, please grab a screenshot of the console log (F8 when the error occurs, and go to the Console tab):


Save it as a new file in your plugins folder.  Extension needs to be .js but the file name doesn't matter.  Then add it to your plugin manager.

Code:
//============================================================================
// OffScreen Movement
// by Shaz
// Last Update: 2017.01.22
//============================================================================

/*:
 * @plugindesc Allows events to be flagged to continue moving when out of range
 * @author Shaz
 *
 * @help This plugin has no plugin commands
 * 
 * Put <UpdateOffscreen> into an event's note box (beside the name box) to
 * make it update its position even when it's out of the anti-lag range
 *
 */
 
(function() {
  var _Game_Event_isNearThePlayer = Game_Event.prototype.isNearThePlayer;
  Game_Event.prototype.isNearThePlayer = function() {
    if (this.event().meta.UpdateOffscreen) {
      return true;
    } else {
      return _Game_Event_isNearThePlayer.call(this);
    }
  };
  
  Game_Event.prototype.isNearTheScreen = function() {
    if (this.event().meta.UpdateOffscreen) {
      return true;
    } else {
      return Game_CharacterBase.prototype.isNearTheScreen.call(this);
    }
  };
})();
@Harken_W I will certainly try this, and maybe use some other features from the plugin. Thanks <3


@Shaz  I got an error! https://uploaddeimagens.com.br/imagens/error-rpgmv-png Btw, a guy helped me in another community with this plugin: https://dl.dropboxusercontent.com/u/84016784/Plugins/KG%20-%20Update%20Off-Screen%20Events.js.  It's in portuguese but it works fine and using <update> tag. Take a look, see if there's anything to improve or customize! Thank you man!! <3
I've made a small fix to the script.  Give it a go now, if you're still interested in trying it as a solution.
@Shaz It's perfect now! Working! Thank you 
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/always-update-off-screen-events.73797/