Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Actor's Linear Growth, Bye bye, Levels!
Jens of Zanicuud
post Dec 15 2011, 12:06 PM
Post #1


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




EXP Linear Growth

Author: Jens of Zanicuud
Version: 1.2
Released on: 15 Dec 2011
Terms of use: Free use, just credit; for commercial use, you have to ask for permission.
Customization: Free, just link the mod version in this topic...
FAQ or help: Feel free to ask for everything.
Installation: Just insert the script in a blank above Main.

Ok, second update...
Actor's linear growth.

What does it mean?
Actually, it's not such difficult to explain...

For each level, a standard amount of EXP is needed (e.g. 500), but this is not like there are levels.
It's only a curve-stepness coefficient, you know, the y/x value...
This is set by the variable EXP_PER_LEVEL.
This is a gradual-increasing-stats system.
The total exp required to reach max stats (i.e. Level 99 stats) is equal to 98*EXP_PER_LEVEL (e.g. 49500 in this case)

For example, if your character has 495 EXP, his/her stats would be

Level 1 Stats + 495/49500*(Level 99 stas - Level 1 stats)

that is

Base Stats + 1%*(Final Stats - Base Stats)

In practice, your character will keep on growing without jumps from level to level, in a continuous increase.

I hope this explaination could be useful and so... there's the script!

CODE
#==============================================================================
# ** New exp system:
# -by Jens of Zanicuud, version 1.1
# -free use for non commercial use, just credit.
# -you can find me on www.rpgrevolution.com
#------------------------------------------------------------------------------
#  Linear growth: levels are replaced by a gradual increase in statistics
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

EXP_PER_LEVEL = 500   #Set the linear rate of growth. Every level needs the
                      #same amount of EXP to be reached.

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------
  # * make_exp_list
  #--------------------------------------------------------------------------
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    @exp_list[100] = 0
    for i in 2...100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        @exp_list[i] = EXP_PER_LEVEL*(i-1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def maxexp
    return EXP_PER_LEVEL*98.to_f
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def base_maxhp
    step = $data_actors[@actor_id].parameters[0, 99] - $data_actors[@actor_id].parameters[0, 1]
    return ($data_actors[@actor_id].parameters[0, 1] + step*@exp.to_f/maxexp).to_i
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum SP
  #--------------------------------------------------------------------------
  def base_maxsp
   step = $data_actors[@actor_id].parameters[1, 99] - $data_actors[@actor_id].parameters[1, 1]
   return ($data_actors[@actor_id].parameters[1, 1] + step*@exp.to_f/maxexp).to_i
  end
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  def base_str
    step = $data_actors[@actor_id].parameters[2, 99] - $data_actors[@actor_id].parameters[2, 1]
    n = ($data_actors[@actor_id].parameters[2, 1] + step*@exp.to_f/maxexp).to_i
    weapon = $data_weapons[@weapon_id]
    #weapon2 = $data_weapons[@weapon2_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon   != nil ? weapon.str_plus  : 0
    n += armor1   != nil ? armor1.str_plus  : 0
    n += armor2   != nil ? armor2.str_plus  : 0
    n += armor3   != nil ? armor3.str_plus  : 0
    n += armor4   != nil ? armor4.str_plus  : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Dexterity
  #--------------------------------------------------------------------------
  def base_dex
    step = $data_actors[@actor_id].parameters[3, 99] - $data_actors[@actor_id].parameters[3, 1]
    n = ($data_actors[@actor_id].parameters[3, 1] + step*@exp.to_f/maxexp).to_i
    weapon = $data_weapons[@weapon_id]
    #weapon2 = $data_weapons[@weapon2_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon   != nil ? weapon.dex_plus  : 0
    n += armor1   != nil ? armor1.dex_plus  : 0
    n += armor2   != nil ? armor2.dex_plus  : 0
    n += armor3   != nil ? armor3.dex_plus  : 0
    n += armor4   != nil ? armor4.dex_plus  : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  def base_agi
    step = $data_actors[@actor_id].parameters[4, 99] - $data_actors[@actor_id].parameters[4, 1]
    n = ($data_actors[@actor_id].parameters[4, 1] + step*@exp.to_f/maxexp).to_i
    weapon = $data_weapons[@weapon_id]
    #weapon2 = $data_weapons[@weapon2_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon   != nil ? weapon.agi_plus  : 0
    n += armor1   != nil ? armor1.agi_plus  : 0
    n += armor2   != nil ? armor2.agi_plus  : 0
    n += armor3   != nil ? armor3.agi_plus  : 0
    n += armor4   != nil ? armor4.agi_plus  : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  def base_int
    step = $data_actors[@actor_id].parameters[5, 99] - $data_actors[@actor_id].parameters[5, 1]
    n = ($data_actors[@actor_id].parameters[5, 1] + step*@exp.to_f/maxexp).to_i
    weapon = $data_weapons[@weapon_id]
    #weapon2 = $data_weapons[@weapon2_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon   != nil ? weapon.int_plus  : 0
    n += armor1   != nil ? armor1.int_plus  : 0
    n += armor2   != nil ? armor2.int_plus  : 0
    n += armor3   != nil ? armor3.int_plus  : 0
    n += armor4   != nil ? armor4.int_plus  : 0
    return [[n, 1].max, 999].min
  end
  
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  def exp_s
    str_exp = (@exp/maxexp*100).to_s
    str_exp = str_exp[0,4]
    str_exp += " % "
    return str_exp
  end
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, maxexp.to_i].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end


Ask me anytime for any problem and any doubt...
See you next update!

Jens



__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

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: 25th May 2013 - 09:33 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker