Kio's Script Compilation
Introduction
I've seen many people with a few issues regarding my scripts, usually from out-of-date versions. Therefore, I will be supplying a demo with working versions of the scripts, as well as events that use my scripts and can be used as templates for your own.
Note: In this demo, there are a few bugs with the new scripts you will see, however the point of this is to share completed work on the old scripts that people have issues with. The new scripts, such as the Item Rarity color coding, Random Rare Item drop system, and the HUD aren't fully tested and therefore are likely to cause issues if used in your game. These will recieve support and instructions upon completion. Also, the Quest Reward Window and the Card Battle System are still in development and therefore shouldn't be copied to a different game, since neither will work yet.
Screenies!
Random Rare Item System & Rarity Color Code
Spoiler
http://img138.imageshack.us/img138/3172/rarevk5.gif[/IMG]
Reputation System
Spoiler
http://img468.imageshack.us/img468/7389/repis7.gif[/IMG]
Skill Amount System
Spoiler
http://img468.imageshack.us/img468/621/skillamountrg2.gif[/IMG]
Skill Learning System
Spoiler
http://img291.imageshack.us/img291/4140/skilllearnrk2.gif[/IMG]
HUD
Spoiler
http://img468.imageshack.us/img468/424/hudfp5.gif[/IMG]
Scripts & Instructions
Kio's Skill Amount System v3.0
Probably my oldest and most famous script, this can determine if you want a skill to have a determined number of uses. Like a shotgun has 12 shots before you reload it, or you can only use the Fire spell 3 times a battle. This system can make skills be independamt of SP, requiring just charges, SP and charges, just SP or be unlimited use.
Directions:
This one is pretty simple to use. At line 58 and afterwards you input how many charges for which skills you want. If you wish for the skill to have infinite uses, set the max to 0. if you want the skill to not be unlimited or require charges, set the max to nil or just don't enter a case for that skill id.
To reload skills, use this in a call script event:
for i in 1...$data_actors.size
actor = $game_actors[i]
for j in 1...$data_skills.size
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
actor = $game_actors[i]
for j in 1...$data_skills.size
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
Expand to see the code.
The Script
Spoiler
#==============================================================
# Kio's Skill Amount System v3.0
#==============================================================
# At line 58 and afterwards you input how many charges for which skills you want.
# If you wish for the skill to have infinite uses, set the max to 0.
#To reload skills, use this in a call script event:
#for i in 1...$data_actors.size
# actor = $game_actors[i]
# for j in 1...$data_skills.size
# actor.skill_current[j] = $data_skills[j].max
# if actor.skill_current[j] == 0
# actor.skill_current[j] = nil
# end
# end
#end
module RPG
class Skill
attr_accessor :max #Maximum number of skill uses
end
end
class Game_Actor
attr_accessor :skill_current
alias setup3 setup
def setup(actor_id)
@skill_current = []
setup3(actor_id)
end
end
class Game_Party
alias add2 add_actor
def add_actor(actor_id)
add2(actor_id)
actor = $game_actors[actor_id]
for j in 1...$data_skills.size
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
end
class Scene_Title
alias main2 main
def main
main2
for i in 1...$data_skills.size
skill = $data_skills[i]
case i
# Define the amount for each skill here.
when 1 # for skill id 1
skill.max = 20 # sets the maximum to 20
when 2 # for id 2, etc.
skill.max = 30
when 3
skill.max = 0 # creates an unlimited use skill
when 4
skill.max = nil
when 5
skill.max = 3
# End the definitions for the skills here.
else #if the skill has no max amount
skill.max = nil
end
for i in 1...$data_actors.size
actor = $game_actors[i]
for j in 1...$data_skills.size
if actor.skill_current[j] == nil
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
end
end
end
end
class Window_Skill < Window_Selectable
#Creates attributes for displaying skill amounts
attr_accessor :amount
attr_accessor :amount2
def draw_item(index)
skill = @data[index]
#Inputs the variables for the skill
@amount = @actor.skill_current[skill.id]
@amount2 = $data_skills[skill.id].max
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if @amount == 0
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
if $data_skills[skill.id].xp != nil
unless @actor.skill_xp[skill.id] == 0
self.contents.draw_text(x + 192, y, 204, 32, "Unlearned", 0)
return
end
end
#Checks to make sure the ammo is drawn in the correct place
if @amount2 != nil
if @amount2 >=1
if @amount2 > 9
if @amount != nil
if @amount > 9
self.contents.draw_text(x + 214, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
else
self.contents.draw_text(x + 226, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
end
end
else
self.contents.draw_text(x + 238, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
end
#Check to see if the skill has an SP and Charges
if skill.sp_cost > 0
self.contents.font.color = system_color
self.contents.draw_text(x + 140, y, 48, 32, skill.sp_cost.to_s, 2)
end
#check to see if the skill has infinite uses
elsif @amount2 == 0
self.contents.font.color = system_color
self.contents.draw_text(x + 200, y, 204, 32, "Unlimited", 0)
end
else
if skill.sp_cost > 0
self.contents.font.color = system_color
self.contents.draw_text(x + 225, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end
end
class Scene_Battle
def update_phase3_skill_select
@skill_window.visible = true
@skill_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_skill_select
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @active_battler.skill_current[@skill.id] == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@skill_window.visible = false
if @skill.scope == 1
start_enemy_select
elsif @skill.scope == 3 or @skill.scope == 5
start_actor_select
else
end_skill_select
phase3_next_actor
end
return
end
end
def update_phase3_enemy_select
@enemy_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_enemy_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @enemy_arrow.index
end_enemy_select
if @skill_window != nil
# decrease current amount remaining in the skill
if @active_battler.skill_current[@skill.id] != nil
@active_battler.skill_current[@skill.id] -= 1
end
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
def update_phase3_actor_select
@actor_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_actor_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @actor_arrow.index
end_actor_select
if @skill_window != nil
if @active_battler.skill_current[@skill.id] != nil
@active_battler.skill_current[@skill.id] -= 1
end
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
end
class Scene_Skill
alias update_target2 update_target
def update_target
update_target2
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
if @actor.skill_current[@skill.id] >= 1
@actor.skill_current[@skill.id] -= 1
end
end
unless used
end
return
end
end
end
# Kio's Skill Amount System v3.0
#==============================================================
# At line 58 and afterwards you input how many charges for which skills you want.
# If you wish for the skill to have infinite uses, set the max to 0.
#To reload skills, use this in a call script event:
#for i in 1...$data_actors.size
# actor = $game_actors[i]
# for j in 1...$data_skills.size
# actor.skill_current[j] = $data_skills[j].max
# if actor.skill_current[j] == 0
# actor.skill_current[j] = nil
# end
# end
#end
module RPG
class Skill
attr_accessor :max #Maximum number of skill uses
end
end
class Game_Actor
attr_accessor :skill_current
alias setup3 setup
def setup(actor_id)
@skill_current = []
setup3(actor_id)
end
end
class Game_Party
alias add2 add_actor
def add_actor(actor_id)
add2(actor_id)
actor = $game_actors[actor_id]
for j in 1...$data_skills.size
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
end
class Scene_Title
alias main2 main
def main
main2
for i in 1...$data_skills.size
skill = $data_skills[i]
case i
# Define the amount for each skill here.
when 1 # for skill id 1
skill.max = 20 # sets the maximum to 20
when 2 # for id 2, etc.
skill.max = 30
when 3
skill.max = 0 # creates an unlimited use skill
when 4
skill.max = nil
when 5
skill.max = 3
# End the definitions for the skills here.
else #if the skill has no max amount
skill.max = nil
end
for i in 1...$data_actors.size
actor = $game_actors[i]
for j in 1...$data_skills.size
if actor.skill_current[j] == nil
actor.skill_current[j] = $data_skills[j].max
if actor.skill_current[j] == 0
actor.skill_current[j] = nil
end
end
end
end
end
end
end
class Window_Skill < Window_Selectable
#Creates attributes for displaying skill amounts
attr_accessor :amount
attr_accessor :amount2
def draw_item(index)
skill = @data[index]
#Inputs the variables for the skill
@amount = @actor.skill_current[skill.id]
@amount2 = $data_skills[skill.id].max
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if @amount == 0
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
if $data_skills[skill.id].xp != nil
unless @actor.skill_xp[skill.id] == 0
self.contents.draw_text(x + 192, y, 204, 32, "Unlearned", 0)
return
end
end
#Checks to make sure the ammo is drawn in the correct place
if @amount2 != nil
if @amount2 >=1
if @amount2 > 9
if @amount != nil
if @amount > 9
self.contents.draw_text(x + 214, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
else
self.contents.draw_text(x + 226, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
end
end
else
self.contents.draw_text(x + 238, y, 204, 32, @amount.to_s + " / " + @amount2.to_s, 0)
end
#Check to see if the skill has an SP and Charges
if skill.sp_cost > 0
self.contents.font.color = system_color
self.contents.draw_text(x + 140, y, 48, 32, skill.sp_cost.to_s, 2)
end
#check to see if the skill has infinite uses
elsif @amount2 == 0
self.contents.font.color = system_color
self.contents.draw_text(x + 200, y, 204, 32, "Unlimited", 0)
end
else
if skill.sp_cost > 0
self.contents.font.color = system_color
self.contents.draw_text(x + 225, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end
end
class Scene_Battle
def update_phase3_skill_select
@skill_window.visible = true
@skill_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_skill_select
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @active_battler.skill_current[@skill.id] == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@skill_window.visible = false
if @skill.scope == 1
start_enemy_select
elsif @skill.scope == 3 or @skill.scope == 5
start_actor_select
else
end_skill_select
phase3_next_actor
end
return
end
end
def update_phase3_enemy_select
@enemy_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_enemy_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @enemy_arrow.index
end_enemy_select
if @skill_window != nil
# decrease current amount remaining in the skill
if @active_battler.skill_current[@skill.id] != nil
@active_battler.skill_current[@skill.id] -= 1
end
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
def update_phase3_actor_select
@actor_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_actor_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @actor_arrow.index
end_actor_select
if @skill_window != nil
if @active_battler.skill_current[@skill.id] != nil
@active_battler.skill_current[@skill.id] -= 1
end
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
end
class Scene_Skill
alias update_target2 update_target
def update_target
update_target2
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
if @actor.skill_current[@skill.id] >= 1
@actor.skill_current[@skill.id] -= 1
end
end
unless used
end
return
end
end
end
Expand to see the code.
Kio's Skill Learning System v1.5
This system works kinda like a standard AP system. though instead of seperate AP, the player can assign already earned XP to learning new skills. Also, this system allows you to configure skills to be learned progressively. For instance, you can set it so that after you learn Fire, Fire 2 becomes avaliable.
Directions:
Another fairly simple one. At line 55 and afterwards you input how much XP each skill requires to learn. If you wish for the skill to be independant of this script and learned in the conventional manner, do not input anything for the skill ID.
If at any time you want a learnable skill to be immediately learned, use this code in a call script:
$game_actors[i].skill_xp[skill_id] == 0
Expand to see the code.
Where i = the ID of the actor, and skill_id = the ID of the skill.
To set skills to be progressively learned, input the code skill.state = "primary" to begin the chain, and skill.state = "end" to finish it. Unfortunately, this only works for learning the skill with the ID after the completed one.
The Script
Spoiler
#==============================================================
# Kio's Skill Learning System v1.5
#==============================================================
# At line 55 and afterwards you input how much XP each skill requires to learn.
# If you wish for the skill to be independant of this script and learned in the
# conventional manner, do not input anything for the skill ID.
# If at any time you want a learnable skill to be immediately learned, use
# this code in a call script:
# $game_actors[i].skill_xp[skill_id] == 0
# Where i = the ID of the actor, and skill_id = the ID of the skill.
#To set skills to be progressively learned, input the code skill.state = "primary" to
# begin the chain, and skill.state = "end" to finish it.
module RPG
class Skill
attr_accessor :xp
attr_accessor :state
end
end
class Game_Actor
attr_accessor :skill_xp
attr_accessor :total_xp
alias setup2 setup
def setup(actor_id)
@skill_xp = []
setup2(actor_id)
@total_xp = @exp
end
end
class Game_Party
alias add3 add_actor
def add_actor(actor_id)
add3(actor_id)
actor = $game_actors[actor_id]
for j in 1...$data_skills.size
actor.skill_xp[j] = $data_skills[j].xp
end
actor.total_xp = actor.exp
end
end
class Scene_Title
alias main_2 main
def main
main_2
for i in 1...$data_skills.size
skill = $data_skills[i]
case i
# Define the amount of needed xp each skill here.
when 1 # for skill id 1
skill.xp = nil # sets the xp required to learn
when 2 # for skill id 2, etc.
skill.xp = 20
skill.state = "primary" #sets the beginning of the learning chain
when 3
skill.xp = 30
when 4
skill.xp = 120
skill.state = "end" #sets the end of the learning chain
when 6
skill.xp = 5
else #if the skill isn't learnable through xp
skill.xp = nil
skill.state = nil
end
end
for i in 1...$data_actors.size
actor = $game_actors[i]
for j in 1...$data_skills.size
actor.skill_xp[j] = $data_skills[j].xp
end
end
for i in 1...$data_actors.size
actor = $game_actors[i]
actor.total_xp = actor.exp
end
end
alias cc_2 command_continue
def command_continue
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
cc_2
end
end
class Scene_Learn
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@window_skillxp = Window_Skillxp.new(@actor)
@window_skillxp.x =0
@window_skillxp.y =0
@window_skillxp.height = 480
@window_skillxp.width = 140
@window_skillxp.z = 200
@window_library = Window_Library.new(@actor)
@window_library.x =140
@window_library.y =0
@window_library.height = 480
@window_library.width = 500
@window_library.z = 200
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_skillxp.dispose
@window_library.dispose
end
def update
@window_skillxp.update
@window_library.update
if @window_library.active
update_window_library
return
end
end
def update_window_library
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(4)
return
end
if Input.repeat?(Input::C)
if $game_actors[@actor.id].total_xp != 0
if $game_actors[@actor.id].skill_xp[@window_library.skill.id] != 0 and $game_actors[@actor.id].skill_xp[@window_library.skill.id] != nil
$game_system.se_play($data_system.decision_se)
$game_actors[@actor.id].skill_xp[@window_library.skill.id] -=1
$game_actors[@actor.id].total_xp -=1
if $game_actors[@actor.id].skill_xp[@window_library.skill.id] == 0 and $data_skills[@window_library.skill.id].state == "primary"
$game_actors[@actor.id].learn_skill(@window_library.skill.id+1)
if $data_skills[@window_library.skill.id+1].state != "end"
$data_skills[@window_library.skill.id+1].state = "primary"
end
end
@window_skillxp.refresh
@window_library.refresh
return
else
return
end
end
Graphics.update
Input.update
end
end
end
class Window_Skillxp < Window_Base
attr_accessor :xp
def initialize(actor)
super(0, 0, 140, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
@actor = actor
@column_max = 1
actor = $game_actors[@actor.id]
@xp = actor.exp
for i in 1...$data_skills.size
if actor.skill_xp[i] != nil
@xp -= ($data_skills[i].xp - actor.skill_xp[i])
end
end
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
actor = $game_actors[@actor.id]
actor.total_xp = actor.exp
for i in 1...$data_skills.size
if actor.skill_xp[i] != nil
actor.total_xp -= ($data_skills[i].xp - actor.skill_xp[i])
end
end
self.contents = Bitmap.new(width - 32, height - 32)
draw_xp_bar(37, 40, 30, 400)
end
def draw_xp_bar(x, y, width, height)
actor = $game_actors[@actor.id]
self.contents.fill_rect(x - 4, y - 4, width + 10, height + 7, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-1, y-1, width+3, height + 2, Color.new(0, 0, 0, 255))
for i in 0..width
if actor.total_xp != 0
self.contents.fill_rect(x + i, y, 1, height * 1, Color.new(0, 255 - (3 * i), 0, 255))
self.contents.fill_rect(x + i, y, 1, height * (@xp - actor.total_xp) / @xp, Color.new(0, 0, 0, 255))
else
self.contents.fill_rect(x + i, y, 1, height * 0, Color.new(0, 255 - (3 * i), 0, 255))
end
end
self.contents.draw_text(x, 4, 128, 32, actor.total_xp.to_s + " XP", 0)
end
end
class Window_Library < Window_Selectable
attr_accessor :xp
def initialize(actor)
super(0, 0, 500,480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
@actor = actor
@column_max = 1
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in [email hidden]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
actor = $game_actors[@actor.id]
x = 4 + + index % 1 * (288 + 32)
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))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x + 32, y, 204, 32, skill.name, 0)
self.contents.font.color = normal_color
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.draw_text(x + 252, y, 200, 32, ($data_skills[skill.id].xp - actor.skill_xp[skill.id]).to_s + " / " + skill.xp.to_s + " XP", 2)
else
self.contents.draw_text(x + 252, y, 200, 32, "Learned!", 2)
end
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.fill_rect(x+170-1, y + 12 - 1, 172 + 2, 10 + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+170, y+12, 172, 10 + 1, Color.new(0, 0, 0, 255))
for i in 0..10
self.contents.fill_rect(x+170, y+12+i, 172 * ($data_skills[skill.id].xp - actor.skill_xp[skill.id]) / $data_skills[skill.id].xp, 1, Color.new(0, 0, 255 - (10 * i), 255))
end
end
end
end
class Game_Battler
#determines if the skill has been learned
alias skillxp_can_use? skill_can_use?
def skill_can_use?(skill_id)
if $data_skills[skill_id].xp != nil
if self.skill_xp[skill_id] == 0
else
return false
end
end
skillxp_can_use?(skill_id)
end
end
# Kio's Skill Learning System v1.5
#==============================================================
# At line 55 and afterwards you input how much XP each skill requires to learn.
# If you wish for the skill to be independant of this script and learned in the
# conventional manner, do not input anything for the skill ID.
# If at any time you want a learnable skill to be immediately learned, use
# this code in a call script:
# $game_actors[i].skill_xp[skill_id] == 0
# Where i = the ID of the actor, and skill_id = the ID of the skill.
#To set skills to be progressively learned, input the code skill.state = "primary" to
# begin the chain, and skill.state = "end" to finish it.
module RPG
class Skill
attr_accessor :xp
attr_accessor :state
end
end
class Game_Actor
attr_accessor :skill_xp
attr_accessor :total_xp
alias setup2 setup
def setup(actor_id)
@skill_xp = []
setup2(actor_id)
@total_xp = @exp
end
end
class Game_Party
alias add3 add_actor
def add_actor(actor_id)
add3(actor_id)
actor = $game_actors[actor_id]
for j in 1...$data_skills.size
actor.skill_xp[j] = $data_skills[j].xp
end
actor.total_xp = actor.exp
end
end
class Scene_Title
alias main_2 main
def main
main_2
for i in 1...$data_skills.size
skill = $data_skills[i]
case i
# Define the amount of needed xp each skill here.
when 1 # for skill id 1
skill.xp = nil # sets the xp required to learn
when 2 # for skill id 2, etc.
skill.xp = 20
skill.state = "primary" #sets the beginning of the learning chain
when 3
skill.xp = 30
when 4
skill.xp = 120
skill.state = "end" #sets the end of the learning chain
when 6
skill.xp = 5
else #if the skill isn't learnable through xp
skill.xp = nil
skill.state = nil
end
end
for i in 1...$data_actors.size
actor = $game_actors[i]
for j in 1...$data_skills.size
actor.skill_xp[j] = $data_skills[j].xp
end
end
for i in 1...$data_actors.size
actor = $game_actors[i]
actor.total_xp = actor.exp
end
end
alias cc_2 command_continue
def command_continue
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
cc_2
end
end
class Scene_Learn
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@window_skillxp = Window_Skillxp.new(@actor)
@window_skillxp.x =0
@window_skillxp.y =0
@window_skillxp.height = 480
@window_skillxp.width = 140
@window_skillxp.z = 200
@window_library = Window_Library.new(@actor)
@window_library.x =140
@window_library.y =0
@window_library.height = 480
@window_library.width = 500
@window_library.z = 200
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window_skillxp.dispose
@window_library.dispose
end
def update
@window_skillxp.update
@window_library.update
if @window_library.active
update_window_library
return
end
end
def update_window_library
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(4)
return
end
if Input.repeat?(Input::C)
if $game_actors[@actor.id].total_xp != 0
if $game_actors[@actor.id].skill_xp[@window_library.skill.id] != 0 and $game_actors[@actor.id].skill_xp[@window_library.skill.id] != nil
$game_system.se_play($data_system.decision_se)
$game_actors[@actor.id].skill_xp[@window_library.skill.id] -=1
$game_actors[@actor.id].total_xp -=1
if $game_actors[@actor.id].skill_xp[@window_library.skill.id] == 0 and $data_skills[@window_library.skill.id].state == "primary"
$game_actors[@actor.id].learn_skill(@window_library.skill.id+1)
if $data_skills[@window_library.skill.id+1].state != "end"
$data_skills[@window_library.skill.id+1].state = "primary"
end
end
@window_skillxp.refresh
@window_library.refresh
return
else
return
end
end
Graphics.update
Input.update
end
end
end
class Window_Skillxp < Window_Base
attr_accessor :xp
def initialize(actor)
super(0, 0, 140, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
@actor = actor
@column_max = 1
actor = $game_actors[@actor.id]
@xp = actor.exp
for i in 1...$data_skills.size
if actor.skill_xp[i] != nil
@xp -= ($data_skills[i].xp - actor.skill_xp[i])
end
end
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
actor = $game_actors[@actor.id]
actor.total_xp = actor.exp
for i in 1...$data_skills.size
if actor.skill_xp[i] != nil
actor.total_xp -= ($data_skills[i].xp - actor.skill_xp[i])
end
end
self.contents = Bitmap.new(width - 32, height - 32)
draw_xp_bar(37, 40, 30, 400)
end
def draw_xp_bar(x, y, width, height)
actor = $game_actors[@actor.id]
self.contents.fill_rect(x - 4, y - 4, width + 10, height + 7, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x-1, y-1, width+3, height + 2, Color.new(0, 0, 0, 255))
for i in 0..width
if actor.total_xp != 0
self.contents.fill_rect(x + i, y, 1, height * 1, Color.new(0, 255 - (3 * i), 0, 255))
self.contents.fill_rect(x + i, y, 1, height * (@xp - actor.total_xp) / @xp, Color.new(0, 0, 0, 255))
else
self.contents.fill_rect(x + i, y, 1, height * 0, Color.new(0, 255 - (3 * i), 0, 255))
end
end
self.contents.draw_text(x, 4, 128, 32, actor.total_xp.to_s + " XP", 0)
end
end
class Window_Library < Window_Selectable
attr_accessor :xp
def initialize(actor)
super(0, 0, 500,480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
@actor = actor
@column_max = 1
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in [email hidden]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
actor = $game_actors[@actor.id]
x = 4 + + index % 1 * (288 + 32)
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))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x + 32, y, 204, 32, skill.name, 0)
self.contents.font.color = normal_color
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.draw_text(x + 252, y, 200, 32, ($data_skills[skill.id].xp - actor.skill_xp[skill.id]).to_s + " / " + skill.xp.to_s + " XP", 2)
else
self.contents.draw_text(x + 252, y, 200, 32, "Learned!", 2)
end
if actor.skill_xp[skill.id] != 0 and $data_skills[skill.id].xp != nil
self.contents.fill_rect(x+170-1, y + 12 - 1, 172 + 2, 10 + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x+170, y+12, 172, 10 + 1, Color.new(0, 0, 0, 255))
for i in 0..10
self.contents.fill_rect(x+170, y+12+i, 172 * ($data_skills[skill.id].xp - actor.skill_xp[skill.id]) / $data_skills[skill.id].xp, 1, Color.new(0, 0, 255 - (10 * i), 255))
end
end
end
end
class Game_Battler
#determines if the skill has been learned
alias skillxp_can_use? skill_can_use?
def skill_can_use?(skill_id)
if $data_skills[skill_id].xp != nil
if self.skill_xp[skill_id] == 0
else
return false
end
end
skillxp_can_use?(skill_id)
end
end
Expand to see the code.
Kio's Skill Equip Addition v1.0
This is an addon for the skill learning script. It's kinda like Sephirothspawn's equipment skills script when combined, though way less code, and therefore way less options and flexibility. It can be used on it's own too if all you want is an item that grants the use of a skill to the players.
Directions:
Just view the script to get an idea of how it works, all the instructions are there as an example. It's only a few lines long anyways.
The Script
Spoiler
#==============================================================
# Kio's Skill Equip Addition v1.0
#==============================================================
class Scene_Equip
alias main2 main
def main
main2
#determine skills learned my armor here.
#weapon_id = weapon slot
#armor1_id = shield slot
#armor2_id = helmet slot
#armor3_id = body armor slot
#armor4_id = accessory slot
if @actor.armor3_id == 14 #Armor ID
@actor.learn_skill(6) #Skill ID
else
if $data_skills[6].xp != nil
unless @actor.skill_xp[6] == 0
@actor.forget_skill(6)
end
else
@actor.forget_skill(6)
end
end
#the above example would equip the 6th skill if the character is
#equipped with the 14th armor (as long as it's in the body armor slot)
end
end
# Kio's Skill Equip Addition v1.0
#==============================================================
class Scene_Equip
alias main2 main
def main
main2
#determine skills learned my armor here.
#weapon_id = weapon slot
#armor1_id = shield slot
#armor2_id = helmet slot
#armor3_id = body armor slot
#armor4_id = accessory slot
if @actor.armor3_id == 14 #Armor ID
@actor.learn_skill(6) #Skill ID
else
if $data_skills[6].xp != nil
unless @actor.skill_xp[6] == 0
@actor.forget_skill(6)
end
else
@actor.forget_skill(6)
end
end
#the above example would equip the 6th skill if the character is
#equipped with the 14th armor (as long as it's in the body armor slot)
end
end
Expand to see the code.
Kio's Reputation System v1.2
This system creates variables that can be used to determine how NPC's act towards a player. This also allows you to add factions as they are discovered by the player, and adjust their reputation with those factions depending on their course of action.
Directions:
This script would probably require a good bit of customized coding, and therefore isn't recommended for new scripters.
At around line 22, you can set the default reputation level for your factions, as well as which are active and which are not upon the start of the game. There are examples in the script already of this, refer to them if needed.
At around line 68, you can name your different factions, as well as name the different levels of reputation obtained. Again, there are examples in the script already of this, and refer to them if needed.
At line 118 an afterwards, you can determine the value needed to reach a certain reputation. for instance, the example in the script requires you to have a reputation of 90+ to be "Heroic."
To adjust reputation, call the following script:
$game_system.fac_rep[i] += n
Expand to see the code.
where i is the ID of the faction - 1, and n is the value you alter it by. For instance, to alter the reputation for the 4th faction by +8, you would call:
$game_system.fac_rep[3] += 8
Expand to see the code.
The Script
Spoiler
#==============================================================
# Kio's Reputation System v1.2
#==============================================================
class Game_System
attr_accessor :fac_rep
attr_accessor :fac_active
alias rep_initialize initialize
def initialize
rep_initialize
@fac_rep=[]
@fac_active=[]
end
end
class Scene_Title
alias cng command_new_game
def command_new_game
cng
#Determine the initial settings for the faction's reputations here
$game_system.fac_rep = [50, 44, 75, 24, 9, 56, 100]
#Determine the inital factions you can see here.
$game_system.fac_active = ["active", "active", "active", "active", "active", nil, nil]
end
end
class Scene_Reputation
def main
@status_window = Window_Reputation.new
@sprite = Spriteset_Map.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@status_window.dispose
@sprite.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
end
end
class Window_Reputation < Window_Base
attr_accessor :factions
attr_accessor :fac_rep
attr_accessor :reptypes
attr_accessor :fac_active
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
self.back_opacity = 120
@factions = ["Royal Family", "Church of Avelius", "Nobles", "Peasants", "Outlanders", "Order of White", "Crestguarde"]
@rep = ["Heroic", "Honored", "Friendly", "Neutral", "Unfriendly", "Hated", "Despised"]
refresh
end
def draw_repbar(x, y, width, height, current, max)
x -= 10
for i in 0..(height+2)
self.contents.fill_rect(x-3+i, y - 1 + i, width+5, 1, Color.new(255, 255, 255, 255))
end
for i in 0..height
self.contents.fill_rect(x+i, y+i, width+1, 1, Color.new(0, 0, 0, 255))
end
for i in 0..height
for j in 0..current
self.contents.fill_rect(x+j+i, y+i, 1, 1, Color.new(0, 0 + (1.25*j), 255 - (1.25*j), 255 - (5*i)))
end
end
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 32
self.contents.draw_text(20, 40, 184, 32, "Reputation", 2)
self.contents.font.size = $fontsize
for i in [email hidden]
y = 80 + (i * 70)
x = -30
if i > 4
x = 280
y = 80 + ((i - 5) * 70)
end
if $game_system.fac_rep[i] > 100
$game_system.fac_rep[i] = 100
end
if $game_system.fac_rep[i] < 0
$game_system.fac_rep[i] = 0
end
if $game_system.fac_active[i] == "active"
draw_fac(x, y, i)
end
self.contents.font.color = normal_color
end
end
def draw_fac(x, y, i)
self.contents.draw_text(x+40, y, 160, 32, @factions[i], 0)
draw_repbar(x+90, y+32, 200, 14, 2 * $game_system.fac_rep[i], 100)
self.contents.font.color = system_color
if $game_system.fac_rep[i] >= 90
self.contents.draw_text(x+210, y, 96, 32, @rep[0], 2)
elsif $game_system.fac_rep[i] >= 75
self.contents.draw_text(x+210, y, 96, 32, @rep[1], 2)
elsif $game_system.fac_rep[i] >= 55
self.contents.draw_text(x+210, y, 96, 32, @rep[2], 2)
elsif $game_system.fac_rep[i] >= 45
self.contents.draw_text(x+210, y, 96, 32, @rep[3], 2)
elsif $game_system.fac_rep[i] >= 25
self.contents.draw_text(x+210, y, 96, 32, @rep[4], 2)
elsif $game_system.fac_rep[i] >= 10
self.contents.draw_text(x+210, y, 96, 32, @rep[5], 2)
else
self.contents.draw_text(x+210, y, 96, 32, @rep[6], 2)
end
end
end
# Kio's Reputation System v1.2
#==============================================================
class Game_System
attr_accessor :fac_rep
attr_accessor :fac_active
alias rep_initialize initialize
def initialize
rep_initialize
@fac_rep=[]
@fac_active=[]
end
end
class Scene_Title
alias cng command_new_game
def command_new_game
cng
#Determine the initial settings for the faction's reputations here
$game_system.fac_rep = [50, 44, 75, 24, 9, 56, 100]
#Determine the inital factions you can see here.
$game_system.fac_active = ["active", "active", "active", "active", "active", nil, nil]
end
end
class Scene_Reputation
def main
@status_window = Window_Reputation.new
@sprite = Spriteset_Map.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@status_window.dispose
@sprite.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
end
end
class Window_Reputation < Window_Base
attr_accessor :factions
attr_accessor :fac_rep
attr_accessor :reptypes
attr_accessor :fac_active
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
self.contents.font.color = text_color(0)
self.back_opacity = 120
@factions = ["Royal Family", "Church of Avelius", "Nobles", "Peasants", "Outlanders", "Order of White", "Crestguarde"]
@rep = ["Heroic", "Honored", "Friendly", "Neutral", "Unfriendly", "Hated", "Despised"]
refresh
end
def draw_repbar(x, y, width, height, current, max)
x -= 10
for i in 0..(height+2)
self.contents.fill_rect(x-3+i, y - 1 + i, width+5, 1, Color.new(255, 255, 255, 255))
end
for i in 0..height
self.contents.fill_rect(x+i, y+i, width+1, 1, Color.new(0, 0, 0, 255))
end
for i in 0..height
for j in 0..current
self.contents.fill_rect(x+j+i, y+i, 1, 1, Color.new(0, 0 + (1.25*j), 255 - (1.25*j), 255 - (5*i)))
end
end
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 32
self.contents.draw_text(20, 40, 184, 32, "Reputation", 2)
self.contents.font.size = $fontsize
for i in [email hidden]
y = 80 + (i * 70)
x = -30
if i > 4
x = 280
y = 80 + ((i - 5) * 70)
end
if $game_system.fac_rep[i] > 100
$game_system.fac_rep[i] = 100
end
if $game_system.fac_rep[i] < 0
$game_system.fac_rep[i] = 0
end
if $game_system.fac_active[i] == "active"
draw_fac(x, y, i)
end
self.contents.font.color = normal_color
end
end
def draw_fac(x, y, i)
self.contents.draw_text(x+40, y, 160, 32, @factions[i], 0)
draw_repbar(x+90, y+32, 200, 14, 2 * $game_system.fac_rep[i], 100)
self.contents.font.color = system_color
if $game_system.fac_rep[i] >= 90
self.contents.draw_text(x+210, y, 96, 32, @rep[0], 2)
elsif $game_system.fac_rep[i] >= 75
self.contents.draw_text(x+210, y, 96, 32, @rep[1], 2)
elsif $game_system.fac_rep[i] >= 55
self.contents.draw_text(x+210, y, 96, 32, @rep[2], 2)
elsif $game_system.fac_rep[i] >= 45
self.contents.draw_text(x+210, y, 96, 32, @rep[3], 2)
elsif $game_system.fac_rep[i] >= 25
self.contents.draw_text(x+210, y, 96, 32, @rep[4], 2)
elsif $game_system.fac_rep[i] >= 10
self.contents.draw_text(x+210, y, 96, 32, @rep[5], 2)
else
self.contents.draw_text(x+210, y, 96, 32, @rep[6], 2)
end
end
end
Expand to see the code.
The other scripts in the demo are not supported yet, but feel free to try them out. they will be up on the site soon.
The Demo
Click Here.
Compatibility
Should be compatible with most sccripts, though not sure about SDK since i don't understand it's workings yet. I'll get on that.