Help - Search - Members - Calendar
Full Version: [SOLVED] Cap level
RPG RPG Revolution Forums > Game Engines > RPG Maker VX Ace Discussion
Chaos17
Hello,

I've found this script to setup a level cap through a variable.
CODE
Idvariableslevel = #Numéro de la variable qui contient le niveau max.
class Game_Actor < Game_Battler
def max_level
return $game_variables[Idvariableslevel]
end
end


It works well but I've a problem.
The script doesn't stop my hero to gain exp after he reached the max level.
So the player can bank exp until the max level is unlocked.
I can't allow the player to gain 10 levels at once just because I allowed him to stock exp.

Someone suggested me a solution but the problem with this new code is that it prevent my hero to gain exp before reaching max level and I want it to do the contratry : block exp after max level is reached.

CODE
class Game_Actor < Game_Battler
alias lcap_change_exp change_exp
def change_exp(exp, show)
            return if max_level?
            lcap_change_exp
  end
end


EDIT : Problem Solved
CODE
################################################################################
#
#        Niveau Maximum des héros d'après le contenue d'une variable.
#
#-------------------------------------------------------------------------------
#--- Version 1.0 du 18 mars 2012
#--- Réalisé par Jean Monos
#--- Pour Rpg Maker Vx Ace
#--- Distribution / modification autorisé sans autorisation
#-------------------------------------------------------------------------------
# Credits : Monos, Kaila, Yami, Trihan and mobychan - created and fixed a bug with cap level script.

Idvariableslevel = 002 #Numéro de la variable qui contient le niveau max.
class Game_Actor < Game_Battler
  def max_level
    return $game_variables[Idvariableslevel]
  end
end

class Game_Actor < Game_Battler
  alias lcap_change_exp change_exp
  def change_exp(exp, show)
    if self.level < max_level
      lcap_change_exp(exp, show)
    end
  end
end
Tsukihime
Not really sure what the difference between this script and the one you tried to write.
LostSamurai
I'm glad you solved your problem. I would also like to point out the humor in the fact that there are five people credited for a script which is only 14 lines of code.
Chaos17
QUOTE
Not really sure what the difference between this script and the one you tried to write.

The main the difference is in the second code.
Original lines which were the cause of my troubles
CODE
        return if max_level?
        lcap_change_exp

Were changed into these
CODE
    if self.level < max_level
      lcap_change_exp(exp, show)

QUOTE
I'm glad you solved your problem. I would also like to point out the humor in the fact that there are five people credited for a script which is only 14 lines of code.

That wasn't a point of humour from me. tongue.gif
The first two person are the creators, the other 3 people did :
Yami > found out what to code to help me but unfortunally his script had a major flaw
Trihan > found out what to correct in Yami script but he also had a flaw
mobychan > corrected the flaw that Trijhan had.

Each person brought their stone to the edifice smile.gif
So I am very thankfull to all these people that took their time to help me.
amerk
Glad you solved your issue, but it does lead to a more interesting idea... being able to bank EXP. Imagine if you could bank all your EXP and then you can delegate it out to all your party members however way you want in order to help some earn higher or lower levels than others.

In any case, sorry to have gone off topic.
Tsukihime
exp bank would be interesting, but the amount of effort required to balance it would probably be crazy.
For example, instead of distributing my exp, I just power-up one girl to lv 50 when the expected average party level was 20 lol.
Shadyone
For this exp bank idea, you could have it so you can't raise party members above a certain level during that part of the game or until you 'unlock' more levels.
Tsukihime
"Average party level" I guess.
vvalkingman
Post is off topic but I'd like to throw out this little idea for exp bank:

Instead of average chracter level dictating how high other characters can level, just have it so the other characters can't level up higher then the character with the highest level. Something I've run into is that if you use "excess experience points" to level other characters then couldn't you de-level if you give away too many? My suggestion is that you use another variable/currency as "banked experience", perhaps it's gathered at a reduced rate from normal experience and can be used to level any character.

The mmo Shattered Galaxy used a similar idea of banked experience, where the experience your subordinate(mentor/subordinate system) gathered increased a pool of points that the mentor could use to increase the level of HIS units. At a reduced rate of 20% the subordinates gathered experience, of course.

Ex. Subordinate gained 10,000 experience points from battling; the mentor would have 2,000 experience points added to a pool of experience points which they could use on their units thanks to that subordinate.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.