Composite Characters / In-game Character Creation

Since it's near the beginning of the game, I'm always running a new game when calling it. Here are some details about what's going on: All I've done is changed the actor No. in the script to 30 and made a file with a default character generator called "Hero1" for face and sprite. I don't know if what I've done is even remotely correct, but I really need help.

I would add pictures to help but I'm not sure how, sorry. >_<
hey i added some stuff to it and this is how it looks now:

Spoiler
##----------------------------------------------------------------------------##
## Composite Character v2.1
## Created by Neon Black
##
## Only for non-commercial use. See full terms of use and contact info at:
## http://cphouseset.wordpress.com/liscense-and-terms-of-use/
##----------------------------------------------------------------------------##
##
##----------------------------------------------------------------------------##
## Revision Info:
## V2.1 - 2.12.2013
## Added new script calls
## V2.0 - 1.24.2013
## Rewrote entire script from scratch
## V1.0 - 10.17.2012
## Wrote and debugged main script
##----------------------------------------------------------------------------##
##
$imported = {} if $imported.nil? ##
$imported["COMPOSITE"] = 2.1 ##
##
##----------------------------------------------------------------------------##
## Instructions:
## Place this script in the "Materials" section of the scripts above "Main".
## To use this script you must have additional composite graphics in a folder
## for characters and a folder for faces. Charactersets will use composites
## based on their names in the NAMES setting. Some layers of the composite
## may also change based on the equipped items on the actor associated with
## file name. There are several tags that work with both actors and equips.
##
## Tags:
## tag init[Handler, hue]
## - Can only be tagged in actors. Changes composite layer :tag to handler
## "Handler" with the defined hue. Do not use colons for layer names or
## quotes for file handler names.
## gender[male]
## - Sets the character's initial gender to "male" or "female" depending on
## which you place in the brackets. This can only tag actors.
## alt name[Christopher]
## - Sets the character's name for the opposite gender. If the player changes
## the gender in the GUI and has not changed the name, the new name will be
## displayed. The name "Christopher" here can be any name you desire.
## tag image[Handler, hue]
## - Changes the default images for layer :tag to file handler "Handler".
##
## Script Calls:
## The character creation screen can be called with either of these two script
## calls from an event. Other script calls also exist.
##
## creation(id) -or- creation(id, array)
## - The value "id" can be either the actor's ID or the name of the character
## set to modify. The "array" value does not need to be used ever. This is
## the array of handlers from "GUI_LISTS" to use. If no array is defined,
## "BASE_GUI" is used instead.
## composite_custom(id, handler, name, hue)
## - Changes composite "id"'s layer "handler" into file "name" with a hue of
## "hue". This occurs on the same priority level as the character creation
## screen, so it is covered by armour and can be modified by the player.
## "id" must be a value from NAMES, "handler" a layer from COMPOSITE, "name"
## a file from FILE_HANDLERS, and "hue" a number from 0 to 255.
## composite_force(id, handler, name, hue)
## - Similar to the command above, but this takes the highest priority when
## being drawn and cannot be changed by the player.
## composite_reset(id)
## - Removes all layers added using the "composite_force" script call.
##
## Special Layers:
## In order to allow a slight bit more customization, there are 3 types of
## special layers that link directly to other layers. These layers end with
## "Back", "Hueless", and "All".
##
## Back Layers
## - These layers do not actually need to be behind the normal layer. They
## are simply a second layer with all the same properties of the parent
## layer. An example would be :hairRear which would be a rear layer of
## :hair.
## Hueless Layers
## - These layers ignore the changed hue values. The main use of these would
## be objects with skin tone or perhaps objects that you only want to change
## part of the colour on. The only object that uses this in the example
## is :eyesHueless which is a hueless layer of :eyes.
## All Layers
## - These are special layers on the character. They are a layer that appears
## on the character no matter what the player does. The file that appears
## is still linked to the file part it is attatched to for the sake of hue.
## The file that appears for one of these layers is defined in the hash
## GUI_OPTIONS.
##----------------------------------------------------------------------------##
##
module CP # Do not touch ##
module COMPOSITE # these lines. ##
##
##----------------------------------------------------------------------------##
## Config:
## The config options are below. You can set these depending on the flavour of
## your game. Each option is explained in a bit more detail above it.
##
##------

# The folders containing the composite parts for characters and for facesets.
CHAR_FOLDER = "Graphics/Composite/Charas/"
FACE_FOLDER = "Graphics/Composite/Faces/"

# Determines if the creation screen uses face sets are not. Set to false if
# you do not want a faceset displayed.
USE_FACESETS = true

# The width and height of the character window in the creation screen. The
# character in the screen is zoomed in to 200%.
WINDOW_WIDTH = 90
WINDOW_HEIGHT = 112

# The text options for the character selection GUI. EMPTY_TEXT refers to an
# option which is blank for some reason.
GUI_CLOSE = "Finish Editing"
EMPTY_TEXT = "None"

# The number of allowed character spaces for names when input from the editor.
CHARACTERS = 6

# Names for the male and female genders.
GENDER_NAMES = ["Male", "Female"]

# Determines if male undefined characters start out as male characters.
MALE_DEFAULT = true

##------

# Determine the files that are recognized as composite images and the actor
# they are linked to, for the sake of armour, storage, etc.
NAMES ={
"$Hero1" => 11,
"$Hero2" => 12,
}

# The switches related to characters. A switch is turned ON when the character
# is male and OFF when the character is female.
SWITCHES ={
11 => 72,
12 => 73,
}

# The order for composite layers. The first layer is the lowest layer.
COMPOSITE =[
:hairRear,
:cape,
:armorRear,
:headAll,
:head,
:eyes,
:eyesAll,
:eyesHueless,
:armor,
:hair,
:glasses,
:helmet,
]

# These are the handlers for all files in the composite folders. Actor and
# equip tags as well as GUI options point to a handler and the handler
# determines the male and female files to look up. Make sure every handler
# has a different name.
FILE_HANDLERS ={
# "Handler" => ["Male_File", "Female_File"],
"Shaggy" => ["Hair1M", nil],
"Slick" => ["Hair2M", nil],
"Spiked" => ["Hair3M", nil],
"Fancy" => ["Hair4M", nil],
"Mohawk" => ["Hair5M", nil],
"Long" => ["Hair6M", nil],
"Stylish" => [nil, "Hair1F"],
"Waist Length" => [nil, "Hair2F"],
"Curled" => [nil, "Hair3F"],
"Pigtails" => [nil, "Hair4F"],
"Double Bun" => [nil, "Hair5F"],
"Cropped" => [nil, "Hair6F"],
"Spiral" => [nil, "Hair7F"],
"Short" => ["Hair1U", "Hair1U"],
"Long" => ["Hair2U", "Hair2U"],
"Observant" => ["Eye1M", "Eye1F"],
"Closed" => ["Eye2M", "Eye2F"],
"Intent" => ["Eye3M", "Eye3F"],

"HeadBase" => ["HeadM", "HeadF"],
"FaceBase" => ["FaceM", "FaceF"],
"BodyBase" => ["BaseM", "BaseF"],

"Poncho" => ["Outerwear1M", "Outerwear1F"],
"Vest" => ["Outerwear2M", "Outerwear2F"],
"Casual" => ["Outerwear3M", "Outerwear3F"],
"Fancy" => ["Outerwear4M", "Outerwear4F"],
"Cloak" => ["Outerwear5M", "Outerwear5F"],
"Robe" => ["Outerwear6M", "Outerwear6F"],
"T-Shirt" => ["Tops1M", "Tops1F"],
"Long Sleeve" => ["Tops2M", "Tops2F"],
"Tank Top" => ["Tops3M", "Tops3F"],
"Blouse" => [nil, "Tops4F"],
"Corset" => [nil, "Tops5F"],
"Sports Bra" => [nil, "Tops6F"],
"Crop Top" => [nil, "Tops7F"],
"Tube Top" => [nil, "Tops8F"],
"Jersey" => ["Tops4M", nil],
"Polo" => ["Tops5M", nil],
"None" => ["None", nil],
"Clothes" => ["ClothesM", "ClothesF"],
"Cloth" => ["ClothM", "ClothF"],
"Armor" => ["ArmourM", "ArmourF"],
"Shorts" => ["Legs1M", "Legs1F"],
"Pants" => ["Legs2M", "Legs2F"],
"Hot Pants" => [nil, "Legs3F"],
"Skirt" => [nil, "Legs4F"],
"Tight" => [nil, "Legs5F"],
"Sneakers" => ["Feet1M", "Feet1F"],
"Boots" => ["Feet2M", "Feet2F"],
"Sandals" => ["Feet3M", "Feet3F"],
"Thigh High" => [nil, "Feet4F"],
"Glasses" => ["Glasses", "Glasses"],
"Glasses2" => ["Glasses2", "Glasses2"],
"Sunglasses" => ["Sunglasses", "Sunglasses"],
"Goggles" => ["Goggles", "Goggles"],
"None" => ["None", "None"],
}

# Standard handlers. These are default handlers of certain layers.
STANDARD ={
:headAll => "HeadBase",
:head => "FaceBase",
:armor => "BodyBase",
}

# The GUI options that may be called from an array. If the "Name" field is set
# to a :symbol like the :barber example, it will point back to another option
# and use that option's name and layer. The point is simply to link different
# handlers to it as well as giving it different colour options. The colorize?
# option can be set to a value of 0, 1, or 2 depending on the style of hue bar
# you would like displayed. If it is set to 0, no bar will be displayed.
GUI_OPTIONS ={
# :handler => ["Name", colorize?, "AllFile"],
:Name => ["Name", 0, nil],
:Gender => ["Gender", 0, nil],
:hair => ["Hair", 1, nil],
:eyes => ["Eyes", 1, "EyeAll"],
:eyewear => ["Eyewear", 0, nil],
😮utwear => ["Outwear", 1, nil],
:tops => ["Tops", 1, nil],
:legs => ["Legs", 1, nil],
:feet => ["Feet", 1, nil],

:barber => [:hair, true, nil],
}

