[RMXP] HELP NEEDED WITH CMS SCRIPT

Posts

Pages: 1
Hello, I am using a One-Man CMS script, and there is a crashing issue that I can't seem to figure out how to fix. When you hit the max level, for example 99, when you open the menu the game crashes with an error on line 266: RangeError occurred float -1.#IND out of range of integer.

Here's a link to the script also:
One-Man CMS

Any help or potential solution to this problem would be GREATLY appreciated! Thanks!
Hello Nansensu,

I've read through the script. It appear that the error happens because at level 99, line 333,
draw_actor_barz(@actor, 190, 15 + 127, "horizontal", 168, 1, @actor.now_exp.to_f, @actor.next_exp, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))
, will cause error, since @actor.now_exp.to_f and @actor.next_exp will be 0, and in the method draw_actor_barz, there is a division involving the two, which causes error since the code freaks out when 0/0.


So to solve the problem, you can replace the line 333 with (copy/paste the whole thing in blue text below):


# fix for max level
a = @actor.now_exp == 0 ? 1 : @actor.now_exp
b = @actor.next_exp == 0 ? 1 : @actor.next_exp
draw_actor_barz(@actor, 190, 15 + 127, "horizontal", 168, 1, a, b, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))
# this is the original line 333
#draw_actor_barz(@actor, 190, 15 + 127, "horizontal", 168, 1, @actor.now_exp.to_f, @actor.next_exp, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))


Hope it helps.
Pages: 1