[RMXP] Battle text lag?

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
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.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
563
Reaction score
274
First Language
German
Primarily Uses
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:
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.
 
Last edited:

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
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.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
563
Reaction score
274
First Language
German
Primarily Uses
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. :)
 

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
This one gives me a different error message.

antiBL.PNG
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
563
Reaction score
274
First Language
German
Primarily Uses
Uh... Now that's getting embarrassing. Not much room for more of these though, I think?
Fixed, and Sorry for not testing this.
 

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
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
 

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
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.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
563
Reaction score
274
First Language
German
Primarily Uses
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.
 

MollyAvast

Villager
Member
Joined
Jun 12, 2018
Messages
18
Reaction score
6
First Language
English
Primarily Uses
RMXP
Alrighty, that seemed to do it! Thank you again!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

This site have great assets for RPG Maker: https://kokororeflections.com/

There are modern resource too.
Check it out!
"How dare you!" is probably the most overused reason to start conflict.
Another day of mostly mapping in Make a Game in RPG Maker MZ: Episode 7 starting now! We're making a mansion! Come watch live and join in on the chat!
Game=Forest, Feature=Tree. There's little worth in looking at a tree except in its relation to how it affects the feel of the forest.
Been a while, guys. Despite being in college now, I'm working on Season's Promise as often as I can.

Forum statistics

Threads
104,587
Messages
1,007,350
Members
136,063
Latest member
Saydas
Top