[RMXP] Battle text lag?

I've been working on a game for a few years now and everything has been fine framerate-wise up until this point. I wouldn't expect RMXP to be a very demanding program, after all- and even if it was, I doubt I would have trouble with it.

I don't seem to have any framerate issues anywhere except for battles, and only when the game is displaying text. My game has a lot of dialogue in-battle, and again I never had any problems with it in the past, but recently it has been slowing down significantly while trying to display text (and I haven't done anything differently, as far as I know.) This also applies to text events that I have already written and that previously worked without lag.

I'm on a dedicated gaming PC that can run Oculus Rift software and games, so I definitely don't think that's the issue. If it's not my computer, then that definitely means I need to get this sorted out because others will likely experience it, too. I've looked into anti-lag scripts but they all seem to be focused on fixing map lag, not battle lag, or more specifically battle text.

If anyone has any advice, it would be appreciated.
Hey there,

The standard XP battle system has the issue that while an event is running, the actor status is constantly redrawn without necessity (contains HP/SP/status etc. of your party which may change during an event, but the game does not actually check for that). This is a relatively time consuming process and can lead to lags while the event is running.

While not a perfect solution you could try this script:
Spoiler
Code:
class Window_BattleStatus
 
  alias_method(:refresh_ILC_checkForNecessity, :refresh)
  def refresh
    if need_refresh?
      @last_status = current_status
      refresh_ILC_checkForNecessity
    end
  end
 
  def need_refresh?
    @last_status != current_status
  end
 
  # Change this method to include relevant properties for the refresh method:
  def current_status
    actors = $game_party.actors
    properties = [:hp, :sp, :maxhp, :maxsp, :name, :states].map { |property|
      actors.map { |actor|
        value = actor.send(property)
        next value.is_a?(Numeric) ? value : value.clone
      }
    }
    return [actors.clone, @level_up_flags] + properties
  end
end
This script works by blocking calls for refreshing the status window if nothing of your parties status has changed. The downside is that if you are using a custom status window that displays additional properties (like TP or something) you may have to update this script.
On the other hand this does not replace Scene_Battle's update method which should hopefully make it more compatible with other battle system scripts.

Someone might be able to come up with a better solution here though.
Hi, thank you for your help, but I'm having a little bit of trouble with this script. Am I meant to simply insert it above Main like other scripts? If so, I'm getting the following error message:

antiBL.PNG


I don't have any scripts that modify the status window, as far as I know. The only scripts I have that are related to the battle system are scripts for displaying extra animations when a critical attack is dealt, changing the font and colour of damage numbers, and disabling enemy critical hits.
Woops. Don't have the RMXP installed right now, so I have to admit I haven't tested this beforehand.
This was an error on my end, (hopefully) fixed the script above. 🙂
This one gives me a different error message.

antiBL.PNG
Uh... Now that's getting embarrassing. Not much room for more of these though, I think?
Fixed, and Sorry for not testing this.
Please, don't worry! These things happen.
That said, this one didn't give me any errors, and it seems to have fixed the problem! Thank you very much! <3
Well, it seems I spoke too soon.

The lag problem is fixed, but the script seems to have created another problem: my actors can no longer take damage. They can take a hit, and damage numbers will be displayed, but their HP does not decrease.
Uh, made another error while fixing one of the problems. Fixed the script once again, will definitely look through it more carefully when I have time.
The issue is only cosmetic though, the damage is there, the update in the status window was just wrongfully blocked.
Alrighty, that seemed to do it! Thank you again!

Original thread: https://forums.rpgmakerweb.com/threads/rmxp-battle-text-lag.111312/