# These are the basic options to use in the GUI if no array is defined.
BASE_GUI = [:Gender]

# These are the lists that refer to the options. Male and Female only options
# are automatically filtered depending on the character's gender.
GUI_LISTS ={
:hair => ["Shaggy", "Slick", "Spiked", "Fancy", "Mohawk", "Long",
"Stylish", "Waist Length", "Curled", "Pigtails", "Double Bun",
"Cropped", "Spiral"],
:eyes => ["Observant", "Intent", "Closed"],
:eyewear => ["Glasses", "Glasses2", "EyePatch", "Sunglasses", "Goggles", "None"],
😮utwear => ["Poncho", "Vest", "Causal", "Fancy", "Cloak", "Robe", "None"],
:tops => ["T-Shirt", "Long Sleeve", "Tank Top", "Blouse", "Corset", "Sports Bra", "Crop Top", "Tube Top", "Jersey", "Polo", "None"],

:legs => ["Shorts", "Pants", "Hot Pants", "Skirt", "Tight"],

:feet => ["Sneakers", "Boots", "Sandals", "Thigh High"],

:barber => ["Shaggy", "Slick", "Spiked", "Fancy", "Mohawk", "Long",
"Stylish", "Waist Length", "Curled", "Pigtails", "Double Bun",
"Cropped", "Spiral"],
}

##----------------------------------------------------------------------------##
##
##
##----------------------------------------------------------------------------##
## The following lines are the actual core code of the script. While you are
## certainly invited to look, modifying it may result in undesirable results.
## Modify at your own risk!
###----------------------------------------------------------------------------


end
end

module Cache
class << self ## Alias for the used methods in this module.
alias cp_cm_character character
alias cp_cm_face face
alias cp_cm_clear clear
end

def self.character(*args) ## Checks if the file is a composite.
return cp_cm_character(*args) unless Composites.include?(args[0])
create_composite(args[0], "Graphics/Characters/")
hue = args[1] ? args[1] : 0
load_bitmap("Graphics/Characters/", args[0], hue)
end

def self.face(*args) ## Checks if the face is a composite.
return cp_cm_face(*args) unless Composites.include?(args[0])
create_composite(args[0], "Graphics/Faces/")
hue = args[1] ? args[1] : 0
load_bitmap("Graphics/Faces/", args[0], hue)
end

def self.need_comp_ref?(file, path) ## Checks refresh status.
return true if Composites.refresh?(file)
return true if @cache[path].nil? || @cache[path].disposed?
return false
end

def self.create_composite(file, folder) ## Find and create the composite.
path = "#{folder}#{file}"
return unless need_comp_ref?(file, path)
foldrs = ["Graphics/Characters/", "Graphics/Faces/"]
Composites.constants.each_with_index do |fld, i|
paths = "#{foldrs}#{file}"
array = Composites.images(file)
Composites.layers do |i|
image = array
unless @temp
@temp = Bitmap.new("#{fld}#{image}") rescue next
@temp.hue_change(Composites.hues(file)) unless Composites.hues(file).nil?
else
t = Bitmap.new("#{fld}#{image}") rescue next
t.hue_change(Composites.hues(file)) unless Composites.hues(file).nil?
@temp.blt(0, 0, t, t.rect)
t.dispose; t = nil
end
end
@temp = Bitmap.new unless @temp
Composites.refreshed(file)
@cache[paths] = Bitmap.new(@temp.width, @temp.height)
@cache[paths].blt(0, 0, @temp, @temp.rect)
@temp.dispose; @temp = nil
end
Composites.remove_temp_layers(file)
end

def self.clear ## Reset the composite cache.
cp_cm_clear
Composites.clear
end
end

module Composites
def self.include?(file) ## Checks if a file is a composite.
return CP::COMPOSITE::NAMES.include?(file)
end

def self.options ## Easy access of the options hash.
return CP::COMPOSITE::GUI_OPTIONS
end

def self.lists ## Easy access of the gui lists hash.
return CP::COMPOSITE::GUI_LISTS
end

def self.list_by_block(handler, block) ## Returns a list based on gender.
return [] unless [0, 1].include?(block) && lists.include?(handler)
return lists[handler].select {|a| !files[a][block].nil?}
end

def self.layers ## Gets each layer key one at a time.
CP::COMPOSITE::COMPOSITE.each do |key|
yield key
end
end

def self.constants ## Gets the folder constants.
if CP::COMPOSITE::USE_FACESETS
return [CP::COMPOSITE::CHAR_FOLDER, CP::COMPOSITE::FACE_FOLDER]
else
return [CP::COMPOSITE::CHAR_FOLDER]
end
end

def self.files ## Gets the file handler hash.
return CP::COMPOSITE::FILE_HANDLERS
end

def self.include_block?(block, handler) ## Checks gender blocks to handlers.
return false unless files.include?(handler)
return !files[handler][block].nil?
end

def self.standard ## Gets the standard GUI display.
return CP::COMPOSITE::STANDARD
end

def self.get_first_handler(block, key) ## Gets the init files based on block.
return nil if ![0, 1].include?(block) || !lists.include?(key)
lists[key].each do |handler|
next unless files.include?(handler)
return handler unless files[handler][block].nil?
end
return nil
end

def self.n(file) ## Returns a number from a file.
return CP::COMPOSITE::NAMES[file]
end

def self.refreshed(file) ## Resets a file's refresh status.
return unless n(file)
actor(file).composite_refresh = false
end

def self.images(file) ## Get all images of a file.
return @temp_images[file] if @temp_images && @temp_images[file]
return actor(file).composite_images
end

def self.hues(file) ## Get all hues of a file.
return @temp_hues[file] if @temp_hues && @temp_hues[file]
return actor(file).composite_hues
end

def self.remove_temp_layers(file) ## Removes temporary (save) layers.
@temp_images.delete(file) if @temp_images
@temp_hues.delete(file) if @temp_hues
end

def self.make_temp_file(file, handlers) ## Create a new temp of a file.
@temp_images = {} if @temp_images.nil?; @temp_hues = {} if @temp_hues.nil?
@temp_images[file] = {}; @temp_hues[file] = {}
handlers.each do |key, array|
@temp_images[file][key] = array[0]
@temp_hues[file][key] = array[1]
end
end

def self.refresh?(file) ## Check if a file needs refreshing.
return false unless n(file) ## Includes temp file checking.
return true if @temp_images && @temp_images.include?(file)
return actor(file).composite_refresh
end

def self.actor(file) ## Gets a game actor from a file name.
return $game_actors[n(file)]
end

def self.clear ## Allows forced reset of each file.
CP::COMPOSITE::NAMES.keys.each do |file|
actor(file).composite_refresh = true
end
end
end

class Game_Actor < Game_Battler
attr_accessor :composite_refresh

alias cp_cmpst_init initialize
def initialize(*args) ## Sets the initial values for composites.
cp_cmpst_init(*args)
@composite_refresh = true
@editor_changes = {}
@editor_hues = {}
@forced_composites = {}
end

def composite_images ## Returns the composite images for an actor.
make_composite_lists if @composite_refresh
return @composite_images
end

def composite_hues ## Returns the composite hues.
make_composite_lists if @composite_refresh
return @composite_hues
end

def edd_additions(hueless, rear) ## Make a new filename based on layers.
a = ""
b = hueless ? "#{a}Hueless" : a
c = rear ? "#{b}Rear" : b
return c
end

def get_composite_lists ## Gets a composite list for save files.
return {} unless Composites.include?(character_name)
make_composite_lists
r = {}
@composite_images.each {|k, v| r[k] = [v, @composite_hues[k]]}
return r
end

def make_composite_lists ## Makes the list of composites and hues.
@composite_images = {}
@composite_hues = {}
@composite_male = get_base_gender ## Sets gender.
if CP::COMPOSITE::SWITCHES.include?(@actor_id) ## Sets a gender switch.
$game_switches[CP::COMPOSITE::SWITCHES[@actor_id]] = @composite_male
end
block = @composite_male ? 0 : 1
make_equip_hashes(block) ## Ensures equips are set up.
Composites.layers do |key| ## Check each layer.
@composite_hues[key] = 0 ## Gets init values for variables.
name = nil
string = key.to_s
hueless = string.include?("Hueless")
rear = string.include?("Rear")
all = string.include?("All")
string.gsub!(/(Hueless|All|Rear)/, '')
edd = edd_additions(hueless, rear)
line = CP::COMPOSITE::GUI_OPTIONS[string.to_sym]
handler = get_composite_handler(key)
parent = get_composite_handler(string.to_sym)
hues = get_composite_hue(key)
if all && !line.nil? ## Determines the needed value.
name = line[2]
elsif handler && Composites.files.include?(handler) &&
Composites.files[handler][block]
name = "#{Composites.files[handler][block]}#{edd}"
elsif parent && Composites.files.include?(parent) &&
Composites.files[parent][block] && (rear || hueless)
name = "#{Composites.files[parent][block]}#{edd}"
elsif Composites.standard.include?(key)
name = Composites.files[Composites.standard[key]][block]
end
next unless name ## Skips if there is no name.
@composite_images[key] = name ## Creates the hashes.
@composite_hues[key] = hueless ? 0 : hues
end
end

def get_base_gender ## Gets the gender.
return @editor_changes[:Gender] if @editor_changes.include?🙂Gender)
return actor.gender_base
end

def get_composite_handler(key) ## Complex method to find the file handler.
block = @composite_male ? 0 : 1
if @forced_composites.include?(key) && Composites.include_block?(block,
@forced_composites[key][0])
hues = @forced_composites[key][0]
elsif @equip_hashes.include?(key) && Composites.include_block?(block,
@equip_hashes[key][0])
handler = @equip_hashes[key][0]
elsif @editor_changes.include?(key) && Composites.include_block?(block,
@editor_changes[key])
handler = @editor_changes[key]
elsif actor.composite_init.include?(key) && Composites.include_block?(block,
actor.composite_init[key][0])
handler = actor.composite_init[key][0]
elsif Composites.get_first_handler(block, key)
handler = Composites.get_first_handler(block, key)
else
handler = nil
end
return handler
end

def get_composite_hue(key) ## Same as above but for hues.
block = @composite_male ? 0 : 1
if @forced_composites.include?(key) && Composites.include_block?(block,
@forced_composites[key][0])
hues = @forced_composites[key][1]
elsif @equip_hashes.include?(key) && Composites.include_block?(block,
@equip_hashes[key][0])
hues = @equip_hashes[key][1]
elsif @editor_changes.include?(key) && Composites.include_block?(block,
@editor_changes[key])
hues = @editor_hues[key]
elsif actor.composite_init.include?(key) && Composites.include_block?(block,
actor.composite_init[key][0])
hues = actor.composite_init[key][1]
else
hues = 0
end
return hues
end

def make_equip_hashes(block) ## Makes the handler hash for equips.
@equip_hashes = {}
equips.each do |eq|
next unless eq
eq.composite_hash.each do |key, array|
next if Composites.files[array[0]][male? ? 0 : 1].nil?
@equip_hashes[key] = array
end
end
end

alias cp_composite_change_eq change_equip
def change_equip(*args) ## Ensures refreshing on equip change.
cp_composite_change_eq(*args)
@composite_refresh = true
end

def change_composite(hand, value = nil, hue = nil)
array = ["#{hand}".to_sym, "#{hand}Rear".to_sym, "#{hand}Hueless".to_sym,
"#{hand}All".to_sym]
array.each do |handler| ## Changes values for a layer and sublayers.
unless value.nil?
@editor_changes[handler] = value
@editor_hues[handler] = hue if hue
else
@editor_changes.delete(handler)
@editor_hues.delete(handler)
end
end
@composite_refresh = true
end

def force_composite(hand, value = nil, hue = nil)
array = ["#{hand}".to_sym, "#{hand}Rear".to_sym, "#{hand}Hueless".to_sym,
"#{hand}All".to_sym]
array.each do |handler| ## Changes values for a layer and sublayers.
unless value.nil?
@forced_composites[handler] = []
@forced_composites[handler][0] = value
@forced_composites[handler][1] = hue if hue
else
@forced_composites.delete(handler)
end
end
@composite_refresh = true
end

def reset_composite
@forced_composites = {}
@composite_refresh = true
end

def reset_name ## Changes the name to a default name.
return if actor.alt_name.empty?
@composite_male = get_base_gender
if @composite_male == actor.gender_base
@name = actor.name if @name == actor.alt_name
else
@name = actor.alt_name if @name == actor.name
end
end

def male? ## Check if the actor is male.
return @composite_male
end
end

class Window_SaveFile < Window_Base
def draw_party_characters(x, y) ## Creates a temp array for the save file.
header = DataManager.load_header(@file_index)
return unless header
header[:characters].each_with_index do |data, i|
Composites.make_temp_file(data[0], data[2])
draw_character(data[0], data[1], x + i * 48, y)
end
end
end

class Game_Party < Game_Unit
def characters_for_savefile ## Adds the composite arrays to a save file.
battle_members.collect do |actor|
[actor.character_name, actor.character_index, actor.get_composite_lists]
end
end
end

class Scene_Load < Scene_File ## Clears the composites on a load.
alias cp_comp_load_succ on_load_success
def on_load_success
Composites.clear
cp_comp_load_succ
end
end

class Scene_Save < Scene_File ## Clears the composites on save.
alias cp_comp_save_ok on_savefile_ok
def on_savefile_ok
Composites.clear
cp_comp_save_ok
end
end

class Bitmap
def draw_rainbow(*args) ## Draws a rainbow rectangle.
case args.size
when 1
rect = args[0].clone
when 4
rect = Rect.new(args[0], args[1], args[2], args[3])
end
ca = rainbow_colours
6.times do |i|
wv = rect.width / (6 - i)
n = i == 5 ? 0 : 1
r2 = Rect.new(rect.x, rect.y, wv + n, rect.height)
self.gradient_fill_rect(r2, ca, ca[(i + 1) % 6])
rect.width -= wv
rect.x += wv
end
end

def rainbow_colours ## Colours for the rectangle.
c1 = Color.new(255, 0, 0); c2 = Color.new(255, 255, 0)
c3 = Color.new( 0, 255, 0); c4 = Color.new( 0, 255, 255)
c5 = Color.new( 0, 0, 255); c6 = Color.new(255, 0, 255)
return [c1, c2, c3, c4, c5, c6]
end

@@wheel = Bitmap.new(360, 1)
@@wheel.draw_rainbow(0, 0, 360, 1)

def self.hue_colour_wheel(hue) ## Show the new hue colour.
if @@wheel.disposed?
@@wheel = Bitmap.new(360, 1)
@@wheel.draw_rainbow(0, 0, 360, 1)
end
return @@wheel.get_pixel(hue % 360, 0)
end
end

## The core bits of the script scene are below.
class Window_CCFace < Window_Base
def initialize(actor, input)
super(0, 0, 120, 120)
self.visible = CP::COMPOSITE::USE_FACESETS
@input_window = input
self.y = @input_window.y
self.x = @input_window.x - (self.width + 8)
@actor = $data_actors[actor]
refresh
end

def refresh
contents.clear
draw_face(@actor.face_name, @actor.face_index, 0, 0)
end
end

class Window_CCCharacter < Window_Base
def initialize(actor, input)
super(0, 0, CP::COMPOSITE::WINDOW_WIDTH, CP::COMPOSITE::WINDOW_HEIGHT)
@input_window = input
self.y = @input_window.y
self.x = @input_window.x + @input_window.width + 8
@actor = $data_actors[actor]
@ticker = 10
@last_frame = 1
@frame = 1
refresh
end

def update
@ticker += 1
@frame = (@ticker % 40) / 10; @frame = 1 if @frame == 3
return if @frame == @last_frame
@last_frame = @frame
refresh
end

def refresh
contents.clear
x = contents.width / 2
y = contents.height - 6
draw_character(@actor.character_name, @actor.character_index, x, y, @frame)
end

def draw_character(character_name, character_index, x, y, frame = 1)
return unless character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+frame)*cw, (n/4*4)*ch, cw, ch)
ret_rect = Rect.new(x - cw, y - cw * 2, cw * 2, ch * 2)
contents.stretch_blt(ret_rect, bitmap, src_rect)
end
end

class Window_CCGui < Window_Selectable
def initialize(file, list)
@list = list
extra_width = CP::COMPOSITE::WINDOW_WIDTH + 8
extra_width += 128 if CP::COMPOSITE::USE_FACESETS
x = (Graphics.width - (180 + extra_width)) / 2
x += 128 if CP::COMPOSITE::USE_FACESETS
y = (Graphics.height - window_height) / 2
h = window_height
super(x, y, 180, h)
@file = file
refresh
end

def window_height
[fitting_height(item_max * 2), Graphics.height].min
end

def item_max
@list.size + 1
end

def contents_height
(item_max * 2) * line_height
end

def item_height
line_height * 2
end

def refresh
contents.clear
draw_all_items
end

def data
@list[@index]
end

def adj_data
if Composites.options[data][0].is_a?(Symbol)
return Composites.options[data][0]
else
return data
end
end

def draw_item(index)
rect = item_rect(index)
lh = line_height
if index == @list.size
text = CP::COMPOSITE::GUI_CLOSE
change_color(normal_color)
draw_text(rect.x + 2, rect.y + lh / 2, rect.width - 4, lh, text, 1)
else
block = Composites.options[@list[index]]
if block[0].is_a?(Symbol)
title = Composites.options[block[0]][0]
else
title = block[0]
end
value = (CP::COMPOSITE::COMPOSITE.include?(@list[index]) ||
@list[index] == :Gender || @list[index] == :Name)
sym = value ? @list[index] : block[0]
change_color(system_color)
draw_text(rect.x + 2, rect.y, rect.width - 4, lh, title)
case sym
when :Gender
na = CP::COMPOSITE::GENDER_NAMES
name = Composites.actor(@file).male? ? na[0] : na[1]
when :Name
name = Composites.actor(@file).name
else
name = Composites.actor(@file).get_composite_handler(sym)
name = CP::COMPOSITE::EMPTY_TEXT if name.nil?
hue = Composites.actor(@file).get_composite_hue(sym)
if block[1]
c1 = Bitmap.hue_colour_wheel(hue)
c2 = Color.new(c1.red, c1.green, c1.blue, 0)
r2 = contents.text_size(name).width
hr = Rect.new(contents.width - (r2 + 6), rect.y + lh + 3, r2 + 1, lh - 6)
contents.gradient_fill_rect(hr, c2, c1)
end
end
change_color(normal_color)
draw_text(rect.x + 2, rect.y + lh, rect.width - 6, lh, name, 2)
end
end
end

class Window_CCSelect < Window_Selectable
attr_reader :hue

def initialize(file, input)
super(0, 0, 160, 0)
@input_window = input
@file = file
@data = nil
@hue = 0
end

def item_max
return 1 if @data.nil? || @data.empty?
return @data.size
end

def refresh
contents.clear
draw_all_items
draw_hue_wheel
end

def draw_item(index)
rect = item_rect(index); rect.x += 2; rect.width -= 4
change_color(normal_color)
draw_text(rect, @data[index])
end

def draw_hue_wheel
rect = item_rect(item_max); contents.clear_rect(rect)
rect.y += 4; rect.height -= 8; rect.x += 8; rect.width -= 16
ind = Composites.options[@input_window.data]
return if !ind || ind[1] == 0
if ind[1] == 2
value = @hue >= 180 ? @hue - 360 : @hue
rect.height /= 2; rect.height -= 1; rect.x -= 60
contents.draw_rainbow(rect)
rect.y += (rect.height + 1); rect.x -= value / 3
contents.draw_rainbow(rect)
rect.x += 119
contents.draw_rainbow(rect)
rect.y -= (rect.height + 1); rect.x += value / 3
contents.draw_rainbow(rect)
bitmap2 = Bitmap.new(10, 19)
bitmap2.fill_rect(0, 0, 10, 19, Color.new(255, 255, 255))
c1 = Bitmap.hue_colour_wheel(0)
c2 = Bitmap.hue_colour_wheel(@hue)
bitmap2.gradient_fill_rect(1, 1, 8, 17, c1, c2, true)
rect = item_rect(item_max)
contents.blt((rect.width - 10) / 2, rect.y + 2, bitmap2, bitmap2.rect)
rect.width = 10
contents.clear_rect(rect)
rect.x = contents.width - rect.width
contents.clear_rect(rect)
elsif ind[1] == 1
contents.draw_rainbow(rect)
bitmap2 = Bitmap.new(7, 20)
bitmap2.fill_rect(0, 0, 7, 20, Color.new(255, 255, 255))
bitmap2.fill_rect(1, 2, 5, 16, Bitmap.hue_colour_wheel(@hue))
off = @hue / 3
contents.blt(rect.x - 3 + off, rect.y - 2, bitmap2, bitmap2.rect)
end
end

def show
val = @input_window.adj_data
ind = @input_window.data
actor = Composites.actor(@file)
block = Composites.actor(@file).male? ? 0 : 1
@name = Composites.list_by_block(ind, block).index(actor.get_composite_handler(val))
@index = val != :Gender ? @name : Composites.actor(@file).male? ? 0 : 1
@index = 0 if @index.nil?
@hue = actor.get_composite_hue(val) unless val == :Gender
cont = Composites.options[ind]
if val == :Gender
@data = CP::COMPOSITE::GENDER_NAMES
else
@data = Composites.list_by_block(ind, block)
end
add = Composites.options[ind][1] ? 1 : 0
add = 0 if val == :Gender
self.height = fitting_height(@data.size + add)
create_contents
refresh
self.x = @input_window.x + 16
iw = @input_window
self.y = iw.y + iw.standard_padding + (iw.index * (iw.line_height * 2)) - iw.oy + 28
self.y = Graphics.height - self.height if y + height > Graphics.height
super
activate
end

def cursor_right(wrap)
return if Composites.options.include?(@input_window.data) &&
!Composites.options[@input_window.data][1]
@hue /= 12; @hue *= 12
@hue += 12; @hue -= 360 if @hue >= 360
draw_hue_wheel
end

def cursor_left(wrap)
return if Composites.options.include?(@input_window.data) &&
!Composites.options[@input_window.data][1]
@hue /= 12; @hue *= 12
@hue -= 12; @hue += 360 if @hue < 0
draw_hue_wheel
end
end

class Game_Interpreter
def creation(char, list = nil) ## Allows for easy calling of the scene.
return if $game_party.in_battle
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
char = CP::COMPOSITE::NAMES.index(char)
else
return unless Composites.include?(char)
end
list = CP::COMPOSITE::BASE_GUI if list.nil?
return unless list.is_a?(Array)
SceneManager.call(Scene_CharacterCreation)
SceneManager.scene.prepare(char, list)
Fiber.yield
end

def composite_force(char, handler, name, hue = 0)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].force_composite(handler, name, hue)
end

def composite_custom(char, handler, name, hue = 0)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].change_composite(handler, name, hue)
end

def composite_reset(char)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].reset_composite
end
end

class Scene_CharacterCreation < Scene_MenuBase
def prepare(file, list)
@file = file
@list = list
end

def start
super
@actor = Composites.actor(@file)
create_windows
end

def create_windows
@input_window = Window_CCGui.new(@file, @list)
@input_window.set_handler🙂ok, method🙂gui_ok))
@input_window.set_handler🙂cancel, method🙂gui_cancel))
@select_window = Window_CCSelect.new(@file, @input_window)
@select_window.set_handler🙂ok, method🙂select_ok))
@select_window.set_handler🙂cancel, method🙂select_cancel))
@chara_window = Window_CCCharacter.new(@actor.id, @input_window)
@face_window = Window_CCFace.new(@actor.id, @input_window)
@input_window.activate.select(0)
@select_window.hide
end

def gui_ok
val = @input_window.data
if val == :Name
SceneManager.call(Scene_Name)
SceneManager.scene.prepare(Composites.actor(@file).id, CP::COMPOSITE::CHARACTERS)
@input_window.refresh
elsif val == nil
return_scene
else
@select_window.show
end
end

def gui_cancel
@input_window.activate.select(@input_window.item_max - 1)
end

def select_ok
val = @input_window.data
adj = @input_window.adj_data
id = @select_window.index
if adj == :Gender
if id == 0
Composites.actor(@file).change_composite🙂Gender, true)
Composites.actor(@file).reset_name
elsif id == 1
Composites.actor(@file).change_composite🙂Gender, false)
Composites.actor(@file).reset_name
end
else
block = Composites.actor(@file).male? ? 0 : 1
handler = Composites.list_by_block(val, block)[@select_window.index]
hue = @select_window.hue
Composites.actor(@file).change_composite(adj, handler, hue)
end
@select_window.hide
@chara_window.refresh
@face_window.refresh
@input_window.activate.refresh
end

def select_cancel
@select_window.hide
@input_window.activate
end
end

class RPG::BaseItem
def composite_hash
add_composite_data if @composite_hash.nil?
return @composite_hash
end

def composite_init
add_composite_data if @composite_init.nil?
return @composite_init
end

def gender_base
add_composite_data if @gender_base.nil?
return @gender_base
end

def alt_name
add_composite_data if @alt_name.nil?
return @alt_name
end

INITI_RE = /(.+) init\[(.+)[,]\s*(\d+)\]/i
IMAGE_RE = /(.+) image\[(.+)[,]\s*(\d+)\]/i
GENDER_RE = /gender\[(male|female)\]/i
ALT_NAME = /alt name\[(.+)\]/i

def add_composite_data
@gender_base = CP::COMPOSITE::MALE_DEFAULT
@composite_hash = {}; @composite_init = {}; @alt_name = ""
self.note.split(/[\r\n]+/).each do |line|
case line
when INITI_RE
@composite_init[$1.to_sym] = [$2.to_s, $3.to_i]
@composite_init["#{$1.to_s}Rear".to_sym] = [$2.to_s, $3.to_i]
@composite_init["#{$1.to_s}Hueless".to_sym] = [$2.to_s, 0]
@composite_init["#{$1.to_s}All".to_sym] = [$2.to_s, $3.to_i]
when IMAGE_RE
@composite_hash[$1.to_sym] = [$2.to_s, $3.to_i]
@composite_hash["#{$1.to_s}Rear".to_sym] = [$2.to_s, $3.to_i]
@composite_hash["#{$1.to_s}Hueless".to_sym] = [$2.to_s, 0]
@composite_hash["#{$1.to_s}All".to_sym] = [$2.to_s, $3.to_i]
when GENDER_RE
@gender_base = true if $1.to_s.downcase == "male"
@gender_base = false if $1.to_s.downcase == "female"
when ALT_NAME
@alt_name = $1.to_s
end
end
end
end

###--------------------------------------------------------------------------###
# End of script. #
###--------------------------------------------------------------------------###
I have an event setup to where it has this script call:

 

array = [:hair, :eyes, :eyewear, 😮utwear]
creation(12, array)

 

the menu shows up just fine, but when i go to select, for example; outerwear, it gives me this message:

Spoiler
script 'CP Character Composite' line 366: NoMethodError occured.
undefined method '[]' for nil:NilClass
Kinda new, is this compatible  with MV?
Kinda new, is this compatible  with MV?
Unfortunately it's not. This is a RGSS3 script... MV uses Javascript.
i've been looking for something like this and want to try it, but before i do i have a question is it possable to have the player choose defferent  colors based on race?

like say a dark elf can only be light/dark ebony, or a moon elf can only be light/dark purple, etc.
I try changing the actor graphic to a swimming graphic and when I go to change it back to the actor's composite graphic, it doesn't change????
Hello!

First of all, I want to say how grateful I am for a script like this, it looks great, and it works great in the demo provided. However, I keep on getting an error when using this script in my own projects! I can't work around it whatsoever, and I'm not sure what's causing it.

I added a screenshot of the error message I get when using your script, and really hope someone has a solution!

Thanks in advance!

Edit: Never mind, I figured out what caused the problem. Sorry!  😉
I'm having the exact same problem and can't solve it!
Instead of that type of Faces we can add RTP Face style ?


Somthing Like this ? :


ea2zrk.png
Hey. If anyone is still here. having a similar problem to some above. I'm getting the error message "NoMethodError" "Undefined method 'include?'". I've made double and triple sure that the character file matches the "$hero1"

But I keep getting this error message. I can't find a connection with "include?" to any of the variables I have given the script. I turned off facesets. But I also added the note tags in the actor window just to be sure..I'm also having problems using mack sprites. Is the character only limited to one 32x32 square on the map? like only half the characters torso shows up and it uses the left walking animation sprite when walking down, ect...I don't know whats causing this.  Any help would be greatly appreciated.

Spoiler
##----------------------------------------------------------------------------##
## Composite Character v2.1
## Created by Neon Black
##
## Only for non-commercial use. See full terms of use and contact info at:
## http://cphouseset.wordpress.com/liscense-and-terms-of-use/
##----------------------------------------------------------------------------##
##
##----------------------------------------------------------------------------##
## Revision Info:
## V2.1 - 2.12.2013
## Added new script calls
## V2.0 - 1.24.2013
## Rewrote entire script from scratch
## V1.0 - 10.17.2012
## Wrote and debugged main script
##----------------------------------------------------------------------------##
##
$imported = {} if $imported.nil? ##
$imported["COMPOSITE"] = 2.1 ##
##
##----------------------------------------------------------------------------##
## Instructions:
## Place this script in the "Materials" section of the scripts above "Main".
## To use this script you must have additional composite graphics in a folder
## for characters and a folder for faces. Charactersets will use composites
## based on their names in the NAMES setting. Some layers of the composite
## may also change based on the equipped items on the actor associated with
## file name. There are several tags that work with both actors and equips.
##
## Tags:
## tag init[Handler, hue]
## - Can only be tagged in actors. Changes composite layer :tag to handler
## "Handler" with the defined hue. Do not use colons for layer names or
## quotes for file handler names.
## gender[male]
## - Sets the character's initial gender to "male" or "female" depending on
## which you place in the brackets. This can only tag actors.
## alt name[Christopher]
## - Sets the character's name for the opposite gender. If the player changes
## the gender in the GUI and has not changed the name, the new name will be
## displayed. The name "Christopher" here can be any name you desire.
## tag image[Handler, hue]
## - Changes the default images for layer :tag to file handler "Handler".
##
## Script Calls:
## The character creation screen can be called with either of these two script
## calls from an event. Other script calls also exist.
##
## creation(id) -or- creation(id, array)
## - The value "id" can be either the actor's ID or the name of the character
## set to modify. The "array" value does not need to be used ever. This is
## the array of handlers from "GUI_LISTS" to use. If no array is defined,
## "BASE_GUI" is used instead.
## composite_custom(id, handler, name, hue)
## - Changes composite "id"'s layer "handler" into file "name" with a hue of
## "hue". This occurs on the same priority level as the character creation
## screen, so it is covered by armour and can be modified by the player.
## "id" must be a value from NAMES, "handler" a layer from COMPOSITE, "name"
## a file from FILE_HANDLERS, and "hue" a number from 0 to 255.
## composite_force(id, handler, name, hue)
## - Similar to the command above, but this takes the highest priority when
## being drawn and cannot be changed by the player.
## composite_reset(id)
## - Removes all layers added using the "composite_force" script call.
##
## Special Layers:
## In order to allow a slight bit more customization, there are 3 types of
## special layers that link directly to other layers. These layers end with
## "Back", "Hueless", and "All".
##
## Back Layers
## - These layers do not actually need to be behind the normal layer. They
## are simply a second layer with all the same properties of the parent
## layer. An example would be :hairRear which would be a rear layer of
## :hair.
## Hueless Layers
## - These layers ignore the changed hue values. The main use of these would
## be objects with skin tone or perhaps objects that you only want to change
## part of the colour on. The only object that uses this in the example
## is :eyesHueless which is a hueless layer of :eyes.
## All Layers
## - These are special layers on the character. They are a layer that appears
## on the character no matter what the player does. The file that appears
## is still linked to the file part it is attatched to for the sake of hue.
## The file that appears for one of these layers is defined in the hash
## GUI_OPTIONS.
##----------------------------------------------------------------------------##
##
module CP # Do not touch ##
module COMPOSITE # these lines. ##
##
##----------------------------------------------------------------------------##
## Config:
## The config options are below. You can set these depending on the flavour of
## your game. Each option is explained in a bit more detail above it.
##
##------

# The folders containing the composite parts for characters and for facesets.
CHAR_FOLDER = "Graphics/Composite/Charas/"
FACE_FOLDER = "Graphics/Composite/Faces/"

# Determines if the creation screen uses face sets are not. Set to false if
# you do not want a faceset displayed.
USE_FACESETS = false

# The width and height of the character window in the creation screen. The
# character in the screen is zoomed in to 200%.
WINDOW_WIDTH = 90
WINDOW_HEIGHT = 112

# The text options for the character selection GUI. EMPTY_TEXT refers to an
# option which is blank for some reason.
GUI_CLOSE = "Done!"
EMPTY_TEXT = "None"

# The number of allowed character spaces for names when input from the editor.
CHARACTERS = 6

# Names for the male and female genders.
GENDER_NAMES = ["Male", "Female"]

# Determines if male undefined characters start out as male characters.
MALE_DEFAULT = true

##------

# Determine the files that are recognized as composite images and the actor
# they are linked to, for the sake of armour, storage, etc.
NAMES ={
"$hero1" => 1,
"$hero2" => 17,
}

# The switches related to characters. A switch is turned ON when the character
# is male and OFF when the character is female.
SWITCHES ={
1 => 2,
17 => 3,
}

# The order for composite layers. The first layer is the lowest layer.
COMPOSITE =[
:hairRear,
:cape,
:armorRear,
:headAll,
:head,
:eyes,
:eyesAll,
:eyesHueless,
:armor,
:hair,
:glasses,
:helmet,
]

# These are the handlers for all files in the composite folders. Actor and
# equip tags as well as GUI options point to a handler and the handler
# determines the male and female files to look up. Make sure every handler
# has a different name.
FILE_HANDLERS ={
# "Handler" => ["Male_File", "Female_File"],
"Shaggy" => ["Hair1M", nil],
"Slick" => ["Hair2M", nil],
"Spiked" => ["Hair3M", nil],
"Fancy" => ["Hair4M", nil],
"Stylish" => [nil, "Hair1F"],
"Waist Length" => [nil, "Hair2F"],
"Curled" => [nil, "Hair3F"],
"Pigtails" => [nil, "Hair4F"],
"Short" => ["Hair1U", "Hair1U"],
"Long" => ["Hair2U", "Hair2U"],
"Observant" => ["Eye1M", "Eye1F"],
"Closed" => ["Eye2M", "Eye2F"],
"Intent" => ["Eye3M", "Eye3F"],

"HeadBase" => ["HeadAll", "HeadAll"],
"FaceBase" => ["FaceM", "FaceF"],
"BodyBase" => ["BaseM", "BaseF"],

"Clothes" => ["ClothesM", "ClothesF"],
"Cloth" => ["ClothM", "ClothF"],
"Armor" => ["ArmourM", "ArmourF"],
"Glasses" => ["Glasses", "Glasses"],
"Sunglasses" => ["Sunglasses", "Sunglasses"],
"Goggles" => ["Goggles", "Goggles"],
}

# Standard handlers. These are default handlers of certain layers.
STANDARD ={
:headAll => "HeadBase",
:head => "FaceBase",
:armor => "BodyBase",
}

# The GUI options that may be called from an array. If the "Name" field is set
# to a :symbol like the :barber example, it will point back to another option
# and use that option's name and layer. The point is simply to link different
# handlers to it as well as giving it different colour options. The colorize?
# option can be set to a value of 0, 1, or 2 depending on the style of hue bar
# you would like displayed. If it is set to 0, no bar will be displayed.
GUI_OPTIONS ={
# :handler => ["Name", colorize?, "AllFile"],
:Name => ["Name", 0, nil],
:Gender => ["Gender", 0, nil],
:hair => ["Hair", 1, nil],
:eyes => ["Eyes", 1, "EyeAll"],

:barber => [:hair, true, nil],
}

# These are the basic options to use in the GUI if no array is defined.
BASE_GUI = [:Name, :Gender, :hair, :eyes]

# These are the lists that refer to the options. Male and Female only options
# are automatically filtered depending on the character's gender.
GUI_LISTS ={
:hair => ["Shaggy", "Slick", "Spiked", "Fancy", "Stylish", "Waist Length",
"Curled", "Pigtails"],
:eyes => ["Observant", "Intent", "Closed"],


:barber => ["Shaggy", "Slick", "Spiked", "Fancy", "Stylish", "Waist Length",
"Curled", "Pigtails", "Short", "Long"],
}

##----------------------------------------------------------------------------##
##
##
##----------------------------------------------------------------------------##
## The following lines are the actual core code of the script. While you are
## certainly invited to look, modifying it may result in undesirable results.
## Modify at your own risk!
###----------------------------------------------------------------------------


end
end

module Cache
class << self ## Alias for the used methods in this module.
alias cp_cm_character character
alias cp_cm_face face
alias cp_cm_clear clear
end

def self.character(*args) ## Checks if the file is a composite.
return cp_cm_character(*args) unless Composites.include?(args[0])
create_composite(args[0], "Graphics/Characters/")
hue = args[1] ? args[1] : 0
load_bitmap("Graphics/Characters/", args[0], hue)
end

def self.face(*args) ## Checks if the face is a composite.
return cp_cm_face(*args) unless Composites.include?(args[0])
create_composite(args[0], "Graphics/Faces/")
hue = args[1] ? args[1] : 0
load_bitmap("Graphics/Faces/", args[0], hue)
end

def self.need_comp_ref?(file, path) ## Checks refresh status.
return true if Composites.refresh?(file)
return true if @cache[path].nil? || @cache[path].disposed?
return false
end

def self.create_composite(file, folder) ## Find and create the composite.
path = "#{folder}#{file}"
return unless need_comp_ref?(file, path)
foldrs = ["Graphics/Characters/", "Graphics/Faces/"]
Composites.constants.each_with_index do |fld, i|
paths = "#{foldrs}#{file}"
array = Composites.images(file)
Composites.layers do |i|
image = array
unless @temp
@temp = Bitmap.new("#{fld}#{image}") rescue next
@temp.hue_change(Composites.hues(file)) unless Composites.hues(file).nil?
else
t = Bitmap.new("#{fld}#{image}") rescue next
t.hue_change(Composites.hues(file)) unless Composites.hues(file).nil?
@temp.blt(0, 0, t, t.rect)
t.dispose; t = nil
end
end
@temp = Bitmap.new unless @temp
Composites.refreshed(file)
@cache[paths] = Bitmap.new(@temp.width, @temp.height)
@cache[paths].blt(0, 0, @temp, @temp.rect)
@temp.dispose; @temp = nil
end
Composites.remove_temp_layers(file)
end

def self.clear ## Reset the composite cache.
cp_cm_clear
Composites.clear
end
end

module Composites
def self.include?(file) ## Checks if a file is a composite.
return CP::COMPOSITE::NAMES.include?(file)
end

def self.options ## Easy access of the options hash.
return CP::COMPOSITE::GUI_OPTIONS
end

def self.lists ## Easy access of the gui lists hash.
return CP::COMPOSITE::GUI_LISTS
end

def self.list_by_block(handler, block) ## Returns a list based on gender.
return [] unless [0, 1].include?(block) && lists.include?(handler)
return lists[handler].select {|a| !files[a][block].nil?}
end

def self.layers ## Gets each layer key one at a time.
CP::COMPOSITE::COMPOSITE.each do |key|
yield key
end
end

def self.constants ## Gets the folder constants.
if CP::COMPOSITE::USE_FACESETS
return [CP::COMPOSITE::CHAR_FOLDER, CP::COMPOSITE::FACE_FOLDER]
else
return [CP::COMPOSITE::CHAR_FOLDER]
end
end

def self.files ## Gets the file handler hash.
return CP::COMPOSITE::FILE_HANDLERS
end

def self.include_block?(block, handler) ## Checks gender blocks to handlers.
return false unless files.include?(handler)
return !files[handler][block].nil?
end

def self.standard ## Gets the standard GUI display.
return CP::COMPOSITE::STANDARD
end

def self.get_first_handler(block, key) ## Gets the init files based on block.
return nil if ![0, 1].include?(block) || !lists.include?(key)
lists[key].each do |handler|
next unless files.include?(handler)
return handler unless files[handler][block].nil?
end
return nil
end

def self.n(file) ## Returns a number from a file.
return CP::COMPOSITE::NAMES[file]
end

def self.refreshed(file) ## Resets a file's refresh status.
return unless n(file)
actor(file).composite_refresh = false
end

def self.images(file) ## Get all images of a file.
return @temp_images[file] if @temp_images && @temp_images[file]
return actor(file).composite_images
end

def self.hues(file) ## Get all hues of a file.
return @temp_hues[file] if @temp_hues && @temp_hues[file]
return actor(file).composite_hues
end

def self.remove_temp_layers(file) ## Removes temporary (save) layers.
@temp_images.delete(file) if @temp_images
@temp_hues.delete(file) if @temp_hues
end

def self.make_temp_file(file, handlers) ## Create a new temp of a file.
@temp_images = {} if @temp_images.nil?; @temp_hues = {} if @temp_hues.nil?
@temp_images[file] = {}; @temp_hues[file] = {}
handlers.each do |key, array|
@temp_images[file][key] = array[0]
@temp_hues[file][key] = array[1]
end
end

def self.refresh?(file) ## Check if a file needs refreshing.
return false unless n(file) ## Includes temp file checking.
return true if @temp_images && @temp_images.include?(file)
return actor(file).composite_refresh
end

def self.actor(file) ## Gets a game actor from a file name.
return $game_actors[n(file)]
end

def self.clear ## Allows forced reset of each file.
CP::COMPOSITE::NAMES.keys.each do |file|
actor(file).composite_refresh = true
end
end
end

class Game_Actor < Game_Battler
attr_accessor :composite_refresh

alias cp_cmpst_init initialize
def initialize(*args) ## Sets the initial values for composites.
cp_cmpst_init(*args)
@composite_refresh = true
@editor_changes = {}
@editor_hues = {}
@forced_composites = {}
end

def composite_images ## Returns the composite images for an actor.
make_composite_lists if @composite_refresh
return @composite_images
end

def composite_hues ## Returns the composite hues.
make_composite_lists if @composite_refresh
return @composite_hues
end

def edd_additions(hueless, rear) ## Make a new filename based on layers.
a = ""
b = hueless ? "#{a}Hueless" : a
c = rear ? "#{b}Rear" : b
return c
end

def get_composite_lists ## Gets a composite list for save files.
return {} unless Composites.include?(character_name)
make_composite_lists
r = {}
@composite_images.each {|k, v| r[k] = [v, @composite_hues[k]]}
return r
end

def make_composite_lists ## Makes the list of composites and hues.
@composite_images = {}
@composite_hues = {}
@composite_male = get_base_gender ## Sets gender.
if CP::COMPOSITE::SWITCHES.include?(@actor_id) ## Sets a gender switch.
$game_switches[CP::COMPOSITE::SWITCHES[@actor_id]] = @composite_male
end
block = @composite_male ? 0 : 1
make_equip_hashes(block) ## Ensures equips are set up.
Composites.layers do |key| ## Check each layer.
@composite_hues[key] = 0 ## Gets init values for variables.
name = nil
string = key.to_s
hueless = string.include?("Hueless")
rear = string.include?("Rear")
all = string.include?("All")
string.gsub!(/(Hueless|All|Rear)/, '')
edd = edd_additions(hueless, rear)
line = CP::COMPOSITE::GUI_OPTIONS[string.to_sym]
handler = get_composite_handler(key)
parent = get_composite_handler(string.to_sym)
hues = get_composite_hue(key)
if all && !line.nil? ## Determines the needed value.
name = line[2]
elsif handler && Composites.files.include?(handler) &&
Composites.files[handler][block]
name = "#{Composites.files[handler][block]}#{edd}"
elsif parent && Composites.files.include?(parent) &&
Composites.files[parent][block] && (rear || hueless)
name = "#{Composites.files[parent][block]}#{edd}"
elsif Composites.standard.include?(key)
name = Composites.files[Composites.standard[key]][block]
end
next unless name ## Skips if there is no name.
@composite_images[key] = name ## Creates the hashes.
@composite_hues[key] = hueless ? 0 : hues
end
end

def get_base_gender ## Gets the gender.
return @editor_changes[:Gender] if @editor_changes.include?🙂Gender)
return actor.gender_base
end

def get_composite_handler(key) ## Complex method to find the file handler.
block = @composite_male ? 0 : 1
if @forced_composites.include?(key) && Composites.include_block?(block,
@forced_composites[key][0])
hues = @forced_composites[key][0]
elsif @equip_hashes.include?(key) && Composites.include_block?(block,
@equip_hashes[key][0])
handler = @equip_hashes[key][0]
elsif @editor_changes.include?(key) && Composites.include_block?(block,
@editor_changes[key])
handler = @editor_changes[key]
elsif actor.composite_init.include?(key) && Composites.include_block?(block,
actor.composite_init[key][0])
handler = actor.composite_init[key][0]
elsif Composites.get_first_handler(block, key)
handler = Composites.get_first_handler(block, key)
else
handler = nil
end
return handler
end

def get_composite_hue(key) ## Same as above but for hues.
block = @composite_male ? 0 : 1
if @forced_composites.include?(key) && Composites.include_block?(block,
@forced_composites[key][0])
hues = @forced_composites[key][1]
elsif @equip_hashes.include?(key) && Composites.include_block?(block,
@equip_hashes[key][0])
hues = @equip_hashes[key][1]
elsif @editor_changes.include?(key) && Composites.include_block?(block,
@editor_changes[key])
hues = @editor_hues[key]
elsif actor.composite_init.include?(key) && Composites.include_block?(block,
actor.composite_init[key][0])
hues = actor.composite_init[key][1]
else
hues = 0
end
return hues
end

def make_equip_hashes(block) ## Makes the handler hash for equips.
@equip_hashes = {}
equips.each do |eq|
next unless eq
eq.composite_hash.each do |key, array|
next if Composites.files[array[0]][male? ? 0 : 1].nil?
@equip_hashes[key] = array
end
end
end

alias cp_composite_change_eq change_equip
def change_equip(*args) ## Ensures refreshing on equip change.
cp_composite_change_eq(*args)
@composite_refresh = true
end

def change_composite(hand, value = nil, hue = nil)
array = ["#{hand}".to_sym, "#{hand}Rear".to_sym, "#{hand}Hueless".to_sym,
"#{hand}All".to_sym]
array.each do |handler| ## Changes values for a layer and sublayers.
unless value.nil?
@editor_changes[handler] = value
@editor_hues[handler] = hue if hue
else
@editor_changes.delete(handler)
@editor_hues.delete(handler)
end
end
@composite_refresh = true
end

def force_composite(hand, value = nil, hue = nil)
array = ["#{hand}".to_sym, "#{hand}Rear".to_sym, "#{hand}Hueless".to_sym,
"#{hand}All".to_sym]
array.each do |handler| ## Changes values for a layer and sublayers.
unless value.nil?
@forced_composites[handler] = []
@forced_composites[handler][0] = value
@forced_composites[handler][1] = hue if hue
else
@forced_composites.delete(handler)
end
end
@composite_refresh = true
end

def reset_composite
@forced_composites = {}
@composite_refresh = true
end

def reset_name ## Changes the name to a default name.
return if actor.alt_name.empty?
@composite_male = get_base_gender
if @composite_male == actor.gender_base
@name = actor.name if @name == actor.alt_name
else
@name = actor.alt_name if @name == actor.name
end
end

def male? ## Check if the actor is male.
return @composite_male
end
end

class Window_SaveFile < Window_Base
def draw_party_characters(x, y) ## Creates a temp array for the save file.
header = DataManager.load_header(@file_index)
return unless header
header[:characters].each_with_index do |data, i|
Composites.make_temp_file(data[0], data[2])
draw_character(data[0], data[1], x + i * 48, y)
end
end
end

class Game_Party < Game_Unit
def characters_for_savefile ## Adds the composite arrays to a save file.
battle_members.collect do |actor|
[actor.character_name, actor.character_index, actor.get_composite_lists]
end
end
end

class Scene_Load < Scene_File ## Clears the composites on a load.
alias cp_comp_load_succ on_load_success
def on_load_success
Composites.clear
cp_comp_load_succ
end
end

class Scene_Save < Scene_File ## Clears the composites on save.
alias cp_comp_save_ok on_savefile_ok
def on_savefile_ok
Composites.clear
cp_comp_save_ok
end
end

class Bitmap
def draw_rainbow(*args) ## Draws a rainbow rectangle.
case args.size
when 1
rect = args[0].clone
when 4
rect = Rect.new(args[0], args[1], args[2], args[3])
end
ca = rainbow_colours
6.times do |i|
wv = rect.width / (6 - i)
n = i == 5 ? 0 : 1
r2 = Rect.new(rect.x, rect.y, wv + n, rect.height)
self.gradient_fill_rect(r2, ca, ca[(i + 1) % 6])
rect.width -= wv
rect.x += wv
end
end

def rainbow_colours ## Colours for the rectangle.
c1 = Color.new(255, 0, 0); c2 = Color.new(255, 255, 0)
c3 = Color.new( 0, 255, 0); c4 = Color.new( 0, 255, 255)
c5 = Color.new( 0, 0, 255); c6 = Color.new(255, 0, 255)
return [c1, c2, c3, c4, c5, c6]
end

@@wheel = Bitmap.new(360, 1)
@@wheel.draw_rainbow(0, 0, 360, 1)

def self.hue_colour_wheel(hue) ## Show the new hue colour.
if @@wheel.disposed?
@@wheel = Bitmap.new(360, 1)
@@wheel.draw_rainbow(0, 0, 360, 1)
end
return @@wheel.get_pixel(hue % 360, 0)
end
end

## The core bits of the script scene are below.
class Window_CCFace < Window_Base
def initialize(actor, input)
super(0, 0, 120, 120)
self.visible = CP::COMPOSITE::USE_FACESETS
@input_window = input
self.y = @input_window.y
self.x = @input_window.x - (self.width + 8)
@actor = $data_actors[actor]
refresh
end

def refresh
contents.clear
draw_face(@actor.face_name, @actor.face_index, 0, 0)
end
end

class Window_CCCharacter < Window_Base
def initialize(actor, input)
super(0, 0, CP::COMPOSITE::WINDOW_WIDTH, CP::COMPOSITE::WINDOW_HEIGHT)
@input_window = input
self.y = @input_window.y
self.x = @input_window.x + @input_window.width + 8
@actor = $data_actors[actor]
@ticker = 10
@last_frame = 1
@frame = 1
refresh
end

def update
@ticker += 1
@frame = (@ticker % 40) / 10; @frame = 1 if @frame == 3
return if @frame == @last_frame
@last_frame = @frame
refresh
end

def refresh
contents.clear
x = contents.width / 2
y = contents.height - 6
draw_character(@actor.character_name, @actor.character_index, x, y, @frame)
end

def draw_character(character_name, character_index, x, y, frame = 1)
return unless character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+frame)*cw, (n/4*4)*ch, cw, ch)
ret_rect = Rect.new(x - cw, y - cw * 2, cw * 2, ch * 2)
contents.stretch_blt(ret_rect, bitmap, src_rect)
end
end

class Window_CCGui < Window_Selectable
def initialize(file, list)
@list = list
extra_width = CP::COMPOSITE::WINDOW_WIDTH + 8
extra_width += 128 if CP::COMPOSITE::USE_FACESETS
x = (Graphics.width - (180 + extra_width)) / 2
x += 128 if CP::COMPOSITE::USE_FACESETS
y = (Graphics.height - window_height) / 2
h = window_height
super(x, y, 180, h)
@file = file
refresh
end

def window_height
[fitting_height(item_max * 2), Graphics.height].min
end

def item_max
@list.size + 1
end

def contents_height
(item_max * 2) * line_height
end

def item_height
line_height * 2
end

def refresh
contents.clear
draw_all_items
end

def data
@list[@index]
end

def adj_data
if Composites.options[data][0].is_a?(Symbol)
return Composites.options[data][0]
else
return data
end
end

def draw_item(index)
rect = item_rect(index)
lh = line_height
if index == @list.size
text = CP::COMPOSITE::GUI_CLOSE
change_color(normal_color)
draw_text(rect.x + 2, rect.y + lh / 2, rect.width - 4, lh, text, 1)
else
block = Composites.options[@list[index]]
if block[0].is_a?(Symbol)
title = Composites.options[block[0]][0]
else
title = block[0]
end
value = (CP::COMPOSITE::COMPOSITE.include?(@list[index]) ||
@list[index] == :Gender || @list[index] == :Name)
sym = value ? @list[index] : block[0]
change_color(system_color)
draw_text(rect.x + 2, rect.y, rect.width - 4, lh, title)
case sym
when :Gender
na = CP::COMPOSITE::GENDER_NAMES
name = Composites.actor(@file).male? ? na[0] : na[1]
when :Name
name = Composites.actor(@file).name
else
name = Composites.actor(@file).get_composite_handler(sym)
name = CP::COMPOSITE::EMPTY_TEXT if name.nil?
hue = Composites.actor(@file).get_composite_hue(sym)
if block[1]
c1 = Bitmap.hue_colour_wheel(hue)
c2 = Color.new(c1.red, c1.green, c1.blue, 0)
r2 = contents.text_size(name).width
hr = Rect.new(contents.width - (r2 + 6), rect.y + lh + 3, r2 + 1, lh - 6)
contents.gradient_fill_rect(hr, c2, c1)
end
end
change_color(normal_color)
draw_text(rect.x + 2, rect.y + lh, rect.width - 6, lh, name, 2)
end
end
end

class Window_CCSelect < Window_Selectable
attr_reader :hue

def initialize(file, input)
super(0, 0, 160, 0)
@input_window = input
@file = file
@data = nil
@hue = 0
end

def item_max
return 1 if @data.nil? || @data.empty?
return @data.size
end

def refresh
contents.clear
draw_all_items
draw_hue_wheel
end

def draw_item(index)
rect = item_rect(index); rect.x += 2; rect.width -= 4
change_color(normal_color)
draw_text(rect, @data[index])
end

def draw_hue_wheel
rect = item_rect(item_max); contents.clear_rect(rect)
rect.y += 4; rect.height -= 8; rect.x += 8; rect.width -= 16
ind = Composites.options[@input_window.data]
return if !ind || ind[1] == 0
if ind[1] == 2
value = @hue >= 180 ? @hue - 360 : @hue
rect.height /= 2; rect.height -= 1; rect.x -= 60
contents.draw_rainbow(rect)
rect.y += (rect.height + 1); rect.x -= value / 3
contents.draw_rainbow(rect)
rect.x += 119
contents.draw_rainbow(rect)
rect.y -= (rect.height + 1); rect.x += value / 3
contents.draw_rainbow(rect)
bitmap2 = Bitmap.new(10, 19)
bitmap2.fill_rect(0, 0, 10, 19, Color.new(255, 255, 255))
c1 = Bitmap.hue_colour_wheel(0)
c2 = Bitmap.hue_colour_wheel(@hue)
bitmap2.gradient_fill_rect(1, 1, 8, 17, c1, c2, true)
rect = item_rect(item_max)
contents.blt((rect.width - 10) / 2, rect.y + 2, bitmap2, bitmap2.rect)
rect.width = 10
contents.clear_rect(rect)
rect.x = contents.width - rect.width
contents.clear_rect(rect)
elsif ind[1] == 1
contents.draw_rainbow(rect)
bitmap2 = Bitmap.new(7, 20)
bitmap2.fill_rect(0, 0, 7, 20, Color.new(255, 255, 255))
bitmap2.fill_rect(1, 2, 5, 16, Bitmap.hue_colour_wheel(@hue))
off = @hue / 3
contents.blt(rect.x - 3 + off, rect.y - 2, bitmap2, bitmap2.rect)
end
end

def show
val = @input_window.adj_data
ind = @input_window.data
actor = Composites.actor(@file)
block = Composites.actor(@file).male? ? 0 : 1
@name = Composites.list_by_block(ind, block).index(actor.get_composite_handler(val))
@index = val != :Gender ? @name : Composites.actor(@file).male? ? 0 : 1
@index = 0 if @index.nil?
@hue = actor.get_composite_hue(val) unless val == :Gender
cont = Composites.options[ind]
if val == :Gender
@data = CP::COMPOSITE::GENDER_NAMES
else
@data = Composites.list_by_block(ind, block)
end
add = Composites.options[ind][1] ? 1 : 0
add = 0 if val == :Gender
self.height = fitting_height(@data.size + add)
create_contents
refresh
self.x = @input_window.x + 16
iw = @input_window
self.y = iw.y + iw.standard_padding + (iw.index * (iw.line_height * 2)) - iw.oy + 28
self.y = Graphics.height - self.height if y + height > Graphics.height
super
activate
end

def cursor_right(wrap)
return if Composites.options.include?(@input_window.data) &&
!Composites.options[@input_window.data][1]
@hue /= 12; @hue *= 12
@hue += 12; @hue -= 360 if @hue >= 360
draw_hue_wheel
end

def cursor_left(wrap)
return if Composites.options.include?(@input_window.data) &&
!Composites.options[@input_window.data][1]
@hue /= 12; @hue *= 12
@hue -= 12; @hue += 360 if @hue < 0
draw_hue_wheel
end
end

class Game_Interpreter
def creation(char, list = nil) ## Allows for easy calling of the scene.
return if $game_party.in_battle
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
char = CP::COMPOSITE::NAMES.index(char)
else
return unless Composites.include?(char)
end
list = CP::COMPOSITE::BASE_GUI if list.nil?
return unless list.is_a?(Array)
SceneManager.call(Scene_CharacterCreation)
SceneManager.scene.prepare(char, list)
Fiber.yield
end

def composite_force(char, handler, name, hue = 0)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].force_composite(handler, name, hue)
end

def composite_custom(char, handler, name, hue = 0)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].change_composite(handler, name, hue)
end

def composite_reset(char)
if char.is_a?(Integer)
return unless CP::COMPOSITE::NAMES.has_value?(char)
else
return unless Composites.include?(char)
char = CP::COMPOSITE::NAMES[char]
end
$game_actors[char].reset_composite
end
end

class Scene_CharacterCreation < Scene_MenuBase
def prepare(file, list)
@file = file
@list = list
end

def start
super
@actor = Composites.actor(@file)
create_windows
end

def create_windows
@input_window = Window_CCGui.new(@file, @list)
@input_window.set_handler🙂ok, method🙂gui_ok))
@input_window.set_handler🙂cancel, method🙂gui_cancel))
@select_window = Window_CCSelect.new(@file, @input_window)
@select_window.set_handler🙂ok, method🙂select_ok))
@select_window.set_handler🙂cancel, method🙂select_cancel))
@chara_window = Window_CCCharacter.new(@actor.id, @input_window)
@face_window = Window_CCFace.new(@actor.id, @input_window)
@input_window.activate.select(0)
@select_window.hide
end

def gui_ok
val = @input_window.data
if val == :Name
SceneManager.call(Scene_Name)
SceneManager.scene.prepare(Composites.actor(@file).id, CP::COMPOSITE::CHARACTERS)
@input_window.refresh
elsif val == nil
return_scene
else
@select_window.show
end
end

def gui_cancel
@input_window.activate.select(@input_window.item_max - 1)
end

def select_ok
val = @input_window.data
adj = @input_window.adj_data
id = @select_window.index
if adj == :Gender
if id == 0
Composites.actor(@file).change_composite🙂Gender, true)
Composites.actor(@file).reset_name
elsif id == 1
Composites.actor(@file).change_composite🙂Gender, false)
Composites.actor(@file).reset_name
end
else
block = Composites.actor(@file).male? ? 0 : 1
handler = Composites.list_by_block(val, block)[@select_window.index]
hue = @select_window.hue
Composites.actor(@file).change_composite(adj, handler, hue)
end
@select_window.hide
@chara_window.refresh
@face_window.refresh
@input_window.activate.refresh
end

def select_cancel
@select_window.hide
@input_window.activate
end
end

class RPG::BaseItem
def composite_hash
add_composite_data if @composite_hash.nil?
return @composite_hash
end

def composite_init
add_composite_data if @composite_init.nil?
return @composite_init
end

def gender_base
add_composite_data if @gender_base.nil?
return @gender_base
end

def alt_name
add_composite_data if @alt_name.nil?
return @alt_name
end

INITI_RE = /(.+) init\[(.+)[,]\s*(\d+)\]/i
IMAGE_RE = /(.+) image\[(.+)[,]\s*(\d+)\]/i
GENDER_RE = /gender\[(male|female)\]/i
ALT_NAME = /alt name\[(.+)\]/i

def add_composite_data
@gender_base = CP::COMPOSITE::MALE_DEFAULT
@composite_hash = {}; @composite_init = {}; @alt_name = ""
self.note.split(/[\r\n]+/).each do |line|
case line
when INITI_RE
@composite_init[$1.to_sym] = [$2.to_s, $3.to_i]
@composite_init["#{$1.to_s}Rear".to_sym] = [$2.to_s, $3.to_i]
@composite_init["#{$1.to_s}Hueless".to_sym] = [$2.to_s, 0]
@composite_init["#{$1.to_s}All".to_sym] = [$2.to_s, $3.to_i]
when IMAGE_RE
@composite_hash[$1.to_sym] = [$2.to_s, $3.to_i]
@composite_hash["#{$1.to_s}Rear".to_sym] = [$2.to_s, $3.to_i]
@composite_hash["#{$1.to_s}Hueless".to_sym] = [$2.to_s, 0]
@composite_hash["#{$1.to_s}All".to_sym] = [$2.to_s, $3.to_i]
when GENDER_RE
@gender_base = true if $1.to_s.downcase == "male"
@gender_base = false if $1.to_s.downcase == "female"
when ALT_NAME
@alt_name = $1.to_s
end
end
end
end

###--------------------------------------------------------------------------###
# End of script. #
###--------------------------------------------------------------------------###






Error.png
can you resend the second demo because I can't open it
i know i'm late but how do I change the head all's skin color because I tried it with body base and it worked perfectly but how with head all

Composite Characters v2.1
​


Created by Neon Black
​



What is it?
This script has two functions. This script allows you to create heroes who use composite graphics and can have different graphics (both face and walking graphics) depending on the equipped items. This script also allows you to call in in-game character creation screen that will allow the player to change how the composite looks. This script is NOT user friendly, but it is about as easy as I can think to make it. It has a god awful amount of settings to configure and tweak to get the composites and the creation screen to work properly. If you want to use this script just for composite characters, it is a bit easier to set up and use. Feel free to ask for any help until I have some time to write up a more advanced user manual.

How can I use it?
I'm going to say there are 3 main functions. These are the initial composites, the equip item composites, and the creation screen.
Tags:


Hidden Content


Calls:


Hidden Content


Further Info:


Hidden Content



What does it look like?


Hidden Content



What does it work with?
This script will not work with scripts that modify a sprite's appearance or a face's appearance in game. There should be no reason why it should not work with scripts that just pick different "emotions" from a sprite sheet (provided you create a composite for a sprite sheet).


This script also modifies the "characters_for_savefile" method in order to properly display composites in the savefile and as such will not work with other scripts that modify this method.

How can I get the script?
Version 2.1 (base script, 2.12.2012) is available from my pastebin account here or my mediafire account here.

I would like to use this code.
[IMG]http://i.creativecommons.org/l/by-nc/3.0/80x15.png[/IMG]
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
Permissions beyond the scope of this license may be available at http://cphouseset.wo...d-terms-of-use/.

Author's Disclaimer:
Okay, so I know this script looks a bit scary at first, but trust me, it works well. I couldn't really find any other way to give it the customization that I wanted without it looking spooky. Like I mentioned, if you need any help with getting it to work, I can certainly help out. Also, there's a good number of files from the Ace character generator in the demo to help get you started. Check the demo out first if you're having a little trouble setting everything up. As always, enjoy!

You script was awesome.. but you script was make me confuse  
How do I add races and change the skin color of the player?
Hello, I love your script, but i would like to know hot to mkae it with the following scripts.


http://gamejolt.com/f/gamejolt-achievement-api-for-rpg-maker-vx-ace-beta/5070


https://falcaorgss.wordpress.com/2012/12/02/falcao-pearl-abs-liquid-v1/


The issue is right here:     Line 493, Code pasted bellow 


elsif @equip_hashes.include?(key) && Composites.include_block?(block,
       @equip_hashes[key][0])
      handler = @equip_hashes[key][0]


Please help!
Sorry for necroposting, but i really need help for this.


So, i was trying to make something simple with this script, but it seems i can't make it work.


I tought i was doing something wrong, so i downloaded the demo and literally copied and pasted everything needed (The stuff on the database included) on my project.


The demo works, but on my project i get this:


[IMG]http://puu.sh/r3bQC/db22888468.png[/IMG]


That lead to this:


[IMG]http://puu.sh/r3c72/ffe00e951a.png[/IMG]


So it means that the script can't find the game actor from a file name. The problem is that the file name and the game actors are exactly the same as the demo.


[IMG]http://puu.sh/r3cdz/58af030e86.png[/IMG]


Like i said, i copied the folders and modified the database exactly as the demo. Same for the script, i modified it before, but since i got that error i decided to copy and paste it again. Of course, i tried to move it above everything else, below the others script and in the middle of them (And below Materials - before main... but i don't think i had to say this).


Nothing, still get that error. Why it works on the demo and not on my game? The error make the game crash, can't even reach the logo.


It's like the script is saying: Ehy dude, you missed a game actor in the file name!


I'm pretty sure it's something stupid, because i always get stuck on the most easy problems. Any clue?


[IMG]http://puu.sh/r41Cv/e731a4306a.png[/IMG]


It may be one of those script, but i've already tried to remove almost all of them one by one to see if that was the problem, it's not.


As soon as i remove in the database the Graphics of the Names i used, the game start. Of course, with the script not working tho.
@Lelou Before you delve deeper into script compatibilities, make sure the error is not caused by something simpler:


1) did you start a new game after installing the script?


2) does your database has the actors that are required for this script?


Basically the error means that the engine didn't find the required data, and that could simply be because it does not exist in your game - so compare all configurations needed for this script.


And this isn't necroposting, because in the presentation type forums the topics are always open for questions on the presented script (or tutorial), necroposting is only considered at general discussions and ad specific problem topic and so on.
Spoiler
Ok, thanks a lot. Yeah, i literally copied and pasted everything from the working demo, the actors in the database too. I can't even do a New Game because that error makes the game crash before the Title Screen. So i tought it could be another script interfering with the Game_Actor page, but even after removing every script that use that page, the error is still up. 


The script should be really easy, i mean that part of it. You name an actor and name the images after it. The script itself can't find and actor that is there. I also tried to change and use one of mine instead of $Hero1 and 2.


[IMG]http://puu.sh/r4eQ3/81c9b0ab59.png[/IMG]


But nothing, still get that error.


[IMG]http://puu.sh/r4f2a/53cf91d73b.png[/IMG]


Graphic is shown like that because the scripts add an $ to a image file that actually doesn't require it to work in-game. This is from the demo:


[IMG]http://puu.sh/r4f7K/fd67d7c1b0.png[/IMG]


As you can see i set Alianna to 1, since she's the first Actor. I can also change the number and move her, same error. And of course, the images have the name set right.


[IMG]http://puu.sh/r4fo6/151f368853.png[/IMG]



BIG EDIT:


I've found the script that conflict with this one: Cache Back from KilloZapit.


To solve this problem, set as follow:


[IMG]http://puu.sh/r4g5D/b93f371fc9.png[/IMG]


In cache back. Thanks for the help anyways!
Can some one please help me im having an issue with line 493. I think the clashing script is the falcao pearl abs v3 
i'm sorry for coming back to this old topic but, it isn't working to me.


http://i97.servimg.com/u/f97/15/27/47/75/sem_ty10.png


The character image simply doesn't change, no matter what i equip
Is there a way to refresh the "equips" of the character?


I made an event on which the main character falls on a pit and lose the hat. The problem is that even if i use the command to remove an equip:


[IMG]http://puu.sh/rwuZg/da5df1e051.png[/IMG]


The graphic doesn't change until i actually open the menu and press optimize, clear or i click remove equipments. So i guess that those actions triggers the refresh, and even if i found it on the script, i don't know how to do it on an event. So the question is: How to refresh my equip on an event in a way that when i make a fadeout screen my hat disappear? With a script call?

Original thread: https://forums.rpgmakerweb.com/threads/composite-characters-in-game-character-creation.5775/