Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> [SOLVED] Cap level, Block level and exp
Chaos17
post Jun 9 2012, 08:58 AM
Post #1


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Beginner




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


This post has been edited by Chaos17: Jun 9 2012, 09:47 AM


__________________________
Go to the top of the page
 
+Quote Post
   



Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 02:13 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker