9 hours ago
Ellemine's Power Attacks and Called Hits
Version: 1.0
Version: 1.0
Introduction
This script allows you to simulate zones on an enemy target that are more susceptible to damage while being a challenge for a strike. You can make it possible that heroes may deliver weak or strong attacks on any target. Or limit the called strikes upon a select group of enemies and define if enemies have viable zones for head-shots, center mass, or the like.
I wrote the instructions into the configuration section. Enjoy.
Features
- Set up your game so you can deliver Power, Normal or Quick attacks
- Or set up areas to target on select enemies
- Let it be possible only certain classes can use these attacks
- And let it be possible that attacks can be interrupted
Screenshots
![[Image: qRpj25z.gif]](https://i.imgur.com/qRpj25z.gif)
Demo
Nope
Script
In THREE parts:
Part 1: The Header
Code:
#==============================================================================
# ** Ellemine's Power Attacks and Called Hits
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 05-12-2025 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
# > HEADER PAGE <
#==============================================================================
#
# INTRODUCTION:
#
# This script allows you to simulate zones on an enemy target that are more
# susceptible to damage while being a challenge for a strike. You can make
# it possible that heroes may deliver weak or strong attacks on any target.
# Or limit the called strikes upon a select group of enemies and define if
# enemies have viable zones for head-shots, center mass, or the like.
#
# I wrote the instructions into the configuration section. Enjoy.
#
#
#------------------------------------------------------------------------------
#
# NOTES:
#
# Unlike other systems, this script adds new methods into the RPG::Item
# class itself, this to allow temporary adjustments to both the chance to
# hit a target as well as the possible damage applied.
#
#
#------------------------------------------------------------------------------
#
# VERSION HISTORY:
#
# 1.0 - 2025-05-12: Original release
#
#
#------------------------------------------------------------------------------
#
# 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.
#
#
#==============================================================================
Part 2: The Config
Code:
#==============================================================================
# ** Ellemine's Power Attacks and Called Hits
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 05-12-2025 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
# > INSTRUCTIONS AND CONFIGURATION PAGE <
#==============================================================================
#==============================================================================
# ** CalledHit
#------------------------------------------------------------------------------
# This module configures the called hit system, defining various flags, or
# creating the various lists that apper when attacking an enemy.
#
# It is divided into THREE sections.
# ==================================
#==============================================================================
module CalledHit
#--------------------------------------------------------------------------
ATTACK, ENEMY = {}, {} # Do not touch
#--------------------------------------------------------------------------
#==========================================================================
# GENERAL SETUP
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This section covers options that control how the script handles who can
# perform called hits and what happens if the user of such is attacked.
#==========================================================================
# MULTIPLE_ENEMY_TYPES
# ====================
# This indicates if you are opting to design individual target areas for
# an enemy. Rather than electing for Strong to Weak attacks, it would be
# used to create options like 'Head Shot' or 'Center Mass'.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
MULTI = true
# CHARACTER CLASSES
# =================
# This array holds the IDs of any character classes that permits the use
# of called hits. With this, you can limit only certain character classes
# such as hunter or gunner to perform those options. OPTIONALLY, it can
# be left empty or set to nil if all classes are allowed.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
CLASSES = [2] # Set to class #2 (Warrior) for example
# STATUS RESTRICTIONS
# (aka Restictions that interrupt Called Shots)
# =============================================
# Rather than listing individual states (from the States Database) that
# can hamper an actor from executing a called hit, the script will check
# if any status effect applied when struck has a restriction as defined
# in the States database. These flags are shown below:
#
# * Restriction 0 = None (ONLY use if all attacks hinder)
# * Restriction 1 = Can't use magic (aka Silence/Mute, etc.)
# * Restriction 2 = Always attacks enemies (aka Berserk)
# * Restriction 3 = Always attacks allies (aka Confuse)
# * Restriction 4 = Can't move (aka Stun, Sleep or the like)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
STATE_RESTRICT = [1, 4] # Set to "Can't use Magic" & "Can't Move"
# ATTACK PENALTIES
# ================
# If an actor that attempts to use a called hit attack on an enemy and is
# struck with a 'Status Restricted' attack beforehand (Above), the actor
# will lose the called hit bonus entirely. This assumes that any Status
# Restrictions are being applied.
#
# Here we can define any further penalties for being interrupted during a
# called shot. There are two options, and these are discussed below:
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * Speed Blocked: Some called hits may be created to give a speed boost
# for the next turn if the called hit strikes. This flag
# would remove any boost, even if the called hit is first.
#
# * No Action: When disabled, an actor interrupted when attempting to
# make a called hit delivers a normal hit. But when this
# is set to true, their attack is fully erased (no attack).
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
PENALTY_SPEED_BLOCKED = true # Removes their speed advantage next turn
PENALTY_NO_ACTION = false # The attack becomes normal (not removed)
#==========================================================================
# STANDARD ALL-TARGET SETUP
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This section allows you to define the attack power and accuracy ranges
# available for any attack. Flexible as it is, the section also covers the
# initially highlighted menu option if the first entry being highlighted
# is not desired.
#==========================================================================
# ATTACK WINDOW INDEX
# ====================
# Most of the time, the menu highlight will be the first menu option in
# any list. But here, you can set the highlighted menu option to be the
# first, second or setc. Do remember, a value of '0' is the first option,
# a value of '1' is the second, and so on.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
ATTACK_INDEX = 1 # Sets the 2nd menu item (index pos. 1)
# ATTACK CALL LIST
# ================
# This section uses hash arrays to assign the actual power-baseed attack
# menu options. These options are meant for any and all enemies, and each
# option defines how accurate an attack will be, the increase in attack,
# and optionally if the actor gains or loses any initiative (speed boost)
# for the next round of combat.
#
#
# SYNTAX: ATTACK[key] = [ caption, to_hit, damage, speed ]
# -or- ATTACK[key] = [ caption, to_hit, damage ]
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * key: Numeric ID for the option. They WILL appear in numeric order
# * caption: The title/name of the called shot in the called shot menu
# * to_hit: The adjustment to the chance to hit score.
# * damage: The adjustment to the base damage score
# * speed: (optional) The adjustment to the speed score for next turn
#
# All of the adjustment values (from to_hit to speed) are percentage based.
# So a value of 100 is a baseline 100% normal, and a value of 25 is a 25%
# adjustment that would cut what it affects to 1/4th its size. Likewise,
# an adjustment value of 500 would boost its affected value to five times
# its original size.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# ID Caption/Title Hit Dmg Spd
# == ============== ==== ==== ====
ATTACK[0] = [ "Strong", 70, 200, 50 ]
ATTACK[1] = [ "Average", 100, 100 ]
ATTACK[2] = [ "Weak", 150, 75, 125 ]
#==========================================================================
# INDIVIDUAL ENEMIES SETUP
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This section allows you to define what target areas exist upon an enemy,
# The chance to hit the area, the damage percent, and optionally the speed
# change for performing a called hit on any individual enemy.
#==========================================================================
# NORMAL ATTACK TEXT
# ==================
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# As called attack zones for individual enemies is selective, it will be
# assumed that the first menu option for any enemy is a normal attack. As
# this is the case, a phrase to suggest the attack is normal must be set.
# And to permit this script to be used for languages other than English,
# the word defining 'Normal' attack option is set here.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
NORMAL = "Normal"
# INDIVIDUAL ENEMY ZONE LIST
# ==========================
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# This section uses hash arrays to assign targets shots for any enemy so
# defined. Enemies are assigned an array to hold these target shots, and
# these target shots are arrays of data themselves. And there must be at
# least one target shot assigned to any defined enemy.
#
# SYNTAX: ENEMY[id] = [ [target_shot_array], [target_shot_array], ... ]
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * id: Enemy ID in the Enemy Database
#
# Each Target Shot Array is an array holding three or four pieces of in-
# formation generally known as parameters. The first is the caption, the
# second being the chance to hit multiplier, the third the damage multi-
# plier, and the optional fourth piece is the speed multiplier, like so:
#
# SYNTAX: [ caption, to_hit, damage, speed ]
# -or- [ caption, to_hit, damage ]
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * caption: The title/name of the called shot in the called shot menu
# * to_hit: The adjustment to the chance to hit score.
# * damage: The adjustment to the base damage score
# * speed: (optional) The adjustment to the speed score for next turn
#
# All of the adjustment values (from to_hit to speed) are percentage based.
# So a value of 100 is a baseline 100% normal, and a value of 25 is a 25%
# adjustment that would cut what it affects to 1/4th its size. Likewise,
# an adjustment value of 500 would boost its affected value to five times
# its original size.
#--------------------------------------------------------------------------
#
# ID Caption Hit Dmg Spd Caption Hit Dmg Spd
# == ======== ==== ==== ==== ======== ==== ==== ====
ENEMY[5] = [ [ "Head", 25, 200, 50], [ "Body", 50, 125 ] ]
ENEMY[6] = [ [ "Beak", 35, 150 ] ]
ENEMY[9] = [ [ "Head", 20, 350, 50] ]
ENEMY[17] = [ [ "Spine", 20, 300, 50] ]
ENEMY[22] = [ [ "Crest", 15, 250 ] ]
ENEMY[30] = [ [ "Beak", 15, 450, 25] ]
ENEMY[31] = [ [ "Top Eye",15, 550, 25], [ "Gut Eye",35, 150, 75 ] ]
end
Part 3: The Engine
Code:
#==============================================================================
# ** Ellemine's Power Attacks and Called Hits
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 05-12-2025 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
# > ENGINE <
# > TOUCH IT AND DIE <
#==============================================================================
#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
# A data class within RPGXP's structures for handling Items.
#==============================================================================
class RPG::Item
#--------------------------------------------------------------------------
# * Get hit rate
#--------------------------------------------------------------------------
def hit
value = @hit # Copy the base value
if $game_temp.called_item_hit_apply == true # Process once if called
value = called_attack_change(value, 1) # Change value
$game_temp.called_item_hit_apply = false # Set flag so only runs once
process_dupes # Process hp/sp duplicates
end
return value # Return value
end
#--------------------------------------------------------------------------
# * Get hp recovery rate
#--------------------------------------------------------------------------
def recover_hp_rate
return @dup_hp_rate if $game_temp.called_item_dmg_apply # Return adjusted
return @recover_hp_rate # Return base value
end
#--------------------------------------------------------------------------
# * Get hp recover value
#--------------------------------------------------------------------------
def recover_hp
return @dup_hp if $game_temp.called_item_dmg_apply # Return adjusted
return @recover_hp # Return base value
end
#--------------------------------------------------------------------------
# * Get sp recovery rate
#--------------------------------------------------------------------------
def recover_sp_rate
return @dup_sp_rate if $game_temp.called_item_dmg_apply # Return adjusted
return @recover_sp_rate # Return base value
end
#--------------------------------------------------------------------------
# * Get sp recover value
#--------------------------------------------------------------------------
def recover_sp
return @dup_sp if $game_temp.called_item_dmg_apply # Return adjusted
return @recover_sp # Return base value
end
#--------------------------------------------------------------------------
# * Get Called Attack Change
# value : value to modify (hit rate or base attack)
# id : parameter ID in config
#--------------------------------------------------------------------------
def called_attack_change(value, id)
#
called = $game_temp.called_item_array # Get called array
return value if called.nil? # Exit if no array
return value unless called.is_a?(Array) # Exit if no array
enemy_id = called[0] # Get enemy ID
choice = (called[1]) # Get hit chosen by actor
choice -= 1 if CalledHit::MULTI # Adjust for Multistyle
return value if choice < 0 # Exit if no bonus
called = called_attack_type(enemy_id) # Get called hit set
option = called[choice] # Get which hit set by choice
value *= option[id] # Multiply by parameter then
value /= 100 # Divide to get percent change
return Integer(value) # Exit with new value
#
end
#--------------------------------------------------------------------------
# * Get called attack set by type
# enemy_id : enemy ID
#--------------------------------------------------------------------------
def called_attack_type(enemy_id)
#
if CalledHit::MULTI # If dealing with multistyle
return called_attack_multi(enemy_id) # Use multiple enemy array set
end
return called_attack_single
#
end
#--------------------------------------------------------------------------
# * Get single range called attack set
#--------------------------------------------------------------------------
def called_attack_single
#
called = CalledHit::ATTACK # Get single called hit array
#
end
#--------------------------------------------------------------------------
# * Get individual enemy strike area attack set
#--------------------------------------------------------------------------
def called_attack_multi(enemy_id)
#
called = CalledHit::ENEMY[enemy_id] # Get called hits for enemy
#
end
#--------------------------------------------------------------------------
# * Process duplicates of HP and SP recovery values
#--------------------------------------------------------------------------
def process_dupes
#
value = @recover_hp_rate # Copy the value
@dup_hp_rate = Integer(called_attack_change(value, 2)) # Make adjusted dup
value = @recover_hp # Copy the value
@dup_hp = Integer(called_attack_change(value, 2)) # Make adjusted dup
value = @recover_sp_rate # Copy the value
@dup_sp_rate = Integer(called_attack_change(value, 2)) # Make adjusted dup
value = @recover_sp # Copy the value
@dup_sp = Integer(called_attack_change(value, 2)) # Make adjusted dup
#
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :called_item_hit_apply # Flag to limit hit change once
attr_accessor :called_item_dmg_apply # Flag to limit damage change once
attr_accessor :called_item_array # Enemy ID for called item use
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias called_hit_temp_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
called_hit_temp_initialize # Original method
@called_item_hit_apply = false # Hit change flag
@called_item_dmg_apply = false # Damage change flag
@called_item_array = nil # Called hit array for items
#
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
#--------------------------------------------------------------------------
attr_accessor :called_speed # Speed percent adjust
attr_accessor :called_blocked_speed # Speed change blocked flag
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias called_hit_battler_initialize initialize
alias called_hit_battler_agi agi
alias called_hit_battler_hit hit
alias called_hit_battler_make_action_speed make_action_speed
alias called_hit_battler_ae attack_effect
alias called_hit_battler_se skill_effect
alias called_hit_battler_ie item_effect
#--------------------------------------------------------------------------
# * Original methods Aliased
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
called_hit_battler_initialize # Original method
@called_speed = 100 # Speed percent adjust
@called_blocked_speed = false # Speed blocked flag
@called_battle_speed = false # Speed changing flag
#
end
#--------------------------------------------------------------------------
# * Get Agility (AGI)
#--------------------------------------------------------------------------
def agi
#
value = called_hit_battler_agi # Original method
value = speed_called_change(value) # Alter with called speed
return Integer(value) # Exit with result
#
end
#--------------------------------------------------------------------------
# * Get Hit Rate
#--------------------------------------------------------------------------
def hit
#
value = called_hit_battler_hit # Original method
value = called_attack_change(value, 1) # Alter with called hit
return Integer(value) # Exit with result
#
end
#--------------------------------------------------------------------------
# * Determine Action Speed
#--------------------------------------------------------------------------
def make_action_speed
#
@called_battle_speed = true # Speed changing flag
called_hit_battler_make_action_speed # Run the original method
@called_battle_speed = false # Speed changing flag
#
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
#
old_s = @states.dup # Get start states for test
result = called_hit_battler_ae(attacker) # Run the original method
new_s = @states.dup # Get new states for test
test = status_called_change(old_s, new_s) # Get state change w penalty
called_penalty if test # Run penalty if found
return result # Exit with result
#
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
#
old_s = @states.dup # Get start states for test
result = called_hit_battler_se(user, skill) # Run the original method
new_s = @states.dup # Get new states for test
test = status_called_change(old_s, new_s) # Get state change w penalty
called_penalty if test # Run penalty if found
return result # Exit with result
#
end
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
def item_effect(item)
#
old_s = @states.dup # Get start states for test
result = called_hit_battler_ie(item) # Run the original method
new_s = @states.dup # Get new states for test
test = status_called_change(old_s, new_s) # Get state change w penalty
called_penalty if test # Run penalty if found
return result # Exit with result
#
end
#--------------------------------------------------------------------------
# * New Content
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Set current action
# action : action settings
#--------------------------------------------------------------------------
def current_action=(action)
#
@current_action = action # Apply action to current
#
end
#--------------------------------------------------------------------------
# * Get Called Speed Rate
# value : agility value
#--------------------------------------------------------------------------
def speed_called_change(value)
#
return value unless @called_battle_speed # Exit if not a speed adjust
value *= @called_speed # Multiply by stored adjust
value /= 100 # Divide to get percent adjust
return value # Exit with adjusted value
#
end
#--------------------------------------------------------------------------
# * Get Called Attack Change
# value : value to modify (hit rate or base attack)
# id : parameter ID in config
#--------------------------------------------------------------------------
def called_attack_change(value, id)
#
action = self.current_action # Get battler action
called = action.called_array # Get called array
return value unless called.is_a?(Array) # Exit if no array
enemy_id = called[0] # Get enemy ID
choice = (called[1]) # Get hit chosen by actor
choice -= 1 if CalledHit::MULTI # Adjust for Multistyle
return value if choice < 0 # Exit if no bonus
called = called_attack_type(enemy_id) # Get called hit set
option = called[choice] # Get which hit set by choice
value *= option[id] # Multiply by parameter then
value /= 100 # divide to get percent change
return value # Exit with new value
#
end
#--------------------------------------------------------------------------
# * Get called attack set by type
# enemy_id : enemy ID
#--------------------------------------------------------------------------
def called_attack_type(enemy_id)
#
if CalledHit::MULTI # If dealing with multistyle
return called_attack_multi(enemy_id) # Use multiple enemy array set
end
return called_attack_single
#
end
#--------------------------------------------------------------------------
# * Get single range called attack set
#--------------------------------------------------------------------------
def called_attack_single
#
called = CalledHit::ATTACK # Get single called hit array
#
end
#--------------------------------------------------------------------------
# * Get individual enemy strike area attack set
#--------------------------------------------------------------------------
def called_attack_multi(enemy_id)
#
called = CalledHit::ENEMY[enemy_id] # Get called hits for enemy
#
end
#--------------------------------------------------------------------------
# * Get Called Status on hit and penalty
# old_states : actor's states before attack
# new_states : actor's states after attack
#--------------------------------------------------------------------------
def status_called_change(old_states, new_states)
#
restricted = CalledHit::STATE_RESTRICT # Get restricted states
return false if restricted.nil? # Exit if no restrictions
return false if restricted == [] # Exit if no restrictions
return false unless @state_changed # Exit if no state applied
return false if old_states == new_states # Exit if no state change
for id in old_states # Cycle through states
next if id.nil? # Skipping invalid
next unless new_states.include?(id) # Skip if not in current
new_states.delete(id) # And remove from current
end
return false if new_states == [] # Exit if emptied
action = self.current_action # Get battler action
result = action.called_array # Get called array
return false unless result.is_a?(Array) # Exit if no called hit
test = false # Penalty applying flag false
for id in new_states # Cycle through states
next if id.nil? # Skipping invalid
value = $data_states[id].restriction # Get restriction value
test = true if restricted.include?(value) # Test shows restricted state
end
return test # Exit with final test result
#
end
#--------------------------------------------------------------------------
# * Run Penalty attributed to called shot use
#--------------------------------------------------------------------------
def called_penalty
#
called_penalty_blocking # Called hit removal method
called_penalty_no_action # Actions removal method
#
end
#--------------------------------------------------------------------------
# * Run Penalty removing called shot and possibly speed bonus if in play
#--------------------------------------------------------------------------
def called_penalty_blocking
#
self.current_action.called_array = -1 # Remove called hit
return unless CalledHit::PENALTY_SPEED_BLOCKED # Exit method if disabled
self.called_blocked_speed = true # Block speed adjust flag
#
end
#--------------------------------------------------------------------------
# * Run Penalty removing any attack action
#--------------------------------------------------------------------------
def called_penalty_no_action
#
return unless CalledHit::PENALTY_NO_ACTION # Exit method if disabled
self.current_action.kind = 0 # Melee setting
self.current_action.basic = 3 # No action setting
#
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
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias called_hit_actor_base_atk base_atk
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def base_atk
#
value = called_hit_actor_base_atk # Get original method value
value = called_attack_change(value, 2) # Adjust for called hit dmg
return value.to_i # Exit with new value
#
end
#--------------------------------------------------------------------------
# * Get Class ID
#--------------------------------------------------------------------------
def class_id
#
return @class_id # Returns the class ID
#
end
end
#==============================================================================
# ** Game_BattleAction
#------------------------------------------------------------------------------
# This class handles actions in battle. It's used within the Game_Battler
# class.
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :called_array # Called hit array
#--------------------------------------------------------------------------
# * Aliased Listings
#--------------------------------------------------------------------------
alias called_hit_battleaction_clear clear
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
def clear
#
called_hit_battleaction_clear # Run the original method
@called_array = -1 # New value
#
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Aliased Listings
#--------------------------------------------------------------------------
alias called_hit_battle_main main
alias called_hit_battle_start_phase2 start_phase2
alias called_hit_battle_start_phase3 start_phase3
alias called_hit_battle_phase3_next_actor phase3_next_actor
alias called_hit_battle_update_phase3 update_phase3
alias called_hit_battle_end_enemy_select end_enemy_select
alias called_hit_battle_end_skill_select end_skill_select
alias called_hit_battle_end_item_select end_item_select
alias called_hit_battle_make_item_action_result make_item_action_result
#--------------------------------------------------------------------------
# * Original methods Aliased
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
main_called_window # Make called hit window
called_hit_battle_main # Run the original method
@called_window.dispose # Dispose of the window
#
end
#--------------------------------------------------------------------------
# * Start Party Command Phase
#--------------------------------------------------------------------------
def start_phase2
#
phase2_called_speed # Called hit speed bonus
called_hit_battle_start_phase2 # Run the original method
#
end
#--------------------------------------------------------------------------
# * Start Actor Command Phase
#--------------------------------------------------------------------------
def start_phase3
#
@permit_next_called = true # Permit next actor
called_hit_battle_start_phase3 # Run the original method
#
end
#--------------------------------------------------------------------------
# * Go to Command Input for Next Actor
#--------------------------------------------------------------------------
def phase3_next_actor
#
return unless @permit_next_called == true # Exit if next actor blocked
called_hit_battle_phase3_next_actor # Run the original method
#
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
#
if @called_window.active == true # If called hit is active
return update_phase3_called # Run update called hit
end
called_hit_battle_update_phase3 # Run the original method
#
end
#--------------------------------------------------------------------------
# * End Enemy Selection
#--------------------------------------------------------------------------
def end_enemy_select
#
case @actor_command_window.index
when 1; scope = enemy_select_skill_scope # Scope of skill
when 2; scope = enemy_select_item_scope # Scope of item
else ; scope = 1 # Scope of attack
end
result = called_enemy?(scope) # Get target test result
flag = result[0] # Get true/false result
if flag == false # If value says use default
return called_hit_battle_end_enemy_select # ...Exit w original method
end
start_called_select(result[1]) # Start called hit on enemy
#
end
#--------------------------------------------------------------------------
# * End Skill Selection
#--------------------------------------------------------------------------
def end_skill_select
#
@called_window.active = false # Enable called hit window
@called_window.visible = false # Show called hit window
case @actor_command_window.index
when 1; scope = enemy_select_skill_scope # Scope of skill
when 2; scope = enemy_select_item_scope # Scope of item
else ; scope = 1 # Scope of attack
end
result = called_enemy?(scope) # Get target test result
flag = result[0] # Get true/false result
if flag == false # If value says use default
return called_hit_battle_end_skill_select # ...Exit w original method
end
start_called_select(result[1]) # Start called hit on enemy
#
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_select
#
@called_window.active = false # Enable called hit window
@called_window.visible = false # Show called hit window
case @actor_command_window.index
when 1; scope = enemy_select_skill_scope # Scope of skill
when 2; scope = enemy_select_item_scope # Scope of item
else ; scope = 1 # Scope of attack
end
result = called_enemy?(scope) # Get target test result
flag = result[0] # Get true/false result
if flag == false # If value says use default
return called_hit_battle_end_item_select # ...Exit w original method
end
start_called_select(result[1]) # Start called hit on enemy
#
end
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
def make_item_action_result
#
make_called_item_hit_result # Set values for called item
called_hit_battle_make_item_action_result # Run the original method
#
end
#--------------------------------------------------------------------------
# * New Content
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Determine if it is a called hit enemy
# scope : attack scope
#--------------------------------------------------------------------------
def called_enemy?(scope=1)
#
if @active_battler.is_a?(Game_Enemy) # If the user is an enemy
return [false, 0] # ...exit with false array
end
unless scope == 1 # If not a single target
return [false, 0] # ...exit with false array
end
unless called_actor_class? # If actor class not allowed
return [false, 0] # ...exit with false array
end
return [false, 0] unless called_enemy_list? #
@permit_next_called = false # Halt going to next actor
enemy_id = called_enemy_id # Get enemy ID
return [true, enemy_id] # Exit with true array
#
end
#--------------------------------------------------------------------------
# * Determine if an enemy is permitted
#--------------------------------------------------------------------------
def called_enemy_list?
if CalledHit::MULTI # If MultiStyle is engaged
return called_enemy_multi? # Return if individual enemy
end
return true # Assume true for single
end
#--------------------------------------------------------------------------
# * Determine if an individual enemy defined
#--------------------------------------------------------------------------
def called_enemy_multi?
id = called_enemy_id # Get enemy ID
return true if CalledHit::ENEMY.has_key?(id) # If enemy has no called
return false # ... exit with false array
end
#--------------------------------------------------------------------------
# * Determine if actor is permitted by class
#--------------------------------------------------------------------------
def called_actor_class?
#
return true if CalledHit::CLASSES == nil # Exit true if array is nil
return true if CalledHit::CLASSES == [] # Exit true if empty array
id = @active_battler.class_id # Get actor's class ID
return true if CalledHit::CLASSES.include?(id) # Exit true if class allowed
return false # Exit false if not passed
#
end
#--------------------------------------------------------------------------
# * Get enemy ID of current target
#--------------------------------------------------------------------------
def called_enemy_id
#
action = @active_battler.current_action # Get actor action
target = action.target_index # Get action target
enemy = $game_troop.enemies[target] # Enemy from troop
id = enemy.id # Get enemy ID
#
end
#--------------------------------------------------------------------------
# * Enemy Selection : Skill attack scope
#--------------------------------------------------------------------------
def enemy_select_skill_scope
#
id = @active_battler.current_action.skill_id # Get skill ID
skill = $data_skills[id] # Get skill
return 0 if skill.nil? # Exit without if no skill
return skill.scope # Exit with scope of skill
#
end
#--------------------------------------------------------------------------
# * Enemy Selection : Item attack scope
#--------------------------------------------------------------------------
def enemy_select_item_scope
#
id = @active_battler.current_action.item_id # Get item ID
item = $data_items[id] # Get item
return 0 if item.nil? # Exit without if no item
return item.scope # Exit with scope of item
#
end
#--------------------------------------------------------------------------
# * Get actor speed adjustment for successful called hit
#--------------------------------------------------------------------------
def phase2_called_speed
#
for actor in $game_party.actors # Cycle through actors
actor.called_speed = 100 # Assume default adjustment
action = actor.current_action # Get current action
next unless action.called_array.is_a?(Array) # Skip if no called hit
enemy = action.called_array[0] # Get enemy ID
idx = (action.called_array[1]) # Get choice ID
idx -= 1 if CalledHit::MULTI # Adjust for Multistyle
next if idx < 0 # Skip if no bonus
option = phase2_called_array(enemy, idx) # Get option
speed = option[3] # Get speed
speed = 100 if speed.nil? # Set default if nil
if speed > 100 # If adjustment is bonus
speed = 100 if actor.called_blocked_speed # Reset if flagged blocked
end
actor.called_speed = speed # Set adjusted speed
called_blocked_speed = false # Reset blocked flag
end
#
end
#--------------------------------------------------------------------------
# * Get array for speed adjustment check
#--------------------------------------------------------------------------
def phase2_called_array(enemy, idx)
if CalledHit::MULTI # If for Multistyle
result = CalledHit::ENEMY[enemy] # Get config by enemy
option = result[idx] # Get which option
return option # return the option
end
keys = CalledHit::ATTACK.keys # Get Attack entry keys
keys.sort! # Sort numerically
idx = keys[idx] # Get index from keys
option = CalledHit::ATTACK[idx] # Get which option
return option # return the option
end
#--------------------------------------------------------------------------
# * Main Processing : Generating the window
# enemy_id : Enemy ID
#--------------------------------------------------------------------------
def main_called_window(enemy_id=0)
#
temp = [] # Create array
if CalledHit::MULTI # If Multistyle
temp = main_called_window_multi(enemy_id) # Set multistyle array
else
temp = main_called_window_single # Set single-type array
end
@called_window = Window_Command.new(160, temp) # Make called hit window
@called_window.y = 160 # Define Y coordinates
@called_window.back_opacity = 160 # Define back opacity
@called_window.active = false # Deactivate the window
@called_window.visible = false # Hide the window
@called_window.index = 0
index = 0 # Assume window index at top
unless CalledHit::MULTI # If not Multistyle
index = CalledHit::ATTACK_INDEX # Get the defined index
end
@called_window.index = index # Set the window index
#
end
#--------------------------------------------------------------------------
# * Main Processing : Generating the window for one range option set
# enemy_id : Enemy ID
#--------------------------------------------------------------------------
def main_called_window_single
#
temp = []
keys = CalledHit::ATTACK.keys # Get Attack entry keys
keys.sort! # Sort numerically
for key in keys # Cycle through sorted keys
option = CalledHit::ATTACK[key] # Get which option
temp.push(option[0]) # Push into array
end
return temp # Return list
#
end
#--------------------------------------------------------------------------
# * Main Processing : Generating the window for multiple enemy options
# enemy_id : Enemy ID
#--------------------------------------------------------------------------
def main_called_window_multi(enemy_id=0)
#
temp = [CalledHit::NORMAL]
if CalledHit::ENEMY.has_key?(enemy_id) # If enemy has a called hit
second_list = CalledHit::ENEMY[enemy_id] # Get enemy's called hit
for target in second_list # Sort through data
temp.push(target[0]) # Push into array
end
end
return temp # Return list
#
end
#--------------------------------------------------------------------------
# * Start Called Hit Selection
# enemy_id : Enemy ID
#--------------------------------------------------------------------------
def start_called_select(enemy_id=0)
#
main_called_window(enemy_id) # Remake window with enemy
@actor_command_window.active = false # Disable actor cmd window
@actor_command_window.visible = false # Hide actor command window
@enemy_arrow.visible = false # Hide enemy arrow
@called_window.active = true # Enable called hit window
@called_window.visible = true # Show called hit window
@called_window.x = @actor_index * 160 # Update window placement
#
end
#--------------------------------------------------------------------------
# * End Called Hit Selection
#--------------------------------------------------------------------------
def end_called_select
#
@called_window.active = false # Deactivate called window
@called_window.visible = false # Hide called hit window
@help_window.visible = false # Hide the help window
action = @active_battler.current_action # Get actor action
case action.kind # Branch on action
when 1 ; called_hit_battle_end_skill_select # End called hit
when 2 ; called_hit_battle_end_item_select # Original End Enemy Select
else ; called_hit_battle_end_enemy_select # End called hit
end
#
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : called hit command)
#--------------------------------------------------------------------------
def update_phase3_called
#
@called_window.update # Update called hit window
return if update_phase3_called_cancel? # Test for action cancel
return if update_phase3_called_decision? # Test for action decision
#
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : called hit cancel)
#--------------------------------------------------------------------------
def update_phase3_called_cancel?
#
return false unless Input.trigger?(Input::B) # If not cancel
$game_system.se_play($data_system.cancel_se) # Play cancel SE
@permit_next_called = true # Allow next actor
end_called_select
phase3_prior_actor # Go to prior actor
return true # Exit true
#
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : called hit decision)
#--------------------------------------------------------------------------
def update_phase3_called_decision?
#
return false unless Input.trigger?(Input::C) # If not decision
$game_system.se_play($data_system.decision_se) # Play decision SE
@permit_next_called = true # Allow next actor
id = called_enemy_id # Get enemy ID
id = 0 unless CalledHit::MULTI # Set 0 enemy if not Multi
idx = @called_window.index # Get called option index
result = [id, idx] # Make called hit array
action = @active_battler.current_action # Get battler action
action.called_array = result # Set called array
end_called_select
phase3_next_actor # Go to next actor
return true # Exit true
#
end
#--------------------------------------------------------------------------
# * Make Called Item Hit Result
#--------------------------------------------------------------------------
def make_called_item_hit_result
#
$game_temp.called_item_array = nil # Assume nothing present
$game_temp.called_item_hit_apply = false # Assume nothing present
$game_temp.called_item_dmg_apply = false # Assume nothing present
action = @active_battler.current_action # Get current action
called = action.called_array # Get called array
return unless called.is_a?(Array) # Skip if no called hit
$game_temp.called_item_array = called # Assign the called array
$game_temp.called_item_hit_apply = true # Assume nothing present
$game_temp.called_item_dmg_apply = true # Assume nothing present
#
end
end
Instructions
Plenty. All configuration instructions are in the configuration page.
Compatibility
Fairly compatible for RPGMaker XP systems as there are no rewrites to any classes, all content using aliased methods.
Author's Notes
Unlike other systems, this script adds new methods into the RPG::Item class itself, this to allow temporary adjustments to both the chance to hit a target as well as the possible damage applied.
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