MZ Random Battle Events Doubt. Do Events Lag the game?

Hi! so I've been using the normal random encounter system of the engine on terrain tags, but I wanted to try and make the floor you step on have a little "stepped in" animation when player steps in it, and looking around I saw you can make it by making the grass or floor an event using variables to make "battle commands" act like "random encounters" so I was just wondering if having lots of these copypasted events on a different maps (let's say 50-100 on a big map) would cause lag and performance issues and if I should just stick to the normal way of making random encounters.

I wanted to consult it with you guys as even though these wouldn't be set to parallel or autorun (the ones according to the internet, would indeed lag a lot the game) and they would be activated with touching the player, if they could still lag the game just for the sake of being sooo many of them copypasted on many maps (30?).

Thanks a mil!
Having 30 events with no graphic that are touch triggered will not lag your game, however, I'm fairly sure there are more elegant ways to go about this than spamming events on the floor.
Having 30 events with no graphic that are touch triggered will not lag your game, however, I'm fairly sure there are more elegant ways to go about this than spamming events on the floor.
Well they would indeed have a graphic, so when the player steps in the grass it changes to the "stepped in" graphic, would that make it lag?

Before this I tried making so an animation (of grass moving or dust) played on top of the player when he touched the terrain tag of the random encounters, but when the player ran on it, it ended up not looking very good, so I was looking for other options ^^
You could use the same formula from the RPG Maker API functions to recreate the entire system with events and then animate it however you like.

Maybe I'll find time to do this over the weekend, or simply create a plugin that lets you call a Common Event when starting a random encounter battle.
Well they would indeed have a graphic, so when the player steps in the grass it changes to the "stepped in" graphic, would that make it lag?

Before this I tried making so an animation (of grass moving or dust) played on top of the player when he touched the terrain tag of the random encounters, but when the player ran on it, it ended up not looking very good, so I was looking for other options ^^
That would just be one event changing the graphic. The point is that only one event would ever process anything at the same time (the one stepped in), there fore no lag.

But looks like you might get some free code from @Dev_With_Coffee
I believe that the following (in no particular order) are more likely to cause games to slow down:

  • Light plugins, if you are not economical when using their features. For instance, if you have 2 windows in a dark room next to each other, have just one be a light source.
  • Animations, if used excessively. (You should be able to have a lot on a map without problems.)
  • Parallel events that are badly designed, for instance, no "Wait" command, or doing a lot of un-necessary things.
  • Lots of big graphics changes during play.

Others may disagreed, or have more to add.
I guess I didn't even think about it that day, so I apologize.
This could easily be done through events using Javascript to check if the player is moving. In this example, you can simply see that the player will play footstep sounds while moving.
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Play SE:Move1 (90, 150, 0)
  ◆Wait:30 frames
  ◆
:End

So by recording the terrain tag with Javascript in a variable you can create different animations for different situations:
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆If:#0015 = 1
    ◆
  :End
  ◆If:#0015 = 2
    ◆
  :End
  ◆If:#0015 = 3
    ◆
  :End
  ◆
:End

If the animation is a map event you can call it for the player's position like this:
Code:
◆Control Variables:#0013 = Map X of Player
◆Control Variables:#0014 = Map Y of Player
◆Set Event Location:EV TERRAIN, ({#0013},{#0014})

It would probably look like this, and each event page would be called by the Variable that checks the Terrain Tag
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆Control Variables:#0013 = Map X of Player
  ◆Control Variables:#0014 = Map Y of Player
  ◆Set Event Location:EV TERRAIN, ({#0013},{#0014})
  ◆
:End
I guess I didn't even think about it that day, so I apologize.
This could easily be done through events using Javascript to check if the player is moving. In this example, you can simply see that the player will play footstep sounds while moving.
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Play SE:Move1 (90, 150, 0)
  ◆Wait:30 frames
  ◆
:End

So by recording the terrain tag with Javascript in a variable you can create different animations for different situations:
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆If:#0015 = 1
    ◆
  :End
  ◆If:#0015 = 2
    ◆
  :End
  ◆If:#0015 = 3
    ◆
  :End
  ◆
:End

If the animation is a map event you can call it for the player's position like this:
Code:
◆Control Variables:#0013 = Map X of Player
◆Control Variables:#0014 = Map Y of Player
◆Set Event Location:EV TERRAIN, ({#0013},{#0014})

It would probably look like this, and each event page would be called by the Variable that checks the Terrain Tag
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆Control Variables:#0013 = Map X of Player
  ◆Control Variables:#0014 = Map Y of Player
  ◆Set Event Location:EVSX001, ({#0013},{#0014})
  ◆
:End
Wow that is amazing!!! thanks a million! I'll try it out as soon as I can but it sounds just like the perfect solution! thanks a mil for your time and generosity!! ✨️
I guess I didn't even think about it that day, so I apologize.
This could easily be done through events using Javascript to check if the player is moving. In this example, you can simply see that the player will play footstep sounds while moving.
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Play SE:Move1 (90, 150, 0)
  ◆Wait:30 frames
  ◆
:End

So by recording the terrain tag with Javascript in a variable you can create different animations for different situations:
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆If:#0015 = 1
    ◆
  :End
  ◆If:#0015 = 2
    ◆
  :End
  ◆If:#0015 = 3
    ◆
  :End
  ◆
:End

If the animation is a map event you can call it for the player's position like this:
Code:
◆Control Variables:#0013 = Map X of Player
◆Control Variables:#0014 = Map Y of Player
◆Set Event Location:EV TERRAIN, ({#0013},{#0014})

It would probably look like this, and each event page would be called by the Variable that checks the Terrain Tag
Code:
◆If:Script:$gamePlayer.isMoving()
  ◆Control Variables:#0015 = $gamePlayer.terrainTag()
  ◆Control Variables:#0013 = Map X of Player
  ◆Control Variables:#0014 = Map Y of Player
  ◆Set Event Location:EV TERRAIN, ({#0013},{#0014})
  ◆
:End
It worked like a charm! and also thank you everyone for all the info on what lags or not the game!, thanks a mil!

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/random-battle-events-doubt-do-events-lag-the-game.180365/