KPartyActors XP - kyonides - 12-30-2021
KPartyActors XP
by Kyonides
Introduction
Usually RMXP lets you upgrade your heroes by leveling them up. This script completely changes that reality by introducing a party level handicap of sorts. You can't keep leveling up if the party as a whole doesn't do the same.
It also sports the custom skills and battle skills features. Now your heroes can only use their preselected battle skills during those tough battles!
I guess that adds some level of complexity and promotes the development of strategies and tactics in game.
Warning!
I have overwritten a few default methods so please read the embedded comments first.
The FixedArray script is now required by the script posted below.
The Script
Code: # * KPartyActors XP
# Scripter : Kyonides Arkanthes
# 2022-01-01
# Requires: FixedArray
# Leveling up an actor will depend on your current party's level.
# EXP does not affect an actor's level so it can be used as a
# secondary ingame currency now.
# This script also features the kustom_skills and battle_skills!
# kustom_skills are skills the player have purchased that were not supposed
# to be learned by a given actor.
# battle_skills are a subset of all of the skills learned by any actor.
# * Overwritten Methods * #
# - Game_Actor class
# exp= level= skills skill_learn?
# - Window_Skill class
# refresh
# * Script Calls * #
# - Change current Party's Level
# $game_party.level = NewLevel
# $game_party.level += Levels
# $game_party.level -= Levels
# - Change Party's Maximum Level
# $game_party.level_max = NewLevelMax
# $game_party.level_max += MoreLevels
# $game_party.level_max -= LessLevels
# - Toggle Freezing of Level Up feature
# Default Value: false
# $game_party.freeze_level_up = true or false
# - Get a Party Member - Prerequisite
# actor = $game_party.actors[Index]
# - Get Current Maximum Number of Kustom Skills or Battle Skills
# actor.kustom_skills_max
# actor.battle_skills_max
# - Set New Maximum Number of Kustom Skills or Battle Skills
# actor.kustom_skills.maxsize = +Number
# actor.battle_skills.maxsize = +Number
# - Add New Kustom Skill or Battle Skill
# Returns either a new array or the old one if it remained the same.
# actor.add_kustom_skill(SkillID)
# actor.add_battle_skill(SkillID)
module KParty
LEVEL_MAX = 20
LVLS_PER_PARTY_LVL = 3
KUSTOM_SKILL_MAX = 1
BATTLE_SKILL_MAX = 5
end
class Game_Party
alias :kyon_party_lvl_gm_pty_init :initialize
def initialize
kyon_party_lvl_gm_pty_init
@freeze_level_up = false
@level_max = KParty::LEVEL_MAX
@level = 0
end
def level=(n)
return @level if @freeze_level_up and @level < n
@level = [[0, @level].max, @level_max].min
end
def actor_level_max() KParty::LVLS_PER_PARTY_LVL * (@level + 1) end
attr_reader :level
attr_accessor :level_max, :freeze_level_up
end
class Game_Actor
alias :kyon_party_lvl_gm_actor_setup :setup
def setup(actor_id)
@kustom_skills = FixedArray.new(KParty::KUSTOM_SKILL_MAX)
@battle_skills = FixedArray.new(KParty::BATTLE_SKILL_MAX)
kyon_party_lvl_gm_actor_setup(actor_id)
end
def level=(n)
n = [[n, db_actor.final_level].min, 1].max
@level = $game_party.actor_level_max < n ? @level : n
end
def db_actor() $data_actors[@actor_id] end
def exp=(n) @exp = [n, 0].max end
def skills() @skills + @kustom_skills end
def skillset() $game_temp.in_battle ? @battle_skills : self.skills end
def skill_learn?(skill_id) self.skills.include?(skill_id) end
def add_kustom_skill(skill_id) @kustom_skills << skill_id end
def add_battle_skill(skill_id) @battle_skills << skill_id end
def kustom_skills_max() @kustom_skills.maxsize end
def battle_skills_max() @battle_skills.maxsize end
def class_learnings() $data_classes[@class_id].learnings end
attr_reader :kustom_skills, :battle_skills
end
class Window_Skill
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@actor.skillset.each{|s| @data << $data_skills[s] }
@data = @data.compact
@item_max = @data.size
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
@item_max.each{|i| draw_item(i) }
end
end
FAQ
This script does not include any full fledged custom menu of my own.
Terms & Conditions
Include me in your game credits.
Send me a copy of your complete game if you include two or more of my scripts.
Free for non commercial games. Contact me if you want to go commercial.
RE: KPartyActors XP - kyonides - 01-01-2022
KExpSkills XP
by Kyonides Arkanthes
Introduction
This would be KPartyActors XP's skill menu if I ever finish it.
So far it only sports a face or battler or character and an EXP book.
Code: # * KExpSkills XP
# Scripter : Kyonides Arkanthes
# 2022-01-02
# Requires: KPartyActors XP
# Use EXP to buy a preset list of skills at the custom skill shop.
# * Script Call * #
# $scene = ExpSkill::Scene.new(ActorIndex)
module ExpSkill
SCENE_BACKDROP = ""
EXP_BOX_X = 8
EXP_BOX_Y = 440
EXP_BOX_X_MARGIN = 52
EXP_BOX_BACKDROP = "exp box"
EXP_BOX_FONT_COLOR = [255, 255, 255]
AVATAR_X = 8
AVATAR_Y = 8
@picture_mode = :face
extend self
attr_accessor :picture_mode
class Box
def initialize(sx, sy, margin)
@margin_x = margin
@sprites = []
@sprites << @backdrop = Sprite.new
@sprites << @points_box = Sprite.new
@backdrop.x = sx
@backdrop.y = sy
@points_box.x = sx + @margin_x
@points_box.y = sy
end
def draw_backdrop(name, exp)
@backdrop.bitmap = b = RPG::Cache.picture(name)
@points_box.bitmap = Bitmap.new(b.width - @margin_x, b.height)
draw_exp(exp)
end
def draw_exp(exp)
bm = @points_box.bitmap
bm.clear
r, g, b = EXP_BOX_FONT_COLOR
bm.font.color.set(r, g, b)
bm.draw_text(0, 0, bm.width - 4, bm.height, exp.to_s, 2)
end
def dispose
@sprites.each do |sprite|
sprite.bitmap.dispose
sprite.dispose
end
end
end
module RPG::Cache
def self.face(filename) load_bitmap("Graphics/Faces/", filename) end
end
class Spriteset
def initialize(actor)
@backdrop = Sprite.new
@backdrop.bitmap = RPG::Cache.title(SCENE_BACKDROP)
@points_box = Box.new(EXP_BOX_X, EXP_BOX_Y, EXP_BOX_X_MARGIN)
@points_box.draw_backdrop(EXP_BOX_BACKDROP, actor.exp)
@avatar = Sprite.new
@avatar.x = AVATAR_X
@avatar.y = AVATAR_Y
a = actor
case ExpSkill.picture_mode
when :battle, :battler
@avatar.bitmap = RPG::Cache.battler(a.battler_name, a.battler_hue)
when :char, :character
@avatar.bitmap = RPG::Cache.character(a.character_name, a.character_hue)
when :face
@avatar.bitmap = RPG::Cache.face(a.character_name)
end
@sprites = [@backdrop, @avatar]
end
def dispose
@points_box.dispose
@sprites.each do |sprite|
sprite.bitmap.dispose
sprite.dispose
end
end
end
class Scene
def initialize(pos=0)
@index = pos
@total = $game_party.actors.size
@actor = $game_party.actors[pos]
@learnings = @actor.class_learnings
end
def main
@stage = :main
@spriteset = Spriteset.new(@actor)
Graphics.transition
while @stage
Graphics.update
Input.update
update
end
Graphics.freeze
@spriteset.dispose
end
def update
case @stage
when :main
update_main
end
end
def change_actor(n)
return $game_system.se_play($data_system.buzzer_se) if @total == 1
$game_system.se_play($data_system.cursor_se)
pos = (@index + n) % @total
$scene = Scene.new(pos)
@stage = nil
end
def update_main
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return @stage = nil
elsif Input.trigger?(Input::L)
return change_actor(-1)
elsif Input.trigger?(Input::R)
return change_actor(1)
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
end
end
end
end
This script's terms & conditions are the same as the main script's.
RE: KPartyActors XP - kyonides - 01-02-2022
Minor Code Update
The simple FixedArray script is now required by KPartyActors XP. The reasoning behind this move is that it easily allows the game developer to keep a fixed number of custom or battle skills at the player's reach in any given moment. I guess it would encourage the player to plan strategically the way he or she will pick the corresponding skills.
The embedded comments also feature more script calls than in previous versions.
I have edited the second post to include the KExpSkills XP script alias KPartyActors XP's skill menu script.
I know, I still need to work on a GUI that will allow you to actually perform such a skill selection in the first place.
|