Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Submission: Class/Profession System, by Prexus
Prexus
post Oct 15 2005, 03:26 AM
Post #1


Level 3
Group Icon

Group: Member
Posts: 31
Type: Event Designer
RM Skill: Masterful




Made because of an idea by Black Joker;
helped a-LOT- in making it customizable thanks to Fuso and Astro_Mech
I attempted to make it as comprehensible as possible via my comments...

Anyhow what it does is uses the Classes database and sets aside certain classes
as "Classes" and others as "Professions". A profession is a sort of sub-class to the class.. For example, in the demo, a Knight (class)'s professions are Swords, Lances, Axes, and Shields.

Professions and Classes level completely independently of each other and the hero. The EXP given in battle by a monster is given to the hero as normal but a hero's level governs stat increases and not skill gains. Then, EXP equal to 3/4s the EXP given to the Actor goes to the Class Exp, and 1/2 goes to Profession EXP.

The actor can equip weapons/armor that are in the Class weapon/armor sets as well as the Profession weapon/armor set. So a knight might inherently be able to equip daggers, but if professing in Swords could also equip swords.

Uhm.. not sure what else there is to know about it.. the Class Changing windows and stuff aren't very aesthetic. They are just placeholders for the work you do.

There is an option in the menu for Class Skills. I made this so that classes such
as Artisan (in the demo) could use Axe Man Deke's recipe/combination system
Just take the option out of the menu if you don't want it.

DEMO:
http://prexus.rmxponline.com/prexus/script...s/ClassDemo.rar

SCRIPT:
CODE
#-------------------------------#
# Advanced Profession System #
# Written By: Prexus #
# Thanks: Fuso, Astro_Mech #
# www.prexus.nearfantastica.org #
# All Rights Reserved #
#-------------------------------#

# Redefinitions and additions to game_actor
class Game_Actor < Game_Battler
# Secondary class id
attr_accessor :profession_id
# Array for class/pro levels/exp
attr_accessor :class_level
attr_accessor :profession_level
attr_accessor :class_exp
attr_accessor :profession_exp
attr_accessor :end_of_classes

