Code:
#==============================================================================
# JR's Oversized Arrow
# -------------------------------------------------------------------------
# version 1.0
# by DerVVulfman
# 02-26-2025 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
# =============
#
# Rather than use the same arrow within the classic windowskin, this script
# allows one to use targeting arrow twice as wide and twice as deep. It does
# use a separate file for the arrow. But it also allows you to use a script
# call to switch from one graphic file with the arrow to another.
#
# You just need a custom graphic file with two 64x64px arrows side-by-side
# within the project's Windowskin folder.
#
# FILE EXAMPLE: +--------+--------+
# | /\ | /\ |
# | / \ | / \ |
# | ----- -| ------ |
# +--------+--------+ Really, to 64x64px side-by-side.
#
# Just customize your settings within the JRArrow module below.
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS:
# =============
#
# * Set JR's Arrow
# Syntax: jr_arrow(filename)
# - filename : name of graphic image in Windowskin that has the arrows
# if empty, the default/configured file is used
#
# * Set JR's Arrow Flash Speed
# Syntax: jr_arrow_speed(value)
# - value : how fast or slow the flash animation takes (in frames)
# The range is from 2(fastest) to 40(slowest)
# if empty, the default/configured speed is used
#
#------------------------------------------------------------------------------
#
# TERMS and CONDITIONS:
# =====================
#
# Free for use, even in commercial scripts. Due credit to all involved is
# the only requirement.
#
#
#==============================================================================
module JRArrow
# FILENAME:
#==========
# The filename for the arrow animation in the windowskin folder
#
FILENAME = "JR_Arrow"
# SPEED:
#=======
# The speed of the arrow flash system (2-40 range) in frames.
#
SPEED = 8
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :jr_arrow_file # arrow graphic
attr_accessor :jr_arrow_speed # arrow animation/flash speed
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias jrarrow_game_system_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
# Perform the original method
jrarrow_game_system_initialize
#
# Set the oversized file
@jr_arrow_file = JRArrow::FILENAME
#
# Calculate animation speed (in range of 2fps to 40fps
jr_speed = JRArrow::SPEED
jr_speed = 2 if jr_speed < 2
jr_speed = 40 if jr_speed > 40
#
# Set the animation speed
@jr_arrow_file = jr_speed
#
end
end
#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
# This sprite is used as an arrow cursor for the battle screen. This class
# is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#==============================================================================
class Arrow_Base < Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :index # cursor position
attr_reader :help_window # help window
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
#--------------------------------------------------------------------------
def initialize(viewport)
#
# Inherit from the Sprite Superclass
super(viewport)
#
# Create the bitmap using configured file
arrow_name = $game_system.jr_arrow_file
self.bitmap = RPG::Cache.windowskin(arrow_name)
#
# Set origin and z-Depth
self.ox = 32
self.oy = 80
self.z = 2500
#
# Set actions
@blink_count = 0
@index = 0
@help_window = nil
#
# Perform update
update
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Acquire arrow flash speed
jr_speed = $game_system.jr_arrow_speed
#
# Update blink count
@blink_count = (@blink_count + 1) % jr_speed
#
# Set forwarding origin rectangle
if @blink_count < (jr_speed / 2).to_i
self.src_rect.set(0, 0, 64, 64)
else
self.src_rect.set(64, 0, 64, 64)
end
#
# Update help text (update_help is defined by the subclasses)
update_help unless @help_window.nil?
#
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Set JR's Arrow
# filename : filename of the battle arrows in windowskin
#--------------------------------------------------------------------------
def jr_arrow(filename=nil)
#
# Assume default value if nil
filename = JJRArrow::FILENAME if filename.nil?
#
# Set into Game_System
$game_system.jr_arrow_file = filename
#
end
#--------------------------------------------------------------------------
# * Set JR's Arrow Flash Speed
# value : speed of the arrow animation in frames (2-40fps)
#--------------------------------------------------------------------------
def jr_arrow_speed(value=nil)
#
# Assume default value if nil
value = JRArrow::SPEED if value.nil?
#
# Calculate animation speed (in range of 2fps to 40fps
value = 2 if value < 2
value = 40 if value > 40
#
# Set into Game_System
$game_system.jr_arrow_speed = value
#
end
end