12-23-2006, 01:00 PM
MMORPG Leveling System
by Lettuce
Version: 1.1
Last update: 23 Dec 06
Introduction
Lettuce's first ever script!<3 :tomato:
This script allows you to increase your actor's stats using points (which is very popular among MMORPGs). An actor can obtain the points though Event(call script) or by leveling. Please note that the points are NOT shared between your party members, each actor have their own points [it wouldn't make sense if Basil levels up and Aluxes can use his points)
Features
Script
You will also need this; it is like a color library. You can also use this for everything else too!
Instructions
To add points to a charactor, use:
replace actorID with the ID of your charactor from the database, and replace Amount with the amount of points you want to add
To add points to a charactor upon levelup:
find this line in Scene_Battle 2:
and add this below it:
Do read the instruction in the script header too.
FAQ
If you want to use this as the main leveling system, go into the database and set str, agi, dex and int to 0 for all of your actors
Compatibility
Should be compatible with everything else
Credits and Thanks
Dubealex: for his tutorials
Leon: layout idea
Author's Notes
Upcoming versions will have:
- confirmation window
- a feature that will change the hp,sp,mdef etc. when you upgrade a stat (like when you put 1 point into STR, you get the atk increase and 1% HP increase)
-Be able to support a party with more than 4 members
-Include player's states and equiped item (this can turn into your new Status scene)
-option to increase HP and SP too?
by Lettuce
Version: 1.1
Last update: 23 Dec 06
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Introduction
Lettuce's first ever script!<3 :tomato:
This script allows you to increase your actor's stats using points (which is very popular among MMORPGs). An actor can obtain the points though Event(call script) or by leveling. Please note that the points are NOT shared between your party members, each actor have their own points [it wouldn't make sense if Basil levels up and Aluxes can use his points)
Features
- Customize the stats of your charactors
- Gain points through events and levelup
- Used as a bonus points in addition to the default leveling system
- Points are not shared between charactors
- Points can effect HP and SP (percentage increase)
- Very customizable <3
Script
The Script
Code:
#------------------------------------------------------------------------------#
# MMORPG Leveling System V1.1
# Author: Lettuce
# Last update: 23 Dec 2006
# Fixed and Added:
# bar used HP information - Fixed
# [Extra effect] Stats can now effect the HP and SP - Added
# Help windows shows the extra effect - Added
#
# Features: Allow your charactor to use points to increase their stats
# Can add points through events
# Can be used as a bonus points in addition to the default level system
# Points are NOT shared between the actors in the party
# Very customizable
# (...that's not alot of feature >_>")
# Instructions:
# - You should change the values in the Config section (just below here) to fit
# your needs
# FONTFACE and FONTSIZE is pretty obvious
# STAT_CAP = The maximum value for str,agi,dex and int that your game allows
# STAT_CAP2 = same as STAT_CAP but this is for pdef, mdef, atk and eva
# Y_OFFSET and X_OFFSET = change value to change the layout (I would leave
# it as it is though)
# INCREASE_BY = this determines how many points (agi,dex etc) will go up
# for each of the points)
#*** $actors_points = this array is for storing the points for each actor, not
# just the ones in your party, but ALL of your actors, so
# if you have 5 actors in the game, there should be 5 zero's
#
# - Press L and R to change between actors
#
# *******Warning! Once you add the points to a stat, it's PERMANENT!*******
#
#** Add points to actors by using call script and use this:
# $actors_points[actorID] += AmountOfPoints
# (replace actorID with the actual ID of the actor,and replace AmountOfPoints
# with a number <3
#
#** If you want to add points when your actor levels, go to Scene_Battle 2 and
# find: if actor.level > last_level
# and paste this just under it: $actors_points[actorID] += AmountOfPoints * (actor.level - last_level)
# (don't forget to change the value ^.^)
#
# most of the stuff are pretty obvious of what it does, so if you are not happy
# about the position/colour etc of things, just change the value there <3
#
#Credits: Dubealex - for his pwnage tutorials
# Leon - I got the layout idea from him <3
# Samamanjaro - for pointing out a bug
#------------------------------------------------------------------------------#
#----- Config.
FONTFACE = "Tahoma" #font used in all the windows
FONTSIZE = 22 #font size
STAT_CAP = 300 #Maximum value for str,agi,dex and int
STAT_CAP2 = 1000 #Maximum value for pdef mdef atk and eva
Y_OFFSET = 10 #incase you want to move some stuff down ^^
X_OFFSET = -80 #incase you want to move stuff across~
INCREASE_BY = 1 #when you spend 1 points, how much do that stat go up
STR_INCREASES = [0,0] #1 point in STR will increase(in %) hp and sp
DEX_INCREASES = [0,0] #for example when STR_INCREASES = [10,5]
AGI_INCREASES = [0,0] #it increases 10% hp and 5% sp for every points you spend in STR
INT_INCREASES = [0,0] #same goes for the other 3 :D
#--- Don't change this line =[] ---
$actors_points = [0,0,0,0,0,0,0,0,0,0] #this thing here stores the points for actors
#----- Status block 1, displays actors info
class Status_Window_1 < Window_Base
def initialize
super(0,0,400,480)
self.contents = Bitmap.new(width-32,height-32)
self.contents.font.name = FONTFACE
self.contents.font.size = FONTSIZE
update(0)
end
def update(actor_index)
self.contents.clear
if actor_index == nil
actor_index = 0
end
actor = $game_party.actors[actor_index]
self.contents.draw_text(0,0,200,32,"Name: " + actor.name.to_s)
self.contents.draw_text(0,32,100,32,"Level: " + actor.level.to_s)
self.contents.draw_text(200,32,200,32,"Class: " + actor.class_name.to_s)
draw_actor_graphic(actor,32,128)
self.contents.draw_text(96, 64, 200, 32, "HP: " + actor.hp.to_s + "/" + actor.maxhp.to_s)
draw_bar(96,88,200,5,actor.hp,actor.maxhp,14,99)
self.contents.draw_text(96, 96, 200, 32, "SP: " + actor.sp.to_s + "/" + actor.maxsp.to_s)
draw_bar(96,120,200,5,actor.sp,actor.maxsp,19,99)
self.contents.draw_text(96, 128, 200, 32, "EXP: " + actor.exp_gained.to_s + "/" + actor.exp_needed.to_s)
draw_bar(96,152,200,5,actor.exp_gained,actor.exp_needed,16,99)
self.contents.draw_text(96 + X_OFFSET, 160 + Y_OFFSET, 200, 32, "STR: " + actor.str.to_s + "/" + STAT_CAP.to_s)
draw_bar(96 + X_OFFSET,184 + Y_OFFSET,200,5,actor.str,STAT_CAP,21,99)
self.contents.draw_text(96 + X_OFFSET, 192 + Y_OFFSET, 200, 32, "DEX: " + actor.dex.to_s + "/" + STAT_CAP.to_s)
draw_bar(96 + X_OFFSET,216 + Y_OFFSET,200,5,actor.dex,STAT_CAP,18,99)
self.contents.draw_text(96 + X_OFFSET, 224 + Y_OFFSET, 200, 32, "AGI: " + actor.agi.to_s + "/" + STAT_CAP.to_s)
draw_bar(96 + X_OFFSET,248 + Y_OFFSET,200,5,actor.agi,STAT_CAP,15,99)
self.contents.draw_text(96 + X_OFFSET, 256 + Y_OFFSET, 200, 32, "INT: " + actor.int.to_s + "/" + STAT_CAP.to_s)
draw_bar(96 + X_OFFSET,280 + Y_OFFSET,200,5,actor.int,STAT_CAP,10,99)
self.contents.draw_text(96 + X_OFFSET, 300 + Y_OFFSET, 200, 32, "ATK: " + actor.atk.to_s + "/" + STAT_CAP2.to_s)
draw_bar(96 + X_OFFSET,324 + Y_OFFSET,200,5,actor.atk,STAT_CAP2,21,99)
#self.contents.draw_text(96 + X_OFFSET, 332 + Y_OFFSET, 200, 32, "EVA: " + actor.eva.to_s + "/" + STAT_CAP2.to_s)
#draw_bar(96 + X_OFFSET,356 + Y_OFFSET,200,5,actor.eva,STAT_CAP2,18,99)
self.contents.draw_text(96 + X_OFFSET, 332 + Y_OFFSET, 200, 32, "PDEF: " + actor.pdef.to_s + "/" + STAT_CAP2.to_s)
draw_bar(96 + X_OFFSET,356 + Y_OFFSET,200,5,actor.mdef,STAT_CAP2,15,99)
self.contents.draw_text(96 + X_OFFSET, 364 + Y_OFFSET, 200, 32, "MDEF: " + actor.mdef.to_s + "/" + STAT_CAP2.to_s)
draw_bar(96 + X_OFFSET,388 + Y_OFFSET,200,5,actor.pdef,STAT_CAP2,10,99)
self.contents.font.color = cc(1)
self.contents.draw_text(45 , 406 + Y_OFFSET, 400, 32, "**Stats changes are permanent**")
self.contents.font.color = cc(99)
end
end
#------ Status block 2 , displays points
class Status_Window_2 < Window_Base
def initialize
super(0,0,240,75)
self.contents = Bitmap.new(width-32,height-32)
self.contents.font.name = FONTFACE
self.contents.font.size = FONTSIZE - 4
end
def update(actor_id)
actor = $game_party.actors[actor_id].id - 1
if actor_id == nil
actor = 0
end
self.contents.clear
self.contents.draw_text(0,0,100,32, "Points left: " + $actors_points[actor].to_s)
end
end
#------ Status block 3, help box =D
class Status_Window_3 < Window_Base
def initialize
super(0,0,240,180)
self.contents = Bitmap.new(width-32,height-32)
self.contents.font.name = FONTFACE
self.contents.font.size = FONTSIZE - 4
end
def update(text_set)
self.contents.clear
case text_set
when 0
self.contents.draw_text(0,0,210,32,"Increase STR by " + INCREASE_BY.to_s + " point(s)")
self.contents.draw_text(0,22,210,32,"Increase HP by " + STR_INCREASES[0].to_s + " %")
self.contents.draw_text(0,44,210,32,"Increase SP by " + STR_INCREASES[1].to_s + " %")
when 1
self.contents.draw_text(0,0,210,32,"Increase DEX by " + INCREASE_BY.to_s + " point(s)")
self.contents.draw_text(0,22,210,32,"Increase HP by " + DEX_INCREASES[0].to_s + " %")
self.contents.draw_text(0,44,210,32,"Increase SP by " + DEX_INCREASES[1].to_s + " %")
when 2
self.contents.draw_text(0,0,210,32,"Increase AGI by " + INCREASE_BY.to_s + " point(s)")
self.contents.draw_text(0,22,210,32,"Increase HP by " + AGI_INCREASES[0].to_s + " %")
self.contents.draw_text(0,44,210,32,"Increase SP by " + AGI_INCREASES[1].to_s + " %")
when 3
self.contents.draw_text(0,0,210,32,"Increase INT by " + INCREASE_BY.to_s + " point(s)")
self.contents.draw_text(0,22,210,32,"Increase HP by " + INT_INCREASES[0].to_s + " %")
self.contents.draw_text(0,44,210,32,"Increase SP by " + INT_INCREASES[1].to_s + " %")
end
end
end
#------ Stats Upgrading SCENE ------
#...Here comes the complicated bit!!!
class Scene_Stats_Upgrade
@@actor = 0
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
@window_1 = Status_Window_1.new
@window_1.update(@@actor) #Begins with actor 1
@window_2 = Status_Window_2.new
@window_2.x = 400
@window_2.y = 225
@window_2.update(@@actor)
@window_3 = Status_Window_3.new
@window_3.x = 400
@window_3.y = 300
s1 = "Add " + INCREASE_BY.to_s + " point(s) to STR"
s2 = "Add " + INCREASE_BY.to_s + " point(s) to DEX"
s3 = "Add " + INCREASE_BY.to_s + " point(s) to AGI"
s4 = "Add " + INCREASE_BY.to_s + " point(s) to INT"
@window_4 = Window_Command.new(240, [s1,s2,s3,s4]) #Remember, 200 is the Width
@window_4.y = 0 #Set a position for the menu other than 0:0
@window_4.x = 400
@window_4.height=225 #Force a new height for the menu window
@window_4.index = @menu_index
#update yerself bish!
Graphics.transition
loop do
Graphics.update
Input.update
update #update yerself bish!
if $scene != self
break
end
end
Graphics.freeze
@window_1.dispose
@window_2.dispose
@window_3.dispose
@window_4.dispose
end
def update
@window_4.update
case @window_4.index
when 0
@window_3.update(0)
when 1
@window_3.update(1)
when 2
@window_3.update(2)
when 3
@window_3.update(3)
end
#------ This bit is for navigation~
if Input.trigger?(Input::C)
r_actor = $game_party.actors[@@actor].id - 1
case @window_4.index
when 0
if $actors_points[r_actor] <= 0 || $game_party.actors[@@actor].str == STAT_CAP
$game_system.se_play($data_system.cancel_se)
else
$game_party.actors[@@actor].str += INCREASE_BY
@m_hp = $game_party.actors[@@actor].maxhp * (STR_INCREASES[0]/100.to_f)
@m_sp = $game_party.actors[@@actor].maxsp * (STR_INCREASES[1]/100.to_f)
$game_party.actors[@@actor].maxhp += @m_hp
$game_party.actors[@@actor].maxsp += @m_sp
$actors_points[r_actor] -= 1
@window_1.update(@@actor)
@window_2.update(@@actor)
end
when 1
if $actors_points[r_actor] <= 0 || $game_party.actors[@@actor].dex == STAT_CAP
$game_system.se_play($data_system.cancel_se)
else
$game_party.actors[@@actor].dex += INCREASE_BY
@m_hp = $game_party.actors[@@actor].maxhp * (DEX_INCREASES[0]/100.to_f)
@m_sp = $game_party.actors[@@actor].maxsp * (DEX_INCREASES[1]/100.to_f)
$game_party.actors[@@actor].maxhp += @m_hp
$game_party.actors[@@actor].maxsp += @m_sp
$actors_points[r_actor] -= 1
@window_1.update(@@actor)
@window_2.update(@@actor)
end
when 2
if $actors_points[r_actor] <= 0 || $game_party.actors[@@actor].agi == STAT_CAP
$game_system.se_play($data_system.cancel_se)
else
$game_party.actors[@@actor].agi += INCREASE_BY
@m_hp = $game_party.actors[@@actor].maxhp * (AGI_INCREASES[0]/100.to_f)
@m_sp = $game_party.actors[@@actor].maxsp * (AGI_INCREASES[1]/100.to_f)
$game_party.actors[@@actor].maxhp += @m_hp
$game_party.actors[@@actor].maxsp += @m_sp
$actors_points[r_actor] -= 1
@window_1.update(@@actor)
@window_2.update(@@actor)
end
when 3
if $actors_points[r_actor] <= 0 || $game_party.actors[@@actor].int == STAT_CAP
$game_system.se_play($data_system.cancel_se)
else
$game_party.actors[@@actor].int += INCREASE_BY
@m_hp = $game_party.actors[@@actor].maxhp * (INT_INCREASES[0]/100.to_f)
@m_sp = $game_party.actors[@@actor].maxsp * (INT_INCREASES[1]/100.to_f)
$game_party.actors[@@actor].maxhp += @m_hp
$game_party.actors[@@actor].maxsp += @m_sp
$actors_points[r_actor] -= 1
@window_1.update(@@actor)
@window_2.update(@@actor)
end
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
$game_map.autoplay
end
if Input.trigger?(Input::R)
if @@actor == 3
@@actor = 0
else
@@actor += 1
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Stats_Upgrade.new
end
if Input.trigger?(Input::L)
if @@actor == 0
@@actor = 3
else
@@actor -= 1
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Stats_Upgrade.new
end
end
end
#------ Goodness me, that bit is over :D!
#------ This is for drawing bars
class Window_Base < Window
def draw_bar(x,y,width,height,min_value,max_value,color,back_color)
rect = Rect.new(x,y,width,height)
self.contents.fill_rect(rect,cc(back_color.to_f))
rect = Rect.new(x + 1, y + 1, (width - 2) * (min_value / max_value.to_f), height-2)
self.contents.fill_rect(rect,cc(color.to_f))
end
end
#------ For calculating exp
class Game_Actor < Game_Battler
def exp_gained
return @exp - @exp_list[@level]
end
def exp_needed
return @exp_list[@level + 1] - @exp_list[@level]
end
end
#------ This bit deals with saving and loading
class Scene_Save
alias lolipop write_save_data
def write_data(file)
lolipop(file)
Marshal.dump($actors_points, file)
end
end
class Scene_Load
alias candycane read_save_data
def load_data(file)
candycane(file)
$actors_points = Marshal.load(file)
end
end
You will also need this; it is like a color library. You can also use this for everything else too!
Color
Code:
class Window_Base
def cc(n) #for the sake of simplicity and laziness, I'll use cc for method name
case n
#------ Vibrant
when 0 #black
return Color.new(0,0,0,255)
when 1 #red
return Color.new(255,0,0,255)
when 2 #green
return Color.new(0,255,0,255)
when 3 #blue
return Color.new(0,0,255,255)
when 4 #hot orange
return Color.new(255,90,0,255)
when 5 #orange
return Color.new(255,162,0,255)
when 6 #yellow
return Color.new(255,222,0,255)
when 7 #lime
return Color.new(198,255,0,255)
when 8 #light green
return Color.new(100,255,0,255)
when 9 #cool blue
return Color.new(0,255,255,255)
when 10 #sky blue
return Color.new(0,168,255,255)
when 11 #purple
return Color.new(174,0,255,255)
when 12 #pink
return Color.new(255,0,255,255)
when 13 #hot pink !!!
return Color.new(255,0,114,255)
#------ Pastel
when 14 #pastel red
return Color.new(235,145,145,255)
when 15 #pastel orange
return Color.new(235,208,145,255)
when 16 #pastel yellow
return Color.new(235,232,145,255)
when 17 #pastel lime green
return Color.new(204,235,145,255)
when 18 #pastel green
return Color.new(145,235,145,255)
when 19 #pastel blue
return Color.new(145,183,235,255)
when 20 #pastel purple
return Color.new(183,145,235,255)
when 21 #pastel hot pink
return Color.new(235,145,181,255)
when 99 #white
return Color.new(255,255,255,255)
end
end
end
Instructions
To add points to a charactor, use:
Code:
$actors_points[actorID] += Amount
replace actorID with the ID of your charactor from the database, and replace Amount with the amount of points you want to add
To add points to a charactor upon levelup:
find this line in Scene_Battle 2:
Code:
if actor.level > last_level
and add this below it:
Code:
$actors_points[actor.id-1] += 2 * (actor.level - last_level)
Do read the instruction in the script header too.
FAQ
If you want to use this as the main leveling system, go into the database and set str, agi, dex and int to 0 for all of your actors
Compatibility
Should be compatible with everything else
Credits and Thanks
Dubealex: for his tutorials
Leon: layout idea
Author's Notes
Upcoming versions will have:
- confirmation window
- a feature that will change the hp,sp,mdef etc. when you upgrade a stat (like when you put 1 point into STR, you get the atk increase and 1% HP increase)
-Be able to support a party with more than 4 members
-Include player's states and equiped item (this can turn into your new Status scene)
-option to increase HP and SP too?