Notice: fwrite(): Write of 483 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 59 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 1714 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 8192 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - max level status screen error

The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Geokoer on May 14, 2012, 10:58:34 AM

Title: max level status screen error
Post by: Geokoer on May 14, 2012, 10:58:34 AM
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
Title: Re: max level status screen error
Post by: D&P3 on May 14, 2012, 11:40:38 AM
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.
Title: Re: max level status screen error
Post by: mobychan on May 14, 2012, 11:51:37 AM
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
Title: Re: max level status screen error
Post by: D&P3 on May 14, 2012, 11:54:08 AM
I just figured that out.

You beat me to it :(
Title: Re: max level status screen error
Post by: mobychan on May 14, 2012, 11:56:07 AM
Oh, I'm sorry ^^''
Just saw it, looked and it and thought I'd inform you about it XD
Title: Re: max level status screen error
Post by: D&P3 on May 14, 2012, 12:04:27 PM
Don't be sorry. I meant that as in
"Oh damn, I was too late" :P

But thanks for the info ^-^
Title: Re: max level status screen error
Post by: Geokoer on May 16, 2012, 12:47:55 AM
You people are wizards. Thank you so much! Cookies go to you.

~ Geoff