10 hours ago
(This post was last modified: 10 hours ago by DerVVulfman.)
Adeyemi's Armament Proficiency
Version: 1.0
Version: 1.0
Introduction
This script allows you to give actors the ability to increase their skill with a select group of weapons. It does so by giving an actor's defined combination of weapons a level with experience to gain during use. And as their level increases, so to does their base attack used in all manners of combat.
Features
- Define weapon style sets, so a collection of swords (by ID) could be one set and you gain proficiency with all of a given set
- Sets have levels, so proficiency is those sets gaining their own experience
- The player's own Experience Points or Level curve is used. So proficiency with weapons can be different per actor.
- You can gauge how much or little bonus to the base attack score per level
Bonus Features
- The in-game removal of class weapon limits. You may need to set a hero's weapon based on their class in the editor. But in-game, a wizard could use a broadsword.
- Option to allow for unarmed combat.
- Class and/or Actor based penalties for defined weapon use. So instead of saying it cannot be used by that class, their attack rolls will suck.
Screenshots
Nothing to see here, pal.
Demo
Nope.
Script
The Script
Code:
#==============================================================================
# ** Adeyemi's Armament Proficiency
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 04-18-2025 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
#
# This script allows you to give actors the ability to increase their skill
# with a select group of weapons. It does so by giving an actor's defined
# combination of weapons a level with experience to gain during use. And as
# their level increases, so to does their base attack used in all manners
# of combat.
#
# Bonus features include:
#
# * The in-game removal of class weapon limits. You may be forced to set a
# specific weapon to an actor at game start. But as the game goes on, any
# actor can use any weapon defined in the Weapons database.
#
# * Option to allow for unarmed combat. The system will use the actor's un-
# adjusted Strength score (no weapon or armor bonuses) in the base_atk's
# place. It also includes options to set user and target animation IDs.
#
# * Class and/or Actor based penalties for defined weapon use. So besides
# giving one proficiency, it can lower the base_atk score for any actor
# or character class using weapons they shouldn't. As an example, you may
# set up a mages's class to suffer a 25% penalty to their base_atk score
# if they used axes or maces (as defined by their IDs).
# or classes
#
# I wrote the instructions into the coonfiguration section. Enjoy.
#
#
#------------------------------------------------------------------------------
#
# NOTES:
#
# The base_atk value (be it from Game_Actor or Game_Enemy) is used by the
# Game_Battler class to calculate the 'atk' value used for any/all attack
# and skill effect systems (not item). Neither the default main menu nor
# any other menu screens depicting this value.
#
# When I created the 'weapon_prof_chance' method within Game_Battler on
# line 424, I did so with the expectation of making add-ons that can in-
# fluence the actor's chance of success when gaining experience points.
#
# When you create a weapon style with the WEAP_STYLE hash array, you give
# each style a name. Couple that with the leveling system, prospective
# scripters could create updates to the Equip, Status any similar menu to
# show their weapon proficiency levels by name.
#
#
#------------------------------------------------------------------------------
#
# NOTES:
#
# I named this after a friend and former co-worker whom I found out today is
# no longer with us. I wrote it for remembrance.
#
#
#------------------------------------------------------------------------------
#
# COMPATIBILITY:
#
# Fairly compatible for RPGMaker XP systems as there are no rewrites to any
# classes, all content using aliased methods.
#
#
#==============================================================================
#
# TERMS OF USE:
#
# Free for use, even in commercial games. Only due credit is required.
#
#
#==============================================================================
module Yemi
#--------------------------------------------------------------------------
# DO NOT TOUCH
#--------------------------------------------------------------------------
WEAP_STYLE, WEAP_CLASS, WEAP_ACTOR, WEAP_SKILL, WEAP_BONUS = {},{},{},{}
WEAP_BONUS, WEAP_C_LOSS, WEAP_A_LOSS = {},{},{}
#--------------------------------------------------------------------------
# UNARMED STYLE
# =============
# As a bonus, the system allows you to use the actor's unadjusted strength
# score as their base attack score. This means, the stronger they become,
# the more damage they can do even if unarmed. Though it would still pale
# in comparison to being armed. And the attack animation can be set too.
#--------------------------------------------------------------------------
#
UNARMED_STRENGTH = true # If true, allows STR as base attack if unarmed
UNARMED_USER = 0 # ID for user animation (or nil/0 to disable)
UNARMED_TARGET = 4 # ID for target animation (or nil/0 to disable)
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# WEAPON STYLES
# =============
# A list of individual style sets: A style set consists of the name of the
# style along with other options related to that style:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Name: Name of the styleset
# * Ch: Chance of gaining exp per successful hit
# * Weapon IDs: List of all weapons for a given styleset
# * Exp #1: Exp gained for a successful strike and on chance
# * Exp #2: (Optional) Exp gained for a skill effect that uses weapons
# * If not set, will use Exp #1:
# * Requires skills that recognize weapons (WEAP_SKILL)
#--------------------------------------------------------------------------
#
# ID Name Ch. Weapon IDs Exp Exp
# == ============== === ==================== === ===
WEAP_STYLE[1] = [ 'Blademaster', 70, [1,2,3,4,13,14,15,16], 0.5, 1 ]
WEAP_STYLE[2] = [ 'Barbasettian', 80, [13,14,15,16], 1, 1.2 ]
WEAP_STYLE[3] = [ 'Archer', 100, [17,18,19,20], 2 ]
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# ASSIGNED WEAPON STYLES
# ======================
# This section applies weapon styles to character classes and actors alike.
# Do know that duplicates are removed.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Class/Actor ID: ID of the actor or class depending on the hash array
# * Weapon Styles: The ID(s) of the weapon styles defined above within
# WEAPON STYLES section.
# * If a single actor is defined a Weapon Style within
# the WEAP_CLASS array and the same style within the
# WEAP_ACTOR array, the system will recognize this
# duplication and will remove the duplicate instance.
#--------------------------------------------------------------------------
#
# Class ID Weaspon Style(s)
# ======== ================
WEAP_CLASS[1] = [1] # (1)Fighters use Blademaster (swords/knives)
WEAP_CLASS[4] = [2] # (4)Thieves use Barbasettian (knifes)
WEAP_CLASS[5] = [2,3] # (5)Hunters use Archer(bows) and Barbasettian
# Actor ID Weaspon Style(s)
# ======== ================
WEAP_ACTOR[1] = [1,3] # (1)Aluxes is a Blademaster and Archer
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# ASSIGNED WEAPON PENALTIES
# =========================
# This section will apply percentage based penalties to the actor's base atk
# score if any weapons defined are being used. There are two hash arrays in
# which to accomplish this, and the effects CAN be cumulative.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Class/Actor ID: ID of the actor or class depending on the hash array
# * Per: Percentage of Base Attack loss (ie 20 is -20% loss).
# * Weapon IDs: List of all weapons that deliver the penalty
# * NOTE: The effects are cumulative. In the below
# example, Basil (as a lancer) would lose 20% of his
# base_atk score from the CLASS penalty and an addi-
# tional 25% loss just for his ACTOR penalty. OUCH!
#--------------------------------------------------------------------------
#
# Class ID Per Weaspon IDs
# ======== === ================
WEAP_C_LOSS[2] = [ 20, [1,2,3,4,5,6,7,8]] #(2)Lancer no swords/lances
#
# Actor ID Per Weaspon IDs
# ======== === ================
WEAP_A_LOSS[2] = [ 25, [5,6,7,8]] #(2)Basil no more lances
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# SKILLS THAT USE WEAPONS
# =======================
# This section defines those combat skills that are assumed tied to a spe-
# cific weapon (such as Bird Killer for Bow use hence the animations). With-
# out this, weapon proficiency when using combat skill attacks would not be.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Skill ID: ID of the skill tested for weapon proficiency gains
# * Weapon IDs: List of all weapons that are aligned to that skill
#--------------------------------------------------------------------------
#
# Skill ID Weaspon ID(s)
# ======== =============
WEAP_SKILL[57] = [ 1,2,3,4] # Sword Use Skills
WEAP_SKILL[58] = [ 1,2,3,4]
WEAP_SKILL[59] = [ 1,2,3,4]
WEAP_SKILL[60] = [ 1,2,3,4]
WEAP_SKILL[69] = [ 13,14,15,16] # Dagger Use Skills
WEAP_SKILL[70] = [ 13,14,15,16]
WEAP_SKILL[71] = [ 13,14,15,16]
WEAP_SKILL[72] = [ 13,14,15,16]
WEAP_SKILL[73] = [ 17,18,19,20] # Bow Use Skills
WEAP_SKILL[74] = [ 17,18,19,20]
WEAP_SKILL[75] = [ 17,18,19,20]
WEAP_SKILL[76] = [ 17,18,19,20]
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# LEVEL GAIN ADJUSTMENT
# =====================
# The weapon sets for any actor is based upon the same experience curve as
# the actor's own experience point leveling curve. This means the weapon
# style levels can reach level 100 if so defined. However, this section may
# assist you in slowing down the rate of style set leveling and limit how
# many levels that the weapon style sets can attain.
#
# These levels are important for the LEVEL ATTACK BONUS ADJUSTMENT below.
#--------------------------------------------------------------------------
#
LEVEL_DIVIDE = 3 # Set to 3. The higher the rate, the slower the gain.
# If set to 1, it is normal. Nothing lower than 1.
LEVEL_MAX = 5 # Set to 5, the sets cannot go beyond level 5.
# If set to 1, sets won't grow. Nothing lower than 1.
#--------------------------------------------------------------------------
# * * * * *
#--------------------------------------------------------------------------
# LEVEL ATTACK BONUS ADJUSTMENT
# =============================
# This final area defines what bonus the actors have when using weapons which
# they are skilled and trained (based on their applied weapon sets). It is
# assumed that all values are from 1.0 or higher to assume base attack growth
# as a value lower would be a penalty.
#
# The below example only has five WEAP_BONUS entries as I set the MAX_LEVEL
# value (above) to 5. I could set MAX_LEVEL to 10 and make five more entries,
# but opted not. Just so ya know, it is flexible.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Level ID: The level for any weapon set to give the defined bonus
# * Multiplier: A multiplier bonus to the Base Atk value
# * Normally a Level 1 set would have a 1.0 multiplier.
# But here I thought... they were already training. ^_^
#--------------------------------------------------------------------------
#
# Level ID Multiplier
# ======== ==========
WEAP_BONUS[1] = 1.10 # Assumes slightly more knowledgeable..?
WEAP_BONUS[2] = 1.2
WEAP_BONUS[3] = 1.35
WEAP_BONUS[4] = 1.5
WEAP_BONUS[5] = 1.7
end
#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGXP's data structures and more.
#==============================================================================
module RPG
#--------------------------------------------------------------------------
# * Clear all class weapon limitations
#--------------------------------------------------------------------------
def RPG.class_clear
#
return if @initialized_class_clear # Exit if executed
for classes in $data_classes # Cycle thru classes
next if classes.nil? # Skip invalid class
classes.weapon_set = [] # Clear weapon set
for weapon in $data_weapons # Cycle thru weapons
next if weapon.nil? # Skip invalid weapons
classes.weapon_set.push(weapon.id) # Push all weapon IDs
end
end
@initialized_class_clear = true # Flag executed
#
end
#--------------------------------------------------------------------------
# * RPG Initialized Class Clearing
# bool : boolean value (true/false)
#--------------------------------------------------------------------------
def RPG.initialized_class_clear=(bool)
#
@initialized_class_clear = bool # Set/reset flag
#
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
alias yemi_battler_attack_effect attack_effect
alias yemi_battler_skill_effect skill_effect
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
#
hp_test = self.hp # Get hp test value
effective = yemi_battler_attack_effect(attacker) # Perform the method
hp_retest = self.hp # Get current HP
if hp_retest != hp_test # If HP changed
attack_effect_weapon_prof(attacker) # Run weapon prof
end
return effective # Exit effective
#
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
#
hp_test = self.hp # Get hp test value
effective = yemi_battler_skill_effect(user, skill) # Perform the method
hp_retest = self.hp # Get current HP
if hp_retest != hp_test # If HP changed
skill_effect_weapon_prof(user, skill) # Run weap/skill prof
end
return effective # Exit effective
#
end
#--------------------------------------------------------------------------
# * Get Normal Attack Weapon Proficiency
# aggressor : battler performing melee/attack
#--------------------------------------------------------------------------
def attack_effect_weapon_prof(aggressor)
#
return unless aggressor.is_a?(Game_Actor) # Exit if not an actor
return if aggressor.prof_weapon == [] # Exit if no profs.
for prof_id in aggressor.prof_weapon # Cycle through styles
weapon_prof_exp(aggressor, prof_id) # Process experience
end
#
end
#--------------------------------------------------------------------------
# * Get Skill Effect Weapon Proficiency
# aggressor : battler performing skill
# skill : skill
#--------------------------------------------------------------------------
def skill_effect_weapon_prof(aggressor, skill)
#
skill_weaps = Yemi::WEAP_SKILL[skill.id] # Get weaps array
weap_id = aggressor.weapon_id # Get current weapon
return unless aggressor.is_a?(Game_Actor) # Exit if not an actor
return if aggressor.prof_weapon == [] # Exit if no profs
return if skill_weaps.nil? # Exit no weaps array
return unless skill_weaps.include?(weap_id) # Exit skill no weaps
for prof_id in aggressor.prof_weapon # Cycle through styles
weapon_prof_exp(aggressor, prof_id, true) # Process experience
end
#
end
#--------------------------------------------------------------------------
# * Set Weapon Proficiency Experience
# aggressor : battler performing skill
# prof_id : ID of proficiency skill for aggressor
# is_skill : if skill Exp or melee Exp
#--------------------------------------------------------------------------
def weapon_prof_exp(aggressor, prof_id, is_skill=false)
#
weap_id = aggressor.weapon_id # Get current weapon
prof_style = Yemi::WEAP_STYLE[prof_id] # Get style array
chance = prof_style[1] # Get chance
prof_list = prof_style[2] # Get weapon list
prof_exp = prof_style[3] # Get melee experience
prof_exp = prof_style[4] if is_skill # Get skill experience
prof_exp = prof_style[3] if prof_exp.nil? # Melee if no skill
return unless weapon_prof_chance(aggressor, chance) # Exit if chance fails
return unless prof_list.include?(weap_id) # Exit if no weapon
aggressor.prof_weapon_exp[prof_id] += prof_exp # Increase style exp
#
end
#--------------------------------------------------------------------------
# * Set Weapon Proficiency Experience
# aggressor : battler (unused, but present for adaptation)
# chance : chance of success for that weapon set
#--------------------------------------------------------------------------
def weapon_prof_chance(aggressor, chance)
#
effective = (rand(100) < chance) # Get chance success
return effective # Exit with outcome
#
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :prof_weapon # Weapon proficiency list
attr_accessor :prof_weapon_exp # Weapon proficiency experience
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias yemi_actor_setup setup
alias yemi_actor_base_atk base_atk
alias yemi_actor_animation1_id animation1_id
alias yemi_actor_animation2_id animation2_id
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
yemi_actor_setup(actor_id) # Perform the method
setup_proficiencies_weapon # Setup weapon profs
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def base_atk
#
score = yemi_actor_base_atk # Perform the method
score = unarmed_atk_test(score) # Calc Unarmed STR?
score = weapon_penalty_change(score) # Adj for penalty
score = weapon_proficiency_change(score) # Adj for proficiency
return score.to_i # Exit with score
#
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation1_id
#
weapon = $data_weapons[@weapon_id] # Get weapon
id = yemi_actor_animation1_id # Get user anim ID
return id if id > 0 # Exit if anim over 0
return id unless Yemi::UNARMED_STRENGTH # Exit if no Unarmed
return id if Yemi::UNARMED_USER == nil # Exit if no anim ID
return Yemi::UNARMED_USER # Exit with custom ID
#
end
#--------------------------------------------------------------------------
# * Get Target Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation2_id
#
weapon = $data_weapons[@weapon_id] # Get weapon
id = yemi_actor_animation2_id # Get target anim ID
return id if id > 0 # Exit if anim over 0
return id unless Yemi::UNARMED_STRENGTH # Exit if no Unarmed
return id if Yemi::UNARMED_TARGET == nil # Exit if no anim ID
return Yemi::UNARMED_TARGET # Exit with custom ID
#
end
#--------------------------------------------------------------------------
# * Setup Proficiencies in Weapons
#--------------------------------------------------------------------------
def setup_proficiencies_weapon
#
@prof_weapon = [] # Clear proficiencies
if Yemi::WEAP_CLASS.has_key?(@class_id) # If class proficiency
for id in Yemi::WEAP_CLASS[@class_id] # Cycle through styles
@prof_weapon.push(id) # Push styles
end
end
if Yemi::WEAP_ACTOR.has_key?(@actor_id) # If actor proficiency
for id in Yemi::WEAP_ACTOR[@actor_id] # Cycle through styles
@prof_weapon.push(id) # Push styles
end
end
@prof_weapon.uniq! # Remove duplicates
size = @prof_weapon.size # Get number of styles
@prof_weapon_exp = [nil] + Array.new(size, 0.0) # Make style exp array
#
end
#--------------------------------------------------------------------------
# * Get Strength Score for Attack Power if set
# score : base_atk score
#--------------------------------------------------------------------------
def unarmed_atk_test(score)
#
return score if @weapon_id != 0 # Exit on weapon use
return score if Yemi::UNARMED_STRENGTH != true # Exit if not enabled
n = $data_actors[@actor_id].parameters[2, @level] # Get untouched STR
return [[n, 1].max, 999].min # Return/use STR score
#
end
#--------------------------------------------------------------------------
# * Get Weapon Proficiency Penalty
# score : base_atk score
#--------------------------------------------------------------------------
def weapon_penalty_change(score)
#
return score if score == 0 # Exit if '0' score
test = false # Assume failure
test = true if Yemi::WEAP_C_LOSS.has_key?(@class_id) # True if class loss
test = true if Yemi::WEAP_A_LOSS.has_key?(@actor_id) # True if actor loss
return score unless test # Exit unless true
loss_test = Yemi::WEAP_C_LOSS[@class_id] # Get class loss
score = weapon_penalty_calc(score, loss_test) # Execute class loss
loss_test = Yemi::WEAP_A_LOSS[@actor_id] # Get actor loss
score = weapon_penalty_calc(score, loss_test) # Execute actor loss
return score.to_i # Exit with score
#
end
#--------------------------------------------------------------------------
# * Get Weapon Proficiency Bonus
# score : base_atk score
# loss_array : penalty array
#--------------------------------------------------------------------------
def weapon_penalty_calc(score, loss_array)
#
return score if loss_array.nil? # Exit if no penalty
penalty = loss_array[0].to_f # Get penalty percent
weapons = loss_array[1] # Get penalty weapons
return score unless weapons.include?(@weapon_id) # Exit if not weapon
score *= ((100-penalty)/100) # Reduce by percent
return score.to_i # Exit with score
#
end
#--------------------------------------------------------------------------
# * Get Weapon Proficiency Bonus
# score : base_atk score
#--------------------------------------------------------------------------
def weapon_proficiency_change(score)
#
return score if @prof_weapon == [] # Exit if no profs.
level = weapon_proficiency_level # Get proficiency lvl
return score if level.nil? # Exit if no level
return score if level == 0 # Exit if 0 level
return score if level > Yemi::MAX_LEVEL # Exit if too high
score *= Yemi::WEAP_BONUS[level] # Increase by bonus
return score.to_i # Exit with score
#
end
#--------------------------------------------------------------------------
# * Get Weapon Proficiency Level
#--------------------------------------------------------------------------
def weapon_proficiency_level
#
exp, idx = 0, 0 # Exit with score
for prof_id in @prof_weapon # Cycle through styles
idx += 1 # Increase index
prof_style = Yemi::WEAP_STYLE[prof_id] # Get style
prof_list = prof_style[2] # Get weapon list
next unless prof_list.include?(@weapon_id) # Skip if no weapon
exp = @prof_weapon_exp[idx] # Get Exp score
break # Break from loop
end
exp = [[exp, 9999999].min, 0].max # Keep exp in range
level = 1 # Assume lvl 1 start
while exp >= @exp_list[level+1] # Exp is above level?
level += 1 # Increase level by 1
end
l_divide = Yemi::LEVEL_DIVIDE # Get divide amount
l_divide = 1 if l_divide < 1 # Its no lower than 1
level = (level/l_divide).to_i # Divide level
l_max = Yemi::LEVEL_MAX # Get max level
l_max = 1 if l_max < 1 # Its no lower than 1
level = [[level, l_max].min, 0].max # Keep within range
return level # Exit with level
#
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias yemi_title_main main
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
RPG.initialized_class_clear = false # Reset initialization
yemi_title_main # Perform the method
RPG.class_clear # Run new RPG method
#
end
end
FAQ
The Weapon 'style' for knives within the default script was named Barbasettian, in honor of Luigi Barbasetti of Italy. A master Fencer and a military master at arms, he was responsible for one of the top ten knife fighting styles. Your choice of course...
Instructions
Plenty, and all in the script.
Compatibility
Fairly compatible for RPGMaker XP systems as there are no rewrites to any classes, all content using aliased methods.
Author's Notes
I named this after a friend and former co-worker whom I found out today is no longer with us. I wrote it for remembrance.
Terms and Conditions
Free for use, even in commercial games. Only due credit is required.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links