Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: askiplop on June 15, 2010, 06:05:24 pm

Title: [SOLVED] (Tks to Sacred Nym) [RMVX] Get current EXP and MaxEXP for this level
Post by: askiplop on June 15, 2010, 06:05:24 pm
Hello!

It's me, again!

I wonder how to get the crrent EXP and the MaxEXP for the current level for actor 1, because i want to show a bar on the screen with the % of the EXP for the next level.

In the Control Variables window, i only get the current EXP points.

Is it possible?

Many thanks for any help!

Have a nice day!
Askiplop

Thanks?
Title: Re: [RMVX] Get current EXP and MaxEXP for this level
Post by: Sacred Nym on June 15, 2010, 06:38:47 pm
First, throw this little snippet into your script editor under Materials.

class Game_Actor
  def next_exp_i
    return @exp_list[@level+1]
  end
  def next_rest_exp_i
    return (@exp_list[@level+1] - @exp)
  end
end


Then you can use one of two call scripts:

$game_variables[VARIABLE_ID] =
$game_actors[ACTOR_ID].next_exp_i


Which will store the TOTAL experience the actor needs for the next level (from 0 EXP). Or...

$game_variables[VARIABLE_ID] =
$game_actors[ACTOR_ID].next_rest_exp_i


which will store the amount the actor still needs before level up.
Title: Re: [RMVX] Get current EXP and MaxEXP for this level
Post by: askiplop on June 15, 2010, 08:07:38 pm
Thank you VERY much for your help Sacred Nym, i'll try it in a couple of minutes ;)
Title: Re: [SOLVED] (Tks to Sacred Nym) [RMVX] Get current EXP and MaxEXP for this level
Post by: askiplop on June 15, 2010, 11:30:34 pm
Work like a charm! Thank you so much! :)