upon using this scriptby dartdaman (http://rmrk.net/index.php/topic,43879.msg498396.html#msg498396 (http://rmrk.net/index.php/topic,43879.msg498396.html#msg498396)) for my status screen, I came across a little snag.
Seems that - when a character's at maximum level, an error occurs:
"Script line 96: ZeroDivissionError occured, divided by 0."
I like using a picture in the status screen, but I wouldn't want to rob the player of my game from reaching maximum level - and getting this error. Any ideas?
~ Geoff
Between line 95 and 101 you should see this
def draw_actor_exp_gauge(actor, x, y, width = 120)
gw = width * actor.bar_now_exp / actor.bar_next_exp
gc1 = exp_gauge_color1
gc2 = exp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
Replace that with this:
def draw_actor_exp_gauge(actor, x, y, width = 120)
if @actor.level <= 98
gw = width * actor.bar_now_exp / actor.bar_next_exp
else
gw = width * actor.bar_now_exp
end
gc1 = exp_gauge_color1
gc2 = exp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
All that will do is prevent the error. But if you want the gauge to display exp at max or something, you'll need to ask for that, I'm not familiar enough with RGSS to figure out how to do that.
To display the gauge full when at max level you only need to specify the width used in gradient_fill_rect as the width of the full gauge ^^
def draw_actor_exp_gauge(actor, x, y, width = 120)
if @actor.level <= 98
gw = width * actor.bar_now_exp / actor.bar_next_exp
else
gw = width
end
gc1 = exp_gauge_color1
gc2 = exp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
I just figured that out.
You beat me to it :(
Oh, I'm sorry ^^''
Just saw it, looked and it and thought I'd inform you about it XD
Don't be sorry. I meant that as in
"Oh damn, I was too late" :P
But thanks for the info ^-^
You people are wizards. Thank you so much! Cookies go to you.
~ Geoff