def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
# Starting profession ID with case statement for all actors
case @actor_id
when 3 # Actor ID
@profession_id = 5 # Starting Profession ID
when 4
@profession_id = 9
when 5
@profession_id = 13
when 6
@profession_id = 17
end
# Set the variable @end_of_classes to the ID of the last class you want
# and the ID before the start of professions.
@end_of_classes = 4
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
# Defines Class EXP Table
@class_exp_list = Array.new(101)
make_class_exp_list
# Defines Profession EXP Table
@profession_exp_list = Array.new(101)
make_profession_exp_list
make_exp_list
@exp = @exp_list[@level]
@class_level = []
@class_exp = []
# Sets-Up Class table based on the IDs in the database.
# The line 1..4 means that Classes with the IDs 1 through 4 are "Classes"
# whereas the rest of the classes are Professions. If you want to increase
# the amount of Classes, just increase the 4. Make sure in the database
# that classes are the first entries in the class tab.
for i in 1..@end_of_classes
@class_level[i] = 1
@class_exp[i] = @class_exp_list[@class_level[i]]
end
@profession_level = []
@profession_exp = []
# This sets up the profession arrays based on IDs in the database.
# The line 5..$data_classes.size means all the IDs from 5 to the end
# are included as Professions rather than Classes. If you want more classes,
# make sure to increase this number as well as the number above. They
# should be +1 apart. (4, 5 // 12, 13 // etc.)
for i in @end_of_classes+1..$data_classes.size
@profession_level[i] = 1
@profession_exp[i] = @profession_exp_list[@profession_level[i]]
end
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# Skills learned are now based on class and profession level rather
# than the character level. The character level governs statistical
# growth rather than skill growth.
# --
# Teaches initial skills for class
for i in 1..@class_level[@class_id]
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# Teaches initial skills for profession
for i in 1..@profession_level[@profession_id]
for j in $data_classes[@profession_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
# Mainly used for drawing in windows [draw_text(x,y,wid,hei, @actor.show_class_level)
# or something of the like]
def show_class_exp
return @class_exp[@class_id]
end
def show_class_level
return @class_level[@class_id]
end
def show_profession_level
return @profession_level[@profession_id]
end
def show_profession_exp
return @profession_exp[@profession_id]
end
def make_class_exp_list
# Defines the Class exp table based on the first
# character in the database
actor = $data_actors[1]
@class_exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@class_exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@class_exp_list[i] = @class_exp_list[i-1] + Integer(n)
end
end
end
def make_profession_exp_list
# Defines the Profession exp table based on the second
# character in the database.
actor = $data_actors[2]
@profession_exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@profession_exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@profession_exp_list[i] = @profession_exp_list[i-1] + Integer(n)
end
end
end
# Forgets all skills, change 80 to the maximum number of skills in the
# database (80 is default)
def forget_all
for i in 1...80
if @skills.include?(i)
@skills.delete(i)
end
end
end
def element_rate(element_id)
table = [0,200,150,100,50,0,-100]
# Changed to take an average between Class and Profession's element ranks.
result = table[$data_classes[@class_id].element_ranks[element_id]]
result2 = table[$data_classes[@profession_id].element_ranks[element_id]]
result /= result2
result *= 100
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
return result
end
def profession_state_ranks
return $data_classes[@profession_id].state_ranks
end
def class_name
return $data_classes[@class_id].name
end
def profession_name
return $data_classes[@profession_id].name
end
def class_exp_s
return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp[@class_id].to_s : "-------"
end
def next_class_exp_s
return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp_list[@class_level[@class_id]+1].to_s : "-------"
end
def next_class_rest_exp_s
return @class_exp_list[@class_level[@class_id]+1] > 0 ?
(@class_exp_list[@class_level[@class_id]+1] - @class_exp[@class_id]).to_s : "-------"
end
def profession_exp_s
return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp[@profession_id].to_s : "-------"
end
def next_profession_exp_s
return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp_list[@profession_level[@profession_id]+1].to_s : "-------"
end
def next_profession_rest_exp_s
return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ?
(@profession_exp_list[@profession_level[@profession_id]+1] - @profession_exp[@profession_id]).to_s : "-------"
end
# Def Equippable? changed to detect if equipment is in the Class OR Profession sets.
def equippable?(item)
if item.is_a?(RPG::Weapon)
if $data_classes[@class_id].weapon_set.include?(item.id) or $data_classes[@profession_id].weapon_set.include?(item.id)
return true
end
end
if item.is_a?(RPG::Armor)
if $data_classes[@class_id].armor_set.include?(item.id) or $data_classes[@profession_id].armor_set.include?(item.id)
return true
end
end
return false
end
# A redeclaration of def exp=(exp) which works for different classes.
# If you wish to add EXP to a character now, if you want to add to just
# the EXP use the regular event command but if you want to add to all the
# exp types, Call Script and use this line: $game_party.actors[ID].add_exp(amount)
def add_exp(value)
@exp += value
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@class_exp[@class_id] += (value*0.75).floor
while @class_exp[@class_id] >= @class_exp_list[@class_level[@class_id]+1] and @class_exp_list[@class_level[@class_id]+1] > 0
@class_level[@class_id] += 1
for j in $data_classes[@class_id].learnings
if j.level == @class_level[@class_id]
learn_skill(j.skill_id)
end
end
end
while @class_exp[@class_id] < @class_exp_list[@class_level[@class_id]]
@class_level[@class_id] -= 1
end
@profession_exp[@profession_id] += (value*0.5).floor
while @profession_exp[@profession_id] >= @profession_exp_list[@profession_level[@profession_id]+1] and @profession_exp_list[@profession_level[@profession_id]+1] > 0
@profession_level[@profession_id] += 1
for j in $data_classes[@profession_id].learnings
if j.level == @profession_level[@profession_id]
learn_skill(j.skill_id)
end
end
end
while @profession_exp[@profession_id] < @profession_exp_list[@profession_level[@profession_id]]
@profession_level[@profession_id] -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
# When changing classes, all skills are forgotten and relearned
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
forget_all
for i in 1..@class_level[@class_id]
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
for i in 1..@profession_level[@profession_id]
for j in $data_classes[@profession_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
end
end
# When changing profession, all skills are forgotten and relearned
def profession_id=(profession_id)
if $data_classes[profession_id] != nil
@profession_id = profession_id
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
forget_all
for i in 1..@class_level[@class_id]
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
for i in 1..@profession_level[@profession_id]
for j in $data_classes[@profession_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
end
end
end

# Small modification to the way EXP is given at the end of battle.
class Scene_Battle
alias cps_scene_battle_main main
def main
cps_scene_battle_main
if @level_window != nil
@level_window.dispose
end
end
def start_phase5
# フェーズ 5 に移行
@phase = 5
# バトル終了 ME を演奏
$game_system.me_play($game_system.battle_end_me)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# EXP、ゴールド、トレジャーを初期化
exp = 0
gold = 0
treasures = []
# ループ
for enemy in $game_troop.enemies
# エネミーが隠れ状態でない場合
unless enemy.hidden
# 獲得 EXP、ゴールドを追加
exp += enemy.exp
gold += enemy.gold
# トレジャー出現判定
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# トレジャーの数を 6 個までに限定
treasures = treasures[0..5]
# EXP 獲得
@level_window = Window_Level.new
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
last_class_level = actor.class_level[actor.class_id]
last_profession_level = actor.profession_level[actor.profession_id]
actor.add_exp(exp)
if actor.level > last_level
@level_window.level_up(i)
end
if actor.class_level[actor.class_id] > last_class_level
@level_window.class_up(i)
end
if actor.profession_level[actor.profession_id] > last_profession_level
@level_window.profession_up(i)
end
end
end
# ゴールド獲得
$game_party.gain_gold(gold)
# トレジャー獲得
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# バトルリザルトウィンドウを作成
@result_window = Window_BattleResult.new(exp, gold, treasures)
# ウェイトカウントを設定
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase5
# ウェイトカウントが 0 より大きい場合
if @phase5_wait_count > 0
# ウェイトカウントを減らす
@phase5_wait_count -= 1
# ウェイトカウントが 0 になった場合
if @phase5_wait_count == 0
# リザルトウィンドウを表示
@result_window.visible = true
@level_window.visible = true
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# ステータスウィンドウをリフレッシュ
@status_window.refresh
@level_window.refresh
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# バトル終
battle_end(0)
end
end
end

# Window to display the names of all the classes but not professions.
class Window_Classes < Window_Selectable
def initialize
super(0, 0, 160, 160)
@column_max = 1
refresh
self.index = 0
end
def classdata
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# This for makes sure only to show the first four entries in $data_classes.
# If you make more than 4 classes, be sure to modify these numbers.
for i in 1..$game_party.actors[0].end_of_classes
@data.push($data_classes[i])
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, 128, 32, item.name, 0)
end
end
# Window to display all the professions but not classes.
class Window_Professions < Window_Selectable
def initialize(class_id)
super(0, 160, 160, 160)
@column_max = 1
@class_id = class_id
refresh
self.index = 0
end
def classdata
return @data[self.index]
end
# Use this when updating so that only the appropriate professions are shown.
def new_class_id(class_id)
@class_id = class_id
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Little equation to only show the appropriate professions.
# (@class_id - 1) * 4 makes sure to move ahead 4 for every class
# since in the default system there are 4 professions for each class
low = ($game_party.actors[0].end_of_classes + 1) + (@class_id - 1) * 4
# Sets the high end of for loop to encompass all the professions for the
# class. Since there are 4 per class its obviously 4 more.
high = low + 4
for i in low...high
@data.push($data_classes[i])
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, 128, 32, item.name, 0)
end
end

class Scene_ClassSelect
def initialize(actor_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@class_win = Window_Classes.new
@prof_win = Window_Professions.new(@actor.class_id)
@prof_win.index = -1
@prof_win.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@class_win.dispose
@prof_win.dispose
end
def update
@class_win.update
if @class_win.active
# Updates the profession list with the professions appropriate to
# the class only.
@prof_win.new_class_id(@class_win.index + 1)
end
@prof_win.update
if @class_win.active
update_class
return
end
if @prof_win.active
update_prof
return
end
end
def update_class
if Input.trigger?(Input::cool.gif
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(6)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@class_win.active = false
@prof_win.index = 0
@prof_win.active = true
return
end
end
def update_prof
if Input.trigger?(Input::cool.gif
$game_system.se_play($data_system.cancel_se)
@prof_win.active = false
@prof_win.index = -1
@class_win.active = true
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
# Updates character's class and profession based on decisions.
@actor.class_id = @class_win.classdata.id
@actor.profession_id = @prof_win.classdata.id
$scene = Scene_Map.new
return
end
end
end

# Updated version of the default battle result made to show the gains
# in Class EXP and Profession EXP (C-EXP/P-EXP)
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(0, 0, 640, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.visible = false
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 128, 32, "Gold:")
self.contents.draw_text(4, 64, 128, 32, "EXP:")
self.contents.draw_text(4, 96, 128, 32, "C-EXP:")
self.contents.draw_text(4, 128, 128, 32, "P-EXP:")
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 128, 32, @gold.to_s, 2)
self.contents.draw_text(4, 64, 128, 32, @exp.to_s, 2)
self.contents.draw_text(4, 96, 128, 32, (@exp*0.75).floor.to_s, 2)
self.contents.draw_text(4, 128, 128, 32, (@exp*0.5).floor.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(164, 0, 128, 32, "Items Found:")
y = 32
for item in @treasures
draw_item_name(item, 164, y)
y += 32
end
end
end

# Small mod of Window_Base to show profession
class Window_Base
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name + "/" + actor.profession_name)
end
end

# Temporary mod of Window_Status to show Class/Profession and Level.
class Window_Status < Window_Base
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "EXP")
self.contents.draw_text(320, 80, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 160, 96, 32, "Equipment")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
# Mod is here
self.contents.font.color = system_color
self.contents.draw_text(320, 400, 200, 32, @actor.class_name.to_s)
self.contents.draw_text(320, 424, 200, 32, @actor.profession_name.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(320, 400, 200, 32, @actor.show_class_level.to_s, 2)
self.contents.draw_text(320, 424, 200, 32, @actor.show_profession_level.to_s, 2)
end
end
class Window_Level < Window_Base
def initialize
super(0, 192, 640, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.visible = false
@level_up_flags = [false, false, false, false]
@class_up_flags = [false, false, false, false]
@profession_up_flags = [false, false, false, false]
refresh
end
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
def class_up(actor_index)
@class_up_flags[actor_index] = true
end
def profession_up(actor_index)
@profession_up_flags[actor_index] = true
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
@actor = $game_party.actors[i]
self.contents.font.color = normal_color
self.contents.font.size = 18
draw_actor_exp_bar(@actor, i * 160 + 4, 0, 120)
draw_actor_class_bar(@actor, i * 160 + 4, 32, 120)
draw_actor_profession_bar(@actor, i * 160 + 4, 64, 120)
self.contents.draw_text(i * 160 + 4, 0, 120, 32, "Level")
self.contents.draw_text(i * 160 + 4, 32, 120, 32, "C. Level")
self.contents.draw_text(i * 160 + 4, 64, 120, 32, "P. Level")
if @level_up_flags[i]
self.contents.font.color = Color.new(0,255,0,255)
self.contents.font.size = 24
self.contents.draw_text(i * 160 + 4, 0, 120, 32, "+", 2)
end
if @class_up_flags[i]
self.contents.font.color = Color.new(0,255,0,255)
self.contents.font.size = 24
self.contents.draw_text(i * 160 + 4, 32, 120, 32, "+", 2)
end
if @profession_up_flags[i]
self.contents.font.color = Color.new(0,255,0,255)
self.contents.font.size = 24
self.contents.draw_text(i * 160 + 4, 64, 120, 32, "+", 2)
end
end
end
end

# Gradient Bars
# http://members.jcom.home.ne.jp/cogwheel/

class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
def now_class_exp
return @class_exp[@class_id] - @class_exp_list[@class_level[@class_id]]
end
def next_class_exp
return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp_list[@class_level[@class_id]+1] - @class_exp_list[@class_level[@class_id]] : 0
end
def now_profession_exp
return @profession_exp[@profession_id] - @profession_exp_list[@profession_level[@profession_id]]
end
def next_profession_exp
return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp_list[@profession_level[@profession_id]+1] - @profession_exp_list[@profession_level[@profession_id]] : 0
end
end

class Window_Base < Window
def draw_actor_exp_bar(actor, x, y, width = 144)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
def draw_actor_class_bar(actor, x, y, width = 144)
if actor.next_class_exp != 0
rate = actor.now_class_exp.to_f / actor.next_class_exp
else
rate = 1
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
if actor.next_class_exp != 0
exp = (width + plus_width) * actor.now_class_exp * rate_width /
100 / actor.next_class_exp
else
exp = (width + plus_width) * rate_width / 100
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
def draw_actor_profession_bar(actor, x, y, width = 144)
if actor.next_profession_exp != 0
rate = actor.now_profession_exp.to_f / actor.next_profession_exp
else
rate = 1
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
if actor.next_profession_exp != 0
exp = (width + plus_width) * actor.now_profession_exp * rate_width /
100 / actor.next_profession_exp
else
exp = (width + plus_width) * rate_width / 100
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end

class Bitmap
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end




__________________________
Go to the top of the page
 
+Quote Post
   
Guardian Drayal
post Jan 23 2006, 11:08 AM
Post #2


Epic Guardian
Group Icon

Group: Revolutionary
Posts: 565
Type: Event Designer
RM Skill: Skilled




I don't have a demo to post, but I did manage to decipher this script with some assistance.

The script above is exactly right except for one small area, which I'll show you how to change. First, find this part of the script...

QUOTE
    when 3 # Actor ID
      @profession_id = 5 # Starting Profession ID
    when 4
      @profession_id = 9
    when 5
      @profession_id = 13
    when 6
      @profession_id = 17
    end


...and change it to this:

QUOTE
    when 1 # Actor ID
      @profession_id = 5 # Starting Profession ID
    when 2
      @profession_id = 9
    when 3
      @profession_id = 13
    when 4
      @profession_id = 17
    end


Bear in mind that you have to organize your classes in a specific way for this script to work properly. The first four classes in your database's Class tab are the main classes. Make sure that none of the characters in the Hero tab start with anything as their class except for one of these four classes. Probably best to make them broad...something like Warrior, Magic User, Rogue and Specialist.

Now, for the four sub-classes, or professions, for Warrior, you would place those as the next four classes on the Class tab. Maybe something like Knight, Crusader, Magus Knight, Paladin. The next four blocks below these should be the four professions for Magic User, and so on. There are instructions in the script on how to change these numbers if you so desire, so I won't rehash that.

To open the script to change classes, put the following into a Call Script event:

QUOTE
$scene = Scene_ClassSelect.new(0)


The 0 in parentheses is the id for the first member of the party, so if you wanted the third person in your party to change his/her class, you would apply that line, but instead put 2 in the parentheses.

Also, a part of this script needs to be placed in a new script between this one and main. I'll post that part of the script here for the sake of simplicity. I named it Gradient_Bar on my script list and didn't have a problem, so I assume you can name it whatever you want:

QUOTE
# Gradient Bars
# http://members.jcom.home.ne.jp/cogwheel/

class Game_Actor < Game_Battler
def now_exp
  return @exp - @exp_list[@level]
end
def next_exp
  return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
def now_class_exp
  return @class_exp[@class_id] - @class_exp_list[@class_level[@class_id]]
end
def next_class_exp
  return @class_exp_list[@class_level[@class_id]+1] > 0 ? @class_exp_list[@class_level[@class_id]+1] - @class_exp_list[@class_level[@class_id]] : 0
end
def now_profession_exp
  return @profession_exp[@profession_id] - @profession_exp_list[@profession_level[@profession_id]]
end
def next_profession_exp
  return @profession_exp_list[@profession_level[@profession_id]+1] > 0 ? @profession_exp_list[@profession_level[@profession_id]+1] - @profession_exp_list[@profession_level[@profession_id]] : 0
end
end

class Window_Base < Window
def draw_actor_exp_bar(actor, x, y, width = 144)
  if actor.next_exp != 0
    rate = actor.now_exp.to_f / actor.next_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_exp != 0
    exp = (width + plus_width) * actor.now_exp * rate_width /
                                                        100 / actor.next_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
    end
  def draw_actor_class_bar(actor, x, y, width = 144)
  if actor.next_class_exp != 0
    rate = actor.now_class_exp.to_f / actor.next_class_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_class_exp != 0
    exp = (width + plus_width) * actor.now_class_exp * rate_width /
                                                        100 / actor.next_class_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
  end
  def draw_actor_profession_bar(actor, x, y, width = 144)
  if actor.next_profession_exp != 0
    rate = actor.now_profession_exp.to_f / actor.next_profession_exp
  else
    rate = 1
  end
  plus_x = 0
  rate_x = 0
  plus_y = 25
  plus_width = 0
  rate_width = 100
  height = 10
  align1 = 1
  align2 = 2
  align3 = 0
  grade1 = 1
  grade2 = 0
  color1 = Color.new(0, 0, 0, 192)
  color2 = Color.new(255, 255, 192, 192)
  color3 = Color.new(0, 0, 0, 192)
  color4 = Color.new(64, 0, 0, 192)
  color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  if actor.next_profession_exp != 0
    exp = (width + plus_width) * actor.now_profession_exp * rate_width /
                                                        100 / actor.next_profession_exp
  else
    exp = (width + plus_width) * rate_width / 100
  end
  gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
              width, plus_width + width * rate_width / 100,
              height, exp, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
  end         
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
              color1, color2, color3, color4, color5, color6, grade1, grade2)
  case align1
  when 1
    x += (rect_width - width) / 2
  when 2
    x += rect_width - width
  end
  case align2
  when 1
    y -= height / 2
  when 2
    y -= height
  end
  self.contents.fill_rect(x, y, width, height, color1)
  self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  if align3 == 0
    if grade1 == 2
      grade1 = 3
    end
    if grade2 == 2
      grade2 = 3
    end
  end
  if (align3 == 1 and grade1 == 0) or grade1 > 0
    color = color3
    color3 = color4
    color4 = color
  end
  if (align3 == 1 and grade2 == 0) or grade2 > 0
    color = color5
    color5 = color6
    color6 = color
  end
  self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
                                color3, color4, grade1)
  if align3 == 1
    x += width - gauge
  end
  self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
                                color5, color6, grade2)
end
end

class Bitmap
def gradation_rect(x, y, width, height, color1, color2, align = 0)
  if align == 0
    for i in x...x + width
      red  = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
      green = color1.green +
              (color2.green - color1.green) * (i - x) / (width - 1)
      blue  = color1.blue +
              (color2.blue - color1.blue) * (i - x) / (width - 1)
      alpha = color1.alpha +
              (color2.alpha - color1.alpha) * (i - x) / (width - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(i, y, 1, height, color)
    end
  elsif align == 1
    for i in y...y + height
      red  = color1.red +
              (color2.red - color1.red) * (i - y) / (height - 1)
      green = color1.green +
              (color2.green - color1.green) * (i - y) / (height - 1)
      blue  = color1.blue +
              (color2.blue - color1.blue) * (i - y) / (height - 1)
      alpha = color1.alpha +
              (color2.alpha - color1.alpha) * (i - y) / (height - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(x, i, width, 1, color)
    end
  elsif align == 2
    for i in x...x + width
      for j in y...y + height
        red  = color1.red + (color2.red - color1.red) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color1.green + (color2.green - color1.green) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color1.blue + (color2.blue - color1.blue) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color1.alpha + (color2.alpha - color1.alpha) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  elsif align == 3
    for i in x...x + width
      for j in y...y + height
        red  = color1.red + (color2.red - color1.red) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color1.green + (color2.green - color1.green) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color1.blue + (color2.blue - color1.blue) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color1.alpha + (color2.alpha - color1.alpha) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  end
end
end


That's about all I can think of to assist with this script. You should refer to the original post and script above, though, when using it. I don't know the full capabilities of it...I simply was able, with some assistance, to learn how to implement and use it. Hope this helps someone.

- Drayal


__________________________
What, you were expecting to see something funny or interesting here...?
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 11:43 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker