08-23-2020, 04:16 PM (This post was last modified: 08-24-2020, 03:21 PM by DerVVulfman.)
I decided to just quickly jot out this...
Cogwheel Battle Faces
Code:
#==============================================================================
# ** Cogwheel Battle Faces
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.3
# 08-24-2020 (MM-DD-YYYY)
# RGSS / RPGMaker XP (Cogwheel RTAB/CTB dependent)
#------------------------------------------------------------------------------
#
# This script places face graphics behind the actual battle statistics for
# each hero when the game developer is using one of cogwheel's battlesystems.
# It is based upon the use of the Window_DetailsStatus class in use.
#
# The Face filenames may be the hero's name, an "Actor_"+id combination, the
# hero's characterset or the hero's battler. This is a configurable option.
#
# Faces are assumed as 100x100 px in size in order to fit within each actor's
# status window. But the placement can be adjusted within the config.
#
# Faces are stored within the Graphics\Faces folder.
#
#
#==============================================================================
#
# TERMS AND CONDITIONS:
#
# Free for use, even in commercial games. This script was inspired by
# rekkatsu, so due credit is not required just for me, but for rekkatsu
# as well.
#
#==============================================================================
module BattleFace
# FACE NAMING TYPE
# ================
# This determines how the faces are named and used in the system. The faces
# may be named after the hero's name, use the ID of the hero, use the hero's
# characterset or the hero's battler to name the face.
#
# ---------------------------------------------------------------------------
# Types:
# 0 = Hero's Name (ie: "Aluxes.png", "Basil.png", etc.)
# 1 = Hero's ID within text (ie: "Actor_1.png" ,"Actor_12.png", etc.)
# 2 = Hero's Characterset (ie: "025-Cleric01.png", "042-King01.png", etc.)
# 3 = Hero's Battler (ie: "016-Thief01.png", "043-Queen01.png", etc.)
# ---------------------------------------------------------------------------
#
TYPE = 0 # Assumes character name
# X/Y COORD ADJUSTMENTS
# =====================
# This lets you center or align the faces within each Actor's window.
# The current coords are assuming a 100x100 image for the face.
#
X = 32
Y = 32
end
#==============================================================================
# ** RPG::Cache
#------------------------------------------------------------------------------
# This is a module that loads each of RPGXP's graphic formats, creates a
# Bitmap object, and retains it.
#==============================================================================
module RPG::Cache
#----------------------------------------------------------------------------
# ● Face
# filename : filename
# hue : hue (range of 0-255)
#----------------------------------------------------------------------------
def self.face(filename, hue=0)
begin
self.load_bitmap("Graphics/Faces/", filename, hue)
rescue
self.load_bitmap("Graphics/Faces/", "", hue)
end
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 :actor_id # actor ID
end
#==============================================================================
# ** Window_DetailsStatus
#------------------------------------------------------------------------------
# It is the window which indicates the status of the actor in individually in the battle picture.
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias battleface_detailstatus_initialize initialize
alias battleface_detailstatus_dispose dispose
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# id : status ID
# x : x-coordinates
#--------------------------------------------------------------------------
def initialize(actor, id, x)
# Perform the original call
battleface_detailstatus_initialize(actor, id, x)
# Draw the face and re-refresh
draw_face(actor, x)
refresh(actor, false)
end
#--------------------------------------------------------------------------
# * Draw Actor Face
# actor : actor
# x : x-coordinates
#--------------------------------------------------------------------------
def draw_face(actor,x)
@spriter = Sprite.new()
# Variations
id = "Actor_" + (actor.actor_id).to_s
name = actor.name
char = actor.character_name
batt = actor.battler_name
case BattleFace::TYPE
when 1 ; img = id
when 2 ; img = char
when 3 ; img = batt
else ; img = name
end
@spriter.bitmap = RPG::Cache.face(img) rescue clear_face
@spriter.x = BattleFace::X + x
@spriter.y = BattleFace::Y + 320
@spriter.z = 100
end
#--------------------------------------------------------------------------
# * Draw Empty Face
#--------------------------------------------------------------------------
def clear_face
face = RPG::Cache.face("")
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Perform the original call
battleface_detailstatus_dispose
# Dispose of sprite
@spriter.dispose
end
end
It'll work with either Cogwheel's RTAB or his CTB script (some don't realize he made a CTB script). It throws a face behind the text within Cogwheel's own 'DetailsStatus' window which is unique for each actor.
It doesn't animate the faces like Cogwheel's own script.. But it won't
demand 16 faces per actor
require direct editing of the code for each actor and class for each face
doesn't take over the battler class, preventing the AnimBat system
I have plenty of instructions in there. But in general, you make a Faces subfolder in the Graphics folder, and have it filled with face png files (all the same size). And the name of the face files should be based on either the name of the hero, the filename of the characterset, the battler or is like "Actor_1.png", "Actor_2.png", etc. But again, it's in the instructions.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)