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
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
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
#
# 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