No method error in battle

I'm not sure this has been reported before, and I think it might be my computer, but....

well... every now and then, out of nowhere, the script will break itself, and whenever I get into a battle, it will start, and then once the command window happens, it will come up with an error saying

Script 'Window_Base' line 373: NoMethodError occurred

undefined method `%' for nil:NilClass

so... I've commented that out, but, obviously that makes my battle icons go away... I kinda like to have my battle icons present and not have the player guess at what they're selecting.
I have split this out of Unofficial Bugs and put it into its own thread, as it is not a bug with the engine, but with one of the scripts you have added to it.

Can you state what battle scripts you have added, and provide a link to where you originally downloaded them?

Don't comment something out to get rid of an error, if you don't know what's caused the error.  Chances are, something else a bit further down is going to break instead.  Better to find out what's causing it and fix it properly 🙂

mmm ... that line is trying to draw an icon.  I bet you've got a custom script but you haven't set up the options for it properly - the icon index hasn't been set correctly.  Which part of the script depends on what the NEXT menu is that it's trying to draw - what "command" window has it already shown?  There's a Party Command, and an Actor Command.
I've found that this often occurs due to non-icon related reasons, like your window is too small or something.
This is the method in question:

Code:
 def draw_icon(icon_index, x, y, enabled = true)    bitmap = Cache.system("Iconset")    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)  end
and line 373 is
Code:
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
So undefined method `%' for nil:NilClass is saying icon_index is nil. Isn't it?
Yes I have the same problem too except it is when I try to equip something...It looks like that yes
Yes I have the same problem too except it is when I try to equip something...It looks like that yes
I suggest you make your own topic then, because this error depends on the scripts in the project, which means the solution is different for every project. And that means that a solution given here is almost certainly wrong in your case - which is why yiu should make a new topic with your project data.
The error can also happen if you load an old savegame after adding scripts or exchanging basic data of the engine.
Since the OP has never come back to say whether the problem was resolved, and this thread is more than 30 days old, I'll go ahead and close it. Always better, as Andar says, to create a new thread for your issues.

Original thread: https://forums.rpgmakerweb.com/threads/no-method-error-in-battle.21385/