Main Menu
  • Welcome to The RPG Maker Resource Kit.

max level status screen error

Started by Geokoer, May 14, 2012, 10:58:34 AM

0 Members and 1 Guest are viewing this topic.

Geokoer

upon using this scriptby dartdaman (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
My project:

D&P3

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.
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

mobychan

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




D&P3

I just figured that out.

You beat me to it :(
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

mobychan

Oh, I'm sorry ^^''
Just saw it, looked and it and thought I'd inform you about it XD




D&P3

Don't be sorry. I meant that as in
"Oh damn, I was too late" :P

But thanks for the info ^-^
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

Geokoer

You people are wizards. Thank you so much! Cookies go to you.

~ Geoff
My project: