Composite Characters/Visual Equipment
Version: 1.2b
Author: modern algebra
Date: December 5, 2009
Version History
- <Version 1.2b> 12.05.2009 - Very small oversight fixed - if you have been experiencing lag with this script, it might be a good idea to get this new version. There is no functional difference however.
- <Version 1.2> 05.29.2009 - Number of Changes, including an easy wrapper for changing base graphics for actors, as well as a away to set priority for charsets, thus allowing for greater customizability
- <Version 1.0> 07.05.2008 - Original Release
Description
This script allows you to create character sets from multiple character sheets, layering them on top of each other. It also allows you to set character graphics to armors and weapons, and these character sets will be layered on top of the character, thus making it a Visual Equipment script as well.
Features
- Easy configuration
- Hundreds of unique characters can be made from a limited set of resources.
- Allows you to set hue for character sheets, meaning each resource can have hundreds of distinct colours.
- Allows any weapon or armor to have any number of character sets stacked onto the character upon equip.
- Events and Actors can also be set up so that they are composed of multiple character sets
- Can set a priority for graphics, thus allowing you to determine what graphics should be drawn first
- Can change base graphics for the actor with script calls
Screenshots
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg57.imageshack.us%2Fimg57%2F1630%2Fcompositecharacters1ig5.png&hash=7686fe4570c1bfb5a3d8c9f3dc625cb07d0d8de7)
All character sets seen composed of this one character sheet, with all resources taken from the character generator here: http://www.famitsu.com/freegame/tool/chibi/index1.html
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg372.imageshack.us%2Fimg372%2F9513%2Fvisequipsamplekk8.png&hash=8b1de209b4c34da2ad2eb57e3ac7d82a606c61ef)
For more rips from that site, please see: http://rmrk.net/index.php/topic,31574.0.html
Instructions
Please see inside script for detailed instructions.
Script
#==============================================================================
# Composite Characters / Visual Equipment
# Version 1.2b
# Author: modern algebra (rmrk.net)
# Date: December 5, 2009
# Original Release Date: July 5, 2008
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script in between Materials and Main in the Script Editor
#
# Basically, to work this script you need to do two things. 1) Setup your
# actors default character sets - you will see a full set of instructions at
# line xx. Now, to set a graphic for an armor or weapon, all you need to do
# is place this code in the Notes box of the item:
#
# \CG[<Name of Character Set>, <index in character set>, <hue>, <z>]
#
# If you leave out index, it defaults to 0 and if you leave out hue, it also
# defaults to 0. You can put more than one graphic to an armor or weapon and
# they will stack by priority (z). Things with lower priority are drawn first.
#
# Setting up an Event is similar - all you need to do is place a comment at
# the very beginning of the event and put in the same code to generate a
# composite character set for the event. Same rules apply, and remember, you
# can stack character sets.
#
# EXAMPLES:
# \cg[Actor1, 2] # Character Set = Actor1 : index = 2 : hue = 0 : z = 0
# \CG[Evil] # Character Set = Evil : index = 0 : hue = 0 : z = 0
# \cG[Actor2, 3, 50, 2] # Character Set = Actor2 : index = 3 : hue = 50 : z = 2
#
# You can now remove and add graphics to the actor using the following codes
# in a script call:
#
# remove_graphic_from_actor (actor_id, index)
# remove_graphic_from_actor (actor_id, graphic_name, graphic_index, graphic_hue)
# add_graphic_to_actor (actor_id, graphic_name, graphic_index, graphic_hue, index)
#
# where:
# actor_id : the ID of the actor whose graphic you are changing
# index : the index of the graphic in the actor's composite_character
# graphic_name : the name of the character set
# graphic_index : the index of the character file in the set
# graphic_hue : the hue of the graphic
#
# Also, the Change Actor Graphic event command now adds character sets to
# the current set. You can clear an actor's character set with the code:
#
# clear_character_graphic (actor_id)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Compatibility:
#
# Unfortunately, I did need to overwrite some methods for this script, and
# as such there are likely to be compatibility problems. I know that my
# Extra Movement Frames Script certainly will not work with this script, and
# any script that tampers with the way a character set is drawn will also
# likely encounter problems. Now, this is not to say that any script that
# draws a character set will be incompatible - as long as that scripter uses
# the draw_actor_graphic method of Window_Base it should work fine - it is
# only scripts that change the way a character set is drawn that will cause
# problems. Also, I tamper with the load_gamedata method of Window_SaveFile,
# and so if another script overwrites that then there will again be
# compatibility issues. If you find a script that seems to cause problems,
# please post at the topic at rmrk.net and I will try my best to assist you.
#
# Diedrupo's Caterpillar Script does not work immediately. A fix is posted
# in this script's topic at rmrk.net.
# Tankentai Sideview Battle System will not use composite character sprites
# without a fix. That fix is also posted in this script's topic at rmrk.net
#==============================================================================
#==============================================================================
# *** module Cache
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - composite_character
#==============================================================================
module Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Composite Character
# char_array : An array holding the names of all parts of a graphic
#``````````````````````````````````````````````````````````````````````````
# Composes a single character bitmap out of all the ones given.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.composite_character (char_array)
@cache = {} if @cache == nil
# Blank bitmap if there is nothing in the array.
@cache[char_array] = Bitmap.new (32, 32) if char_array.empty?
# If not in the cache
if !@cache.include? (char_array) || @cache[char_array].disposed?
# Create a template bitmap
bitmap = Bitmap.new (32, 32)
# Add in all other graphics
char_array.each { |i|
name, index, hue = i[0], i[1], i[2]
# Bypass self.character in order to allow for setting hue
bmp = load_bitmap ("Graphics/Characters/", name, hue)
sign = name[/^[\!\$]./]
# Get the width and height of the single character
if sign != nil && sign.include? ('$')
wdth, hght = bmp.width, bmp.height
else
wdth = bmp.width / 4
hght = bmp.height / 2
end
# Expand bitmap if necessary
if bitmap.width < wdth || bitmap.height < hght
# Recreate bitmap
temp_bmp = bitmap.dup
bitmap = Bitmap.new ([temp_bmp.width, wdth].max, [temp_bmp.height, hght].max)
bitmap.blt (0, 0, temp_bmp, temp_bmp.rect)
temp_bmp.dispose
end
# Draw new character graphic onto bitmap
src_rect = Rect.new ((index%4)*wdth, (index/4)*hght, wdth, hght)
bitmap.blt (0, 0, bmp, src_rect)
}
@cache[char_array] = bitmap
end
return @cache[char_array]
end
end
#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - character_graphics
#==============================================================================
class RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Character Graphics
#``````````````````````````````````````````````````````````````````````````
# Retrieves Character Graphics from Note Field
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def character_graphics
graphics = []
# Retrieve Note Field
text = self.note.dup
while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
a = [$1.to_s, ($2 != nil ? $2.to_i : 0), ($3 != nil ? $3.to_i : 0), ($4 != nil ? $4.to_i : 0)]
graphics.push (a)
end
return graphics
end
end
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new methods - composite_character, clear_character
# aliased methods - initialize, change_equip, set_graphic
# new public instance variables - ma_composite_character, ma_return_composite
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :ma_composite_character
attr_accessor :ma_return_composite
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initalization
#`````````````````````````````````````````````````````````````````````````
# Initializes stacked_character variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_arclght_vsual_equip_init_4t6h initialize
def initialize (id)
# Run Original Method
modalg_arclght_vsual_equip_init_4t6h (id)
@ma_composite_character = []
@ma_return_composite = false
case @actor_id
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# EDITABLE REGION
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# An actor will automatically have whatever you set in the database
# as a bottom layer for him, but if you need to have other character
# sets piled on top, then put them in this format:
#
# when <actor_id>
# @ma_composite_character.push (['graphic_name', index, hue, z])
# *for as many graphics as you want - first ones drawn first. If you
# want to know what each is, see the Instructions in the header.
# The z value allows you to set priority. So, something with -1
# z will be drawn below anything with a greater z value
#/////////////////////////////////////////////////////////////////////
when 1 # 1st Actor
# Create Hair Sprite
@ma_composite_character.push (['VisEquipSample', 1, 100])
when 3 # 3rd Actor
# Create skin sprite with different hue
@ma_composite_character.push (['VisEquipSample', 0, 20])
# Create Hair Sprites
@ma_composite_character.push (['VisEquipSample', 2, 75])
@ma_composite_character.push (['VisEquipSample', 3, 75])
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# END EDITABLE REGION
#/////////////////////////////////////////////////////////////////////
end
@ma_composite_character.each { |i|
i[1] = 0 if i[1] == nil
i[2] = 0 if i[2] == nil
i[3] = 0 if i[3] == nil
}
@ma_composite_character.unshift ([@character_name, @character_index, 0, -1]) if @character_name != ''
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Composite Character
#``````````````````````````````````````````````````````````````````````````
# Returns Graphic Array for the actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def composite_character
armor_graphics = []
weapon_graphics = []
# Body Armor, then Helmet, then Shield, then all others
dup_armors = armors.dup
for i in 0...2
j = 2 - i
armor_graphics += dup_armors[j].character_graphics if dup_armors[j] != nil
dup_armors.delete_at (j)
end
# If there is some multi-equip script, will get accessories and rest in order
dup_armors.each { |armr| armor_graphics += armr.character_graphics if armr != nil }
weapons.each { |wpn| weapon_graphics += wpn.character_graphics if wpn != nil }
cg = @ma_composite_character + armor_graphics + weapon_graphics
cg.sort! { |a, b| a[3] <=> b[3] }
return cg
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Graphics
# character_name : new character graphic filename
# character_index : new character graphic index
# face_name : new face graphic filename
# face_index : new face graphic index
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_cgve_st_grphic_evnt_6ht3 set_graphic
def set_graphic(character_name, character_index, face_name, face_index)
old_char_name, old_char_index = @character_name, @character_index
# Run Original Method
ma_cgve_st_grphic_evnt_6ht3 (character_name, character_index, face_name, face_index)
# Find old character name
count = 0
@ma_composite_character.each { |char|
count += 1
break if char[0] == old_char_name && char[1] == old_char_index
}
# Put in new character directly after old one
@ma_composite_character.insert (count, [@character_name, @character_index, 0, -1])
$game_player.refresh
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear Graphic
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear_graphic
@ma_composite_character.clear
@ma_composite_character.push ([@character_name, @character_index, 0, -1])
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Character Name
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modrnalgbra_comp_char_retrn_charctrnm_6gd4 character_name
def character_name
# If asking for composite character, return it instead
if @ma_return_composite
@ma_return_composite = false
return self.composite_character
end
return modrnalgbra_comp_char_retrn_charctrnm_6gd4
end
end
#==============================================================================
# ** Game_Character
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new instance variable - composite_character
#==============================================================================
class Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :composite_character
end
#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - setup
#==============================================================================
class Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Event page setup
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malgbr_rclgh_req_comp_char_setup_5msk setup
def setup(new_page)
malgbr_rclgh_req_comp_char_setup_5msk (new_page)
# Create Composite Character
@composite_character = []
@composite_character.push ([@character_name, @character_index, 0, -1]) unless @character_name.nil?
# If page == nil, return
return if @page == nil
# Retrieve first line comments
comments = []
@page.list.each { |i| i.code == 108 || i.code == 408 ? comments.push (i) : break }
# Evaluate comments for \CG codes
comments.each { |i|
text = i.parameters[0].dup
while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
a = [$1.to_s, ($2 != nil ? $2.to_i : 0), ($3 != nil ? $3.to_i : 0), ($4 != nil ? $4.to_i : 0)]
@composite_character.push (a)
end
}
# Sort Composite Characters by z value.
@composite_character.sort! { |a, b| a[3] <=> b[3] }
end
end
#==============================================================================
# ** Game_Player
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - refresh
#==============================================================================
class Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdalg_arc_comp_character_find_rfrsh_8kwi refresh
def refresh
mdalg_arc_comp_character_find_rfrsh_8kwi
return if $game_party.members.empty?
@composite_character = $game_party.members[0].composite_character
end
end
#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - clear_character_graphic
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear Character Graphic
# actor_id : the ID of the actor to be cleared
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear_character_graphic (actor_id)
$game_actors[actor_id].clear_graphic
$game_player.refresh
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Graphic From Character
# actor_id : the ID of the actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def remove_graphic_from_actor (actor_id, *args)
actor = $game_actors[actor_id]
if args[0].is_a? (Integer)
index = args[0]
else
index = 0
# Find index of the specified character set
for composite in actor.ma_composite_character
if (args[0] != nil || args[0] == composite[0]) &&
(args[1] != nil || args[1] == composite[1]) &&
(args[2] != nil || args[2] == composite[2])
break
end
index += 1
end
end
# Delete graphic from array
actor.ma_composite_character.delete_at (index)
$game_player.refresh
return index
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add Graphic To Character
# actor_id : the ID of the actor
# char_name, char_index, char_hue : character graphic specifications
# index : where to insert the new graphic
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def add_graphic_to_actor (actor_id, char_name, char_index = 0, char_hue = 0, z = 0, index = nil)
actor = $game_actors[actor_id]
index = actor.ma_composite_character.size if index.nil?
actor.ma_composite_character.insert (index, [char_name, char_index, char_hue, z])
$game_player.refresh
end
end
#==============================================================================
# ** Sprite_Character
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - update_bitmap
#==============================================================================
class Sprite_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Transfer Origin Bitmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modern_alg_arclightrequest_visual_equip_bmp_update update_bitmap
def update_bitmap
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index ||
@composite_character != @character.composite_character
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
@composite_character = @character.composite_character
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
if @composite_character == nil
# Regular Character Picture
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
else
self.bitmap = Cache.composite_character(@composite_character)
@cw = self.bitmap.width / 3
@ch = self.bitmap.height / 4
end
self.ox = @cw / 2
self.oy = @ch
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Transfer Origin Rectangle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_src_rect
if @tile_id == 0
index = 0
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# overwritten method - draw_character_graphic
#==============================================================================
class Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Actor Walking Graphic
# actor : actor or comp character array
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_actor_graphic(actor, x, y)
composite_character = actor.is_a? (Array) ? actor : actor.composite_character
bitmap = Cache.composite_character (composite_character)
cw = bitmap.width / 3
ch = bitmap.height / 4
rect = Rect.new (cw, 0, cw, ch)
self.contents.blt (x - (cw / 2), y - ch, bitmap, rect)
end
end
#==============================================================================
# ** Window_SaveFile
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# overwritten_methods - draw_party_characters
#==============================================================================
class Window_SaveFile < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Party Characters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_party_characters(x, y)
for i in 0...@characters.size
draw_actor_graphic (@characters[i][0], x + i * 48, y)
end
end
end
#==============================================================================
# ** Scene_File
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - write_save_data
#==============================================================================
class Scene_File
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Write Save Data
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modrnbra_wrt_svdata_comp_chactes_63gb5 write_save_data
def write_save_data (*args)
# Set it to return composite characters
$game_party.members.each { |actor| actor.ma_return_composite = true }
# Run Original Method
modrnbra_wrt_svdata_comp_chactes_63gb5 (*args)
end
end
#==============================================================================
# ** Scene_Equip (For compatibility with KGC
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - terminate
#==============================================================================
class Scene_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Terminate
# updates game_player equipment
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_trmnte_cg_equipment_k8g9c terminate
def terminate
# RUn Original Method
modalg_trmnte_cg_equipment_k8g9c
$game_player.refresh
end
end
Addons
[spoiler=Set Event Graphic to an Actor]
This is a simple little edit that allows you to change an event's graphic to that of an actor with a script call.
#==============================================================================
# Set Event to Actor Graphic
# Addon for Composite Character Sets / Visual Equipment
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: June 1, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
# Paste this into its own slot in the Script Editor, below Materials but
# somewhere above Main
#
# To set an event to actor graphic, use this code in a Script call (third
# tab of event commands)
# $game_map.events[event_id].set_to_actor (actor_id)
# event_id : the ID of the event whose graphic you are changing
# actor_id : the ID of the actor whose graphic you want the event to
# have.
#
# Remember, the event will retain whatever event settings it had originally,
# including original pose, so if you want the event to be standing still
# instead of with one leg out, you have to set it up with some graphic prior
# to changing it by script and choose the pose you want the actor graphic to
# be in.
#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - set_to_actor
#==============================================================================
class Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set to Actor Graphic
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def set_to_actor (id)
@composite_character = $game_actors[id].composite_character.dup
end
end
[/spoiler]
Credit
Thanks
- arclight, for the request
Support
Please post in this topic at rmrk for fastest support.
Known Compatibility Issues
Any scripts that play around with the way character sets are drawn will undoubtedly have some problems with this script. If you encounter any problems, please post the error and the script that is causing the problem and I will see if I can make them compatible.
Does not work with Dash Animation
Does not work with Extra Movement Frames
It ought to work with KGC Equip Extension
[spoiler=Composite Characters + Grid Inventory Compatibility Patch]
Equipment does not refresh upon exiting the Inventory, so this patch fixes that. Place it in its own section below the Grid Inventory script, but still above Main.
#==============================================================================
# Composite Characters + Grid Inventory Compatibility Patch
# Author: modern algebra
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
# Place this in its own slot beneath the Grid Inventory script
#==============================================================================
# ** Scene GridInventory
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - return_scene
#==============================================================================
class Scene_GridInventory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Return Scene
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias monalg_compchar_gridinry_ptch_rtrnscn_2jj3 return_scene
def return_scene (*args)
# Run Original Method
monalg_compchar_gridinry_ptch_rtrnscn_2jj3 (*args)
$game_player.refresh
end
end
[/spoiler]
Does not work with Diedrupo's Caterpillar script, but the fix is easy:
[spoiler=Fix]
Go into the Caterpillar script and you will see the following code around line 88:
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@character_name = $game_actors[@actor].character_name
@character_index = $game_actors[@actor].character_index
else
@character_name = ""
@character_index = 0
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end
replace it with:
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@composite_character = $game_actors[@actor].composite_character
else
@character_name = ""
@character_index = 0
@composite_character = nil
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end
[/spoiler]
It does not work with Tankentai Sideview Battle System. Please see this post (http://rmrk.net/index.php/topic,28124.msg403285.html#msg403285) for a compatibility fix for Version 3.3a. It will not work with animated battlers, but should draw regular sprites accurately if you are using them in battle.
In Shopoholic, it will not draw the composite character in Window_Shop_Details.
[spoiler=Fix]
At line 210 in Window_Shop_Details, replace:
bitmap = Cache.character(actor.character_name)with
bitmap = Cache.composite_character(actor.composite_character)[/spoiler]
Demo
See Attached for a technical demo. There is not much to it - it is solely so that you can look through and see how events, items, etc are set up.
Thank you so much for the script. You're Awesome!!! With that done i'll begin making charsets for people to use. If i have another idea for enhancing VX i'll be sure you make a request via this site. :D Also... your script is doubly appreciated with me because i'm pondering the idea of learning RGSS2 scripting... (my native language is C++)... looking forward to examining the code.
Ingenious idea!
With this, a lot work can be saved indefinitely.
This opens a lot of new opportunities!
Great script MA, I love you. ;8
I am happy to have fulfilled the request. It was a fun request to take and I'm glad you liked it.
Thanks Leventhan.
This Script is amazing, I spent approximately 50 hours creating an event system to do something similar. I do have a question though. I am currently trying to make a character generator using this script, is there any way to have the hue and index areas in @composite_character.push (['graphic_name', index, hue] reference a variable in RMVX instead of a constant. (i.e. @composite_character.push (['graphic_name', variable 0001, variable 0002]) I am fairly new to scripting and am not sure how this process works. Any help would be GREATLY appreciated :)
No, I actually do not have that type of feature installed :'(
Sorry. I could add it though.
That would be amazing, if its not too much work. I tried to do it, but since I know nothing about scripting it didn't work too well.
Sooo... how exactly do you rip the sprites from that website?
Great script, BTW
Well, it's not particularly easy, but there are a few ways. As far as I know, they don't have a download pack or anything like that. You just have to find the hosted images and save them. So, look at the page info media and you should find what you're looking for.
Ok, I've got the sprites.
P.S.: I found out how to do it ^_^
(http://www.famitsu.com/freegame/tool/chibi/image/ym/body/1_red.png) ect.
But another question... (sorry XD)
I have armour, and it's graphics are for Males.
I want this armour to be only usable by males because the clothing looks pretty messed up on a girl sprite :-\
Do you know any way to achieve this?
Sure, just make it so that you have separate classes for each character, and two of each armour entry as well and make it so that only the male characters have the class that can wear male armour.
So, if you have a Paladin class that both a man and woman can have, then make two Paladin classes in the Database - one who wears male armour and one who wears female armour.
This is great!
I´m testing it out right now and have a question. Is this compatible with Equip Extension by KGC?
Because when I try it out it doesn´t work, but when I remove the KGC script it works fine.
The problem is that with the Equip Extension it gives no error, the visual equipment just isn´t ... well, visual.
Composite_Character works, though.
It would be so nice if theese two scripts would work together!
Good job!
KGC_EquipExtension:
[spoiler]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ? Skill CP System - KGC_SkillCPSystem ? VX ?
#_/ ? Last Update: 2008/09/06 ?
#_/ ? Translated and Extended Updates by Mr. Anonymous ?
#_/ ? KGC Site: ?
#_/ ? http://f44.aaa.livedoor.jp/~ytomy/ ?
#_/ ? Translator's Blog: ?
#_/ ? http://mraprojects.wordpress.com ?
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ This script has two functions equipment-related functions.
#_/ The first function is the ability to create moire 'slots' for equipment,
#_/ such as separating Boots and Gauntlets from mere 'accessories'.
#_/ It is possible to also create additional equipment slots. See the customize
#_/ block for more details.
#_/
#_/ The second function is an "EP" (Equipment Point) System, which allows you
#_/ to designate how many 'points' an item costs to successfully equip. A
#_/ character's total EP expenditure is increased upon leveling up.
#_/ This introduces more strategy-oriented character customization.
#_/----------------------------------------------------------------------------
#_/ ? Instructions For Usage ?
#_/ To make use of these functions, you must insert the tag into the desired
#_/ item's "Notes" box located in the Armor tab of the database. For example,
#_/ you want the Leather Boots to be bound to the "Legs" slot and cost
#_/ 2 EP to equip. Insert <equipkind Legs>, press enter, then add <EP 2>
#_/
#_/ ? Tags ?
#_/ <equipkind EquipType>
#_/ Where EquipType = The name of the type of equipment. See EXTRA_EQUIP_KIND
#_/ below.
#_/ <EP Amount>
#_/ Where Amount = The desired amount of EP the item requires to equip.
#_/
#_/
#_/ ? Script Commands ?
#_/ These commands are used in "Script" function in the third page of event
#_/ commands under "Advanced".
#_/
#_/ * set_actor_equip_type(ActorID, [EquipType])
#_/ Allows you to manually specify an actor's equipment slots. a
#_/ Ex. set_actor_equip_type(2, [0, 2, 3, 3, 3])
#_/ If "nil"(without quotations) is appointed to EquipType, the default
#_/ EQUIP_TYPE (see below) is used. Trust me, it's useful!
#_/
#_/ * change_actor_equipment(ActorID, equipslot_index, ItemID)
#_/ Allows you to change the equipment of a specified actor.
#_/ equipslot_index works by finding the equipment slot number, which is
#_/ different from EQUIP_TYPE. Setting ItemID to 0 will remove the item.
#_/ With the default setup, we see:
#_/ 0=Weapon 1=Shield 2=Headgear 3=Armor 4=Accessory 5=Legs 6=Arms
#_/
#_/ So, for an example:
#_/ change_actor_equipment(1, 3, 15)
#_/ Would change Ralph's(Actor01 in the database) armor to Chainmail(By default)
#_/
#_/
#_/============================================================================
#_/ Installation: This script must be inserted below KCG_ExtendedEquipScene
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#=============================================================================#
# ? Customization ? #
#=============================================================================#
module KGC
module EquipExtension
# ? Extended Equipment Classification Names ?
# You may designate the names of additional equipment slots here.
# Each time you designate a new equipment slot, it is assigned a number.
# The first four equipment types (Shield, Helmet, Armor, and Accessory) are
# given as 1, 2, 3, 4, respectively. Then the values below are assigned in
# order. By default "Legs" and "Arms" would be 4 and 5. It is possible
# to add additional slots.
# Example: EXTRA_EQUIP_KIND = ["Legs", "Arms", "Skill Book"]
EXTRA_EQUIP_KIND = ["Armar", "Ben", "Hals", "Finger", "Rygg", "Midja"]
# ? Equipment Placement ?
# This allows you to arrange the equip slots as you see fit on the equipment
# menu. Note the order listed below.
# ** Equipment Classification Summary **
# 0.Shield 1.Headgear 2.Armor 3.Accessory 4. "Legs" 5."Arms"
# Note that these can be changed as desired. By default, we've enabled two
# accessory slots at the end, instead of one. If you plan on adding extra
# equip slots, the category's cooresponding number must be inserted in the
# brackets [] below.
EQUIP_TYPE = [0, 1, 2, 4, 5, 6, 9, 8, 7, 7, 3]
# ? EP (Equip Point) System ?
# These settings are for the Equipment Point Limit System.
# This toggle allows you to use the EP system if set to true.
# If set to false, the EP system will be disabled.
USE_EP_SYSTEM = false
# VOCAB_EP appears once a character gains EP from battle. (Not Tested)
VOCAB_EP = "EP"
# VOCAB_EP_A appears above the EP gauge.
VOCAB_EP_A = "EP"
# This toggle allows you to display the EP gauge in the actor status window.
SHOW_STATUS_EP = false
# ? Default EP Cost ?
# Allows you to change the default amount an item costs to equip in EP.
# (When not otherwise specified.)
DEFAULT_EP_COST = 1
# This toggle allows you to hide the EP cost of an item if its cost is 0.
# true = hide
# false = show
HIDE_ZERO_EP_COST = true
# ? EP Values & Level Gain ?
# Maximum EP that can be spent equipping items.
EP_MAX = 20
# Characters begin with this amount of EP.
EP_MIN = 5
# ? EP Level Gain
# This is the formula for the amount of EP gained upon leveling up.
# The result of this formula is automatically converted to an integer.
EP_CALC_EXP = "level * 0.3 + 4"
# ? Individual Actor EP Level Gain
PERSONAL_EP_CALC_EXP = [] # <- Do not alter or remove!
# Below here, you may specify formulas for individual actors that dictates
# the amount of EP they recieve upon leveling up. Like EP_CALC_EXP, the
# result is converted to an integer.
# Format: PERSONAL_EP_CALC_EXP[ActorID] = "Formula"
# The format is just like EP_CALC_EXP, except each actor is defined after
# PERSONAL_EP_CALC_EXP in brackets [].
# Any actor not specified uses the EP_CALC_EXP formula.
# Example:
# PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
# ? Insert Personal EP Calculations Below Here ?
PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
# ? Insert Personal EP Calculations Above Here ?
# ? EP Gauge Colorization ?
# Allows you to change the color of the EP gauges.
# The color can also be determined by a red, green, and blue values.
# Example: GAUGE_NORMAL_START_COLOR = Color.new(255, 0, 0) <- This is red.
# This method of color assignment is much like Tint Screen event command.
#
# This affects the color of number that represents EP cost.
EP_COST_COLOR = 23
# This is the fill color for the early phase of the guage.
EP_GAUGE_START_COLOR = 28
# This is the fill color for the late phase of the guage. (When full)
EP_GAUGE_END_COLOR = 29
end
end
#=============================================================================#
# ? End Customization ? #
#=============================================================================#
#=================================================#
# IMPORT #
#=================================================#
$imported = {} if $imported == nil
$imported["EquipExtension"] = true
#=================================================#
module KGC::EquipExtension
# Unless the EP system is used...
unless USE_EP_SYSTEM
SHOW_STATUS_EP = false
HIDE_ZERO_EP_COST = true
end
#==============================================================================
# ? KGC::EquipExtension::Regexp
#==============================================================================
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Note Field Tag Strings #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the "Note" section of
# an item or armor.
# Regular expressions defined
module Regexp
# Base Item Module
module BaseItem
# EP Tag String
EP_COST = /<EP\s*(\d+)>/i
# Item Type Tag String
# Special note: I cannot get this tag to work right. If anyone knows how
# this works or if it's bugged, please let me know.
EQUIP_TYPE = /<(?:EQUIP_TYPE|equiptype)\s*(\d+(?:\s*,\s*\d+)*)>/
end
# Base Armor Module
module Armor
# Armor Type Tag String
EQUIP_KIND = /<(?:EQUIP_KIND|equipkind)\s*(.+)>/i
end
end
end
#=================================================#
#==============================================================================
# ? KGC::Commands
#==============================================================================
module KGC
module Commands
module_function
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def restore_equip
(1...$data_actors.size).each { |i|
actor = $game_actors
actor.restore_equip
}
end
#--------------------------------------------------------------------------
# ? ?????????????
# actor_id : ???? ID
# equip_type : ?????
#--------------------------------------------------------------------------
def set_actor_equip_type(actor_id, equip_type = nil)
actor = $game_actors[actor_id]
return if actor == nil
actor.equip_type = equip_type
end
#--------------------------------------------------------------------------
# ? ??????????
# actor_id : ???? ID
# index : ???? (0?)
# item_id : ?? or ?? ID (0 ???)
#--------------------------------------------------------------------------
def change_actor_equipment(actor_id, index, item_id)
actor = $game_actors[actor_id]
return if actor == nil
actor.change_equip_by_id(index, item_id)
end
end
end
class Game_Interpreter
include KGC::Commands
end
#=================================================#
#==============================================================================
# ? Vocab
#==============================================================================
module Vocab
# EP
def self.ep
return KGC::EquipExtension::VOCAB_EP
end
# EP (?)
def self.ep_a
return KGC::EquipExtension::VOCAB_EP_A
end
# ?????
def self.extra_armor(index)
return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
end
end
#=================================================#
#==============================================================================
# ? RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def create_equip_extension_cache
@__ep_cost = KGC::EquipExtension::DEFAULT_EP_COST
@__equip_type = []
self.note.split(/[\r\n]+/).each { |line|
case line
when KGC::EquipExtension::Regexp::BaseItem::EP_COST
# ?? EP
@__ep_cost = $1.to_i
when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
# ?????
@__equip_type = []
$1.scan(/\d+/) { |num|
@__equip_type << num.to_i
}
end
}
# EP ???????????? EP = 0
@__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
end
#--------------------------------------------------------------------------
# ? ?? EP
#--------------------------------------------------------------------------
def ep_cost
create_equip_extension_cache if @__ep_cost == nil
return @__ep_cost
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def equip_type
create_equip_extension_cache if @__equip_type == nil
return @__equip_type
end
end
#=================================================#
#==============================================================================
# ? RPG::Armor
#==============================================================================
class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def create_equip_extension_cache
super
@__kind = -1
self.note.split(/[\r\n]+/).each { |line|
if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
# ????
e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
next if e_index == nil
@__kind = e_index + 4
end
}
end
unless $@
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
alias kind_KGC_EquipExtension kind
def kind
create_equip_extension_cache if @__kind == nil
return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
end
end
end
#=================================================#
#==============================================================================
# ? Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_writer :equip_type # ?????
#--------------------------------------------------------------------------
# ? ??????
# actor_id : ???? ID
#--------------------------------------------------------------------------
alias setup_KGC_EquipExtension setup
def setup(actor_id)
actor = $data_actors[actor_id]
@extra_armor_id = []
setup_KGC_EquipExtension(actor_id)
restore_equip
end
#--------------------------------------------------------------------------
# ? MaxEP ??
#--------------------------------------------------------------------------
def maxep
calc_exp = KGC::EquipExtension::PERSONAL_EP_CALC_EXP[self.id]
if calc_exp == nil
calc_exp = KGC::EquipExtension::EP_CALC_EXP
end
n = Integer(eval(calc_exp))
return [[n, ep_limit].min, KGC::EquipExtension::EP_MIN].max
end
#--------------------------------------------------------------------------
# ? EP ??
#--------------------------------------------------------------------------
def ep
n = 0
equips.compact.each { |item| n += item.ep_cost }
return [maxep - n, 0].max
end
#--------------------------------------------------------------------------
# ? EP ????
#--------------------------------------------------------------------------
def ep_limit
return KGC::EquipExtension::EP_MAX
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def equip_type
if @equip_type.is_a?(Array)
return @equip_type
else
return KGC::EquipExtension::EQUIP_TYPE
end
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def armor_number
return equip_type.size
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def extra_armor_number
return [armor_number - 4, 0].max
end
#--------------------------------------------------------------------------
# ? ?? ID ??????
#--------------------------------------------------------------------------
def extra_armor_id
@extra_armor_id = [] if @extra_armor_id == nil
return @extra_armor_id
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias armors_KGC_EquipExtension armors
def armors
result = armors_KGC_EquipExtension
# ???????????
extra_armor_number.times { |i|
armor_id = extra_armor_id
result << (armor_id == nil ? nil : $data_armors[armor_id])
}
return result
end
#--------------------------------------------------------------------------
# ? ????? (?????????)
# equip_type : ????
# item : ?? or ?? (nil ??????)
# test : ?????? (???????????????????)
#--------------------------------------------------------------------------
alias change_equip_KGC_EquipExtension change_equip
def change_equip(equip_type, item, test = false)
change_equip_KGC_EquipExtension(equip_type, item, test)
# ????????????
if extra_armor_number > 0
item_id = item == nil ? 0 : item.id
case equip_type
when 5..armor_number # ?????
@extra_armor_id = [] if @extra_armor_id == nil
@extra_armor_id[equip_type - 5] = item_id
end
end
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassivSkill"]
end
#--------------------------------------------------------------------------
# ? ?????
# item : ?????? or ??
# ??????????????????????????
#--------------------------------------------------------------------------
alias discard_equip_KGC_EquipExtension discard_equip
def discard_equip(item)
last_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
discard_equip_KGC_EquipExtension(item)
curr_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
return unless item.is_a?(RPG::Armor) # ?????
return if last_armors != curr_armors # ???????
# ????????
extra_armor_number.times { |i|
if extra_armor_id == item.id
@extra_armor_id = 0
break
end
}
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassiveSkill"]
end
#--------------------------------------------------------------------------
# ? ?? ID ???
# class_id : ????? ID
#--------------------------------------------------------------------------
alias class_id_equal_KGC_EquipExtension class_id=
def class_id=(class_id)
class_id_equal_KGC_EquipExtension(class_id)
return if extra_armor_number == 0 # ????????
# ?????????????
for i in 5..armor_number
change_equip(i, nil) unless equippable?(equips)
end
end
#--------------------------------------------------------------------------
# ? EP ???????
# equip_type : ????
# item : ?? or ??
#--------------------------------------------------------------------------
def ep_condition_clear?(equip_type, item)
return true if item == nil # nil ?????? OK
curr_item = equips[equip_type]
offset = (curr_item != nil ? curr_item.ep_cost : 0)
return false if self.ep < (item.ep_cost - offset) # EP ??
return true
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def restore_equip
return if @__last_equip_type == equip_type
# ???????????????
last_equips = equips
last_hp = self.hp
last_mp = self.mp
if $imported["SkillCPSystem"]
last_battle_skill_ids = battle_skill_ids.clone
end
# ?????
last_equips.each_index { |i| change_equip(i, nil) }
# ????????????
last_equips.compact.each { |item| equip_legal_slot(item) }
self.hp = last_hp
self.mp = last_mp
if $imported["SkillCPSystem"]
last_battle_skill_ids.each_with_index { |s, i| set_battle_skill(i, s) }
end
@__last_equip_type = equip_type.clone
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ? ?????????????
# item : ?? or ??
#--------------------------------------------------------------------------
def equip_legal_slot(item)
if item.is_a?(RPG::Weapon)
if @weapon_id == 0
# ?? 1
change_equip(0, item)
elsif two_swords_style && @armor1_id == 0
# ?? 2 (??????)
change_equip(1, item)
end
elsif item.is_a?(RPG::Armor)
if !two_swords_style && item.kind == equip_type[0] && @armor1_id == 0
# ????? (????????)
change_equip(1, item)
else
# ??????????
list = [-1, @armor2_id, @armor3_id, @armor4_id]
list += extra_armor_id
# ?????????????????
equip_type.each_with_index { |kind, i|
if kind == item.kind && list == 0
change_equip(i + 1, item)
break
end
}
end
end
end
end
#=================================================#
#==============================================================================
# ? Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ? EP ???????
# actor : ????
#--------------------------------------------------------------------------
def ep_color(actor)
return knockout_color if actor.maxep > 0 && actor.ep == 0
return normal_color
end
#--------------------------------------------------------------------------
# ? EP ????? 1 ???
#--------------------------------------------------------------------------
def ep_gauge_color1
color = KGC::EquipExtension::EP_GAUGE_START_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ? EP ????? 2 ???
#--------------------------------------------------------------------------
def ep_gauge_color2
color = KGC::EquipExtension::EP_GAUGE_END_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ? EP ???
# actor : ????
# x : ??? X ??
# y : ??? Y ??
# width : ?
#--------------------------------------------------------------------------
def draw_actor_ep(actor, x, y, width = 120)
draw_actor_ep_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::ep_a)
self.contents.font.color = ep_color(actor)
xr = x + width
if width < 120
self.contents.draw_text(xr - 40, y, 40, WLH, actor.ep, 2)
else
self.contents.draw_text(xr - 90, y, 40, WLH, actor.ep, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxep, 2)
end
self.contents.font.color = normal_color
end
#--------------------------------------------------------------------------
# ? EP ??????
# actor : ????
# x : ??? X ??
# y : ??? Y ??
# width : ?
#--------------------------------------------------------------------------
def draw_actor_ep_gauge(actor, x, y, width = 120)
gw = width * actor.ep / [actor.maxep, 1].max
gc1 = ep_gauge_color1
gc2 = ep_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
#--------------------------------------------------------------------------
# ? ?? EP ???
# item : ?? or ??
# rect : ??????
# enabled : ????
#--------------------------------------------------------------------------
def draw_equipment_ep_cost(item, rect, enabled = true)
return if item == nil
# ?? EP 0 ????????
return if KGC::EquipExtension::HIDE_ZERO_EP_COST && item.ep_cost == 0
color = KGC::EquipExtension::EP_COST_COLOR
self.contents.font.color = (color.is_a?(Integer) ?
text_color(color) : color)
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, item.ep_cost, 2)
end
end
#=================================================#
#==============================================================================
# ? Window_Equip
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = @actor.equips.clone
@item_max = [@data.size, @actor.armor_number + 1].min
create_contents
# ???????
self.contents.font.color = system_color
if @actor.two_swords_style
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
else
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
name = armor_slot_name(@actor.equip_type[0])
self.contents.draw_text(4, WLH * 1, 92, WLH, name)
end
for i in 1...@actor.armor_number
name = armor_slot_name(@actor.equip_type)
self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
end
# ??????
rect = Rect.new(92, 0, self.width - 128, WLH)
@item_max.times { |i|
rect.y = WLH * i
draw_item_name(@data, rect.x, rect.y)
draw_equipment_ep_cost(@data, rect)
}
end
#--------------------------------------------------------------------------
# ? ?????????
# kind : ??
#--------------------------------------------------------------------------
def armor_slot_name(kind)
case kind
when 0..3
return eval("Vocab.armor#{kind + 1}")
else
return Vocab.extra_armor(kind - 4)
end
end
unless $imported["ExtendedEquipScene"]
#--------------------------------------------------------------------------
# ? ????? 1 ????????
#--------------------------------------------------------------------------
def cursor_pagedown
return if Input.repeat?(Input::R)
super
end
#--------------------------------------------------------------------------
# ? ????? 1 ???????
#--------------------------------------------------------------------------
def cursor_pageup
return if Input.repeat?(Input::L)
super
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
return unless self.active
if Input.repeat?(Input::RIGHT)
cursor_pagedown
elsif Input.repeat?(Input::LEFT)
cursor_pageup
end
end
end
end
#=================================================#
#==============================================================================
# ? Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Item
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
@item_enabled = []
super
@data.each { |item| @item_enabled << enable?(item) }
end
#--------------------------------------------------------------------------
# ? ????????????????
# item : ????
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
if @equip_type == 0
return false unless item.is_a?(RPG::Weapon)
else
return false unless item.is_a?(RPG::Armor)
return false unless item.kind == @equip_type - 1
end
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# ? ??????????????????
# item : ????
#--------------------------------------------------------------------------
def enable?(item)
return false unless @actor.equippable?(item) # ????
return false unless @actor.ep_condition_clear?(@equip_type, item) # EP ??
return true
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
super(index)
rect = item_rect(index)
item = @data[index]
# ??????????
cw = self.contents.text_size(sprintf(":%2d", 0)).width
rect.width -= cw + 4
draw_equipment_ep_cost(item, rect, enable?(item))
end
#--------------------------------------------------------------------------
# ? ????????
# equip_type : ????
#--------------------------------------------------------------------------
def simple_refresh(equip_type)
# ???????????
last_equip_type = @equip_type
@equip_type = equip_type
@data.each_with_index { |item, i|
# ????????????????
if enable?(item) != @item_enabled
draw_item(i)
@item_enabled = enable?(item)
end
}
# ???????
@equip_type = last_equip_type
end
end
#=================================================#
#==============================================================================
# ? Window_EquipStatus
#==============================================================================
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias refresh_KGC_EquipExtension refresh
def refresh
refresh_KGC_EquipExtension
draw_actor_ep(@actor, 120, 0, 56) if KGC::EquipExtension::USE_EP_SYSTEM
end
end
#=================================================#
#==============================================================================
# ? Window_Status
#==============================================================================
class Window_Status < Window_Base
if KGC::EquipExtension::SHOW_STATUS_EP
#--------------------------------------------------------------------------
# ? ???????
# x : ??? X ??
# y : ??? Y ??
#--------------------------------------------------------------------------
alias draw_basic_info_KGC_EquipExtension draw_basic_info
def draw_basic_info(x, y)
draw_basic_info_KGC_EquipExtension(x, y)
draw_actor_ep(@actor, x + 160, y + WLH * 4)
end
end
#--------------------------------------------------------------------------
# ? ??????
# x : ??? X ??
# y : ??? Y ??
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
item_number = [@actor.equips.size, @actor.armor_number + 1].min
item_number.times { |i|
draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1))
}
end
end
#=================================================#
#==============================================================================
# ? Window_ShopStatus
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ? ?????????????????
# actor : ????
# x : ??? X ??
# y : ??? Y ??
#--------------------------------------------------------------------------
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
index = actor.equip_type.index(@item.kind)
item1 = (index != nil ? actor.equips[1 + index] : nil)
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
change = atk2 - atk1
else
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
change = def2 - def1
end
self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
end
draw_item_name(item1, x, y + WLH, enabled)
end
end
#=================================================#
#==============================================================================
# ? Scene_Equip
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size + 5
#--------------------------------------------------------------------------
# ? ?????????
# actor_index : ??????????
# equip_index : ????????
#--------------------------------------------------------------------------
alias initialize_KGC_EquipExtension initialize
def initialize(actor_index = 0, equip_index = 0)
initialize_KGC_EquipExtension(actor_index, equip_index)
unit = ($imported["LargeParty"] ?
$game_party.all_members : $game_party.members)
actor = unit[actor_index]
@equip_index = [@equip_index, actor.armor_number].min
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
alias create_item_windows_KGC_EquipExtension create_item_windows
def create_item_windows
create_item_windows_KGC_EquipExtension
kind = equip_kind(@equip_index)
EQUIP_TYPE_MAX.times { |i|
@item_windows.visible = (kind == i)
}
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
def update_item_windows
kind = equip_kind(@equip_window.index)
for i in 0...EQUIP_TYPE_MAX
@item_windows.visible = (kind == i)
@item_windows.update
end
@item_window = @item_windows[kind]
@item_window.simple_refresh(@equip_window.index)
end
#--------------------------------------------------------------------------
# ? ?????????
# index : ?????????
#--------------------------------------------------------------------------
def equip_kind(index)
if index == 0
return 0
else
return @actor.equip_type[index - 1] + 1
end
end
unless $imported["ExtendedEquipScene"]
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
@status_window.update
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias update_item_selection_KGC_EquipExtension update_item_selection
def update_item_selection
if Input.trigger?(Input::C)
# ????????
index = @equip_window.index
item = @item_window.item
unless item == nil ||
(@actor.equippable?(item) && @actor.ep_condition_clear?(index, item))
Sound.play_buzzer
return
end
end
update_item_selection_KGC_EquipExtension
end
end
#=================================================#
#==============================================================================
# ? Scene_File
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ? ???????????
# file : ??????????????? (??????)
#--------------------------------------------------------------------------
alias read_save_data_KGC_EquipExtension read_save_data
def read_save_data(file)
read_save_data_KGC_EquipExtension(file)
KGC::Commands.restore_equip
Graphics.frame_reset
end
end
[/spoiler]
EDIT: nevermind, moved the scripts around a bit.... It´s working now. Thanks for
a fun script.
Hey I was wonder how did you change your characters skin if oyu wnted to do it through an event?
Yeah, sort of. You just need to change it to a new page.
I get an error when i try and add the Equip Extension by KGC it says the stack lvl is too deep how do you fix this?
thanks in advance
First try putting my script below the kgc one in the editor. If that doesn't work, I have no idea what the KGC script looks like, so I'll need to see it. Preferably, I'd like you to upload a project with the error in it.
There was a little bug in the script included in the demo and so I have reuploaded the fixed version of this demo. This bug consisted of an error where the up row of the sprite would not show up if it were a single file (starts with $). I apologize for this bug. If you had gotten the script straight from the code box, then you would not get this bug as that had been fixed from the day I put it up, so it is only necessary to re-get the script if you took it directly from the demo and you plan on using single-file sprites.
1st of all, great script!
But, I too would like to use both this and KGC's Equip Extension... I have the two scripts attached to this post.
Thanks,
Miget man12
I'll look into it. I like your map.
OK, I have posted below a version of the script that should be compatible with KGC - at least it should not cause the stack error. Please report back to me if there are any problems:
#==============================================================================
# Composite Characters / Visual Equipment
# Version 1.0 (KGC COMPATIBLE VERSION)
# Author: modern algebra (rmrk.net)
# Date: July 5, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
#
# Place this script in between Materials and Main in the Script Editor
#
# To set a graphic for an armor or weapon, all you need to do is place this
# code in the Notes box of the item:
#
# \CG[<Name of Character Set>, <index in character set>, <hue>]
#
# If you leave out index, it defaults to 0 and if you leave out hue, it also
# defaults to 0. You can put more than one graphic to an armor or weapon and
# they will stack, first one on bottom last one on top.
#
# Setting up an Event is similar - all you need to do is place a comment at
# the very beginning of the event and put in the same code to generate a
# composite character set for the event. Same rules apply, and remember, you
# can stack character sets.
#
# EXAMPLES:
# \cg[Actor1, 2] # Character Set = Actor1 : index = 2 : hue = 0
# \CG[Evil] # Character Set = Evil : index = 0 : hue = 0
# \cG[Actor2, 3, 50] # Character Set = Actor2 : index = 3 : hue = 50
#
# Setting up your Actors is similar - see line 151 for details.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Compatibility:
#
# Unfortunately, I did need to overwrite some methods for this script, and
# as such there are likely to be compatibility problems. I know that my
# Extra Movement Frames Script certainly will not work with this script, and
# any script that tampers with the way a character set is drawn will also
# likely encounter problems. Now, this is not to say that any script that
# draws a character set will be incompatible - as long as that scripter uses
# the draw_actor_graphic method of Window_Base it should work fine - it is
# only scripts that change the way a character set is drawn that will cause
# problems. Also, I tamper with the load_gamedata method of Window_SaveFile,
# and so if another script overwrites that then there will again be
# compatibility issues. If you find a script that seems to cause problems,
# please post at the topic at rmrk.net and I will try my best to assist you.
#==============================================================================
#==============================================================================
# *** module Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - composite_character
#==============================================================================
module Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Composite Character
# char_array : An array holding the names of all parts of a graphic
#--------------------------------------------------------------------------
# Composes a single character bitmap out of all the ones given.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.composite_character (char_array)
@cache = {} if @cache == nil
# Blank bitmap if there is nothing in the array.
@cache[char_array] = Bitmap.new (32, 32) if char_array.empty?
# If not in the cache
if !@cache.include? (char_array) || @cache[char_array].disposed?
# Create a template bitmap
bitmap = Bitmap.new (32, 32)
# Add in all other graphics
char_array.each { |i|
name, index, hue = i[0], i[1], i[2]
# Bypass self.character in order to allow for setting hue
bmp = load_bitmap ("Graphics/Characters/", name, hue)
sign = name[/^[\!\$]./]
# Get the width and height of the single character
if sign != nil && sign.include? ('$')
wdth, hght = bmp.width, bmp.height
else
wdth = bmp.width / 4
hght = bmp.height / 2
end
# Expand bitmap if necessary
if bitmap.width < wdth || bitmap.height < hght
# Recreate bitmap
temp_bmp = bitmap.dup
bitmap = Bitmap.new ([temp_bmp.width, wdth].max, [temp_bmp.height, hght].max)
bitmap.blt (0, 0, temp_bmp, temp_bmp.rect)
temp_bmp.dispose
end
# Draw new character graphic onto bitmap
src_rect = Rect.new ((index%4)*wdth, (index/4)*hght, wdth, hght)
bitmap.blt (0, 0, bmp, src_rect)
}
@cache[char_array] = bitmap
end
return @cache[char_array]
end
end
#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - character_graphics
#==============================================================================
class RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Character Graphics
#--------------------------------------------------------------------------
# Retrieves Character Graphics from Note Field
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def character_graphics
graphics = []
# Retrieve Note Field
text = self.note.dup
while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
graphics.push ([$1.to_s, $2.to_i, $3.to_i])
end
return graphics
end
end
#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - composite_character
# aliased_method - initialize, change_equip
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_writer :composite_character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initalization
#-------------------------------------------------------------------------
# Initializes stacked_character variable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_arclght_vsual_equip_init_4t6h initialize
def initialize (id)
# Run Original Method
modalg_arclght_vsual_equip_init_4t6h (id)
@composite_character = []
case @actor_id
#---------------------------------------------------------------------
# EDITABLE REGION
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# An actor will automatically have whatever you set in the database
# as a bottom layer for him, but if you need to have other character
# sets piled on top, then put them in this format:
#
# when <actor_id>
# @composite_character.push (['graphic_name', index, hue])
# *for as many graphics as you want - first ones drawn first. If you
# want to know what each is, see the Instructions in the header.
#----------------------------------------------------------------------
when 1 # 1st Actor
# Create Hair Sprite
@composite_character.push (['VisEquipSample', 1, 100])
when 3 # 3rd Actor
# Create skin sprite with different hue
@composite_character.push (['VisEquipSample', 0, 20])
# Create Hair Sprites
@composite_character.push (['VisEquipSample', 2, 75])
@composite_character.push (['VisEquipSample', 3, 75])
#----------------------------------------------------------------------
# END EDITABLE REGION
#----------------------------------------------------------------------
end
@composite_character.each { |i|
i[1] = 0 if i[1] == nil
i[2] = 0 if i[2] == nil
}
@composite_character.unshift ([@character_name, @character_index, 0]) if @character_name != ''
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Composite Character
#--------------------------------------------------------------------------
# Returns Graphic Array for the actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def composite_character
armor_graphics = []
weapon_graphics = []
# Body Armor, then Helmet, then Shield, then all others
dup_armors = armors.dup
for i in 0...2
j = 2 - i
armor_graphics += dup_armors[j].character_graphics if dup_armors[j] != nil
dup_armors.delete_at (j)
end
# If there is some multi-equip script, will get accessories and rest in order
dup_armors.each { |armr| armor_graphics += armr.character_graphics if armr != nil }
weapons.each { |wpn| weapon_graphics += wpn.character_graphics if wpn != nil }
return @composite_character + armor_graphics + weapon_graphics
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
attr_reader :actors
end
#==============================================================================
# ** Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variable - composite_character
#==============================================================================
class Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :composite_character
end
#==============================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased methods - setup
#==============================================================================
class Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Event page setup
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malgbr_rclgh_req_comp_char_setup_5msk setup
def setup(new_page)
malgbr_rclgh_req_comp_char_setup_5msk (new_page)
# Create Composite Character
@composite_character = []
@composite_character.push ([@character_name, @character_index, 0]) unless @character_name.nil?
# If page == nil, return
return if @page == nil
# Retrieve first line comments
comments = []
@page.list.each { |i| i.code == 108 || i.code == 408 ? comments.push (i) : break }
# Evaluate comments for \CG codes
comments.each { |i|
text = i.parameters[0].dup
while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
@composite_character.push ([$1.to_s, $2.to_i, $3.to_i])
end
}
end
end
#==============================================================================
# ** Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased method - refresh
#==============================================================================
class Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdalg_arc_comp_character_find_rfrsh_8kwi refresh
def refresh
mdalg_arc_comp_character_find_rfrsh_8kwi
if !$game_party.actors.empty?
@composite_character = $game_party.members[0].composite_character
end
end
end
#==============================================================================
# ** Sprite_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased method - update_bitmap
#==============================================================================
class Sprite_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Transfer Origin Bitmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modern_alg_arclightrequest_visual_equip_bmp_update update_bitmap
def update_bitmap
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index ||
@composite_character != @character.composite_character
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = 0
@composite_character = @character.composite_character
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
if @composite_character == nil
# Regular Character Picture
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
else
self.bitmap = Cache.composite_character(@composite_character)
@cw = self.bitmap.width / 3
@ch = self.bitmap.height / 4
end
self.ox = @cw / 2
self.oy = @ch
end
end
end
#--------------------------------------------------------------------------
# * Update Transfer Origin Rectangle
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = 0
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
end
#==============================================================================
# ** Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# overwritten method - draw_character_graphic
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Actor Walking Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = Cache.composite_character (actor.composite_character)
cw = bitmap.width / 3
ch = bitmap.height / 4
rect = Rect.new (cw, 0, cw, ch)
self.contents.blt (x - (cw / 2), y - ch, bitmap, rect)
end
end
#==============================================================================
# ** Window_SaveFile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# overwritten_methods - load_gamedata,
#==============================================================================
class Window_SaveFile < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Load Partial Game Data
#--------------------------------------------------------------------------
# The same as the original method with the exception that it gets all of
# that file's data up to @game_party - necessary for composite graphics
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
# Bypass self-switches
@game_self_switches = Marshal.load(file)
# Bypass Actors
@game_actors = Marshal.load(file)
# Get Party
@game_party = Marshal.load (file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Party Characters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_party_characters(x, y)
for i in 0...@game_party.actors.size
draw_actor_graphic (@game_actors[@game_party.actors[i]], x + i * 48, y)
end
end
end
#==============================================================================
# ** Scene_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - terminate
#==============================================================================
class Scene_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Terminate
# updates game_player equipment
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_trmnte_cg_equipment_k8g9c terminate
def terminate
# RUn Original Method
modalg_trmnte_cg_equipment_k8g9c
$game_player.refresh
end
end
Just replace the current slot you have with this one.
And yay for double posting.
Thanks so much!
It works fine, this will make my game much more... complete.
The "Change Actor Graphic" function doesn't work. My intro lets the players design their character but the function "Change Actor Graphic" on page 3 doesn't work when I use this script. It is critical that you could do a fix.
Thanks.
I like that you use the word "critical" seriously :P
Anyway, here, I prepared a fix. The way it works is that the command adds the newly set graphic to the character (I assume, since you are allowing the character to be designed, this is what you want - so if you have a body as the default character graphic, then using this command on say, a hair sprite will give him hair; you could then use it again and it would add another feature, etc...), and then I implemented another command that will clear away all other graphics for when you want to change the thing entirely. If you use the script vent command and type in:
clear_character_graphic (actor_id) - it will clear away all graphics except the one last added.
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - set_graphic
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Graphics
# character_name : new character graphic filename
# character_index : new character graphic index
# face_name : new face graphic filename
# face_index : new face graphic index
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_cgve_st_grphic_evnt_6ht3 set_graphic
def set_graphic(character_name, character_index, face_name, face_index)
old_char_name, old_char_index = @character_name, @character_index
# Run Original Method
ma_cgve_st_grphic_evnt_6ht3 (character_name, character_index, face_name, face_index)
# Find old character name
count = 0
@composite_character.each { |char|
count += 1
break if char[0] == old_char_name && char[1] == old_char_index
}
# Put in new character directly after old one
@composite_character.insert (count, [@character_name, @character_index, 0])
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear Graphic
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear_graphic
@composite_character.clear
@composite_character.push ([@character_name, @character_index, 0])
end
end
#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - clear_character_graphic
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear Character Graphic
# actor_id : the ID of the actor to be cleared
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear_character_graphic (actor_id)
$game_actors[actor_id].clear_graphic
$game_player.refresh
end
end
Er... so I asume that this fixes the function " Change Actor Graphic" or if your talking about something else. I see you said use this command so Im thinking " He forgot to tell me the command".
Could you add me to msn " k-yoshi@live.com"
Also, that script.. Could you add it to the script.
Yeah, that's the one I'm talking about. It now works the way I outlined in the previous post.
I cant seem to make my own equips
I have a sprite, I added $ to it so now its $red
its a single file btw
I have \cg[$red, 1] now when my char puts it on.. I dont see it=\
i tried \cg[$red, 0] still nothing..
Ah, that's my fault. In the regexp, I didn't acount for symbols as I ought to have. Anyway, around line 259, try replacing this line:
while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
with this one:
while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
See if that fixes it.
It works, thanks!
Modern Algebra, you're a friggen genious!
Hey Modern Algebera,
I was wondering if you could make some adjustments to the script. Say, for example, I equiped an iron plate. Then it would show my character graphic changed and is now wearing armor. I'm sure with your crazy awsomeness you could find a way to do this :o
That's... what it does?
Quote# To set a graphic for an armor or weapon, all you need to do is place this
# code in the Notes box of the item:
#
# \CG[<Name of Character Set>, <index in character set>, <hue>]
I have an error with the script. Its weird, when I equip a gold beastplate, nothing happens. But when I walk down a couple steps, it flashes a picture of a green dude wearing a gold breastplate. I don't know what it is, but this is what I have under the notes.
\cg[5_yellow, 1]
(5_yellow is the picture i set as of the gold breast plate.)
???Im an Idiot :tpg:
Can you post the resource 5_Yellow. So the actual picture you're using?
Quote from: Modern Algebra on April 18, 2009, 08:42:03 PM
Can you post the resource 5_Yellow. So the actual picture you're using?
That's it. I just copied that from the website. It also flashes the green man when I don't have anything equiped =/
Put a $ in front of the name of the file since it's only a single graphic
The green man is likely being flashed because of the settings in the script. Go to this part of the script:
#---------------------------------------------------------------------
# EDITABLE REGION
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# An actor will automatically have whatever you set in the database
# as a bottom layer for him, but if you need to have other character
# sets piled on top, then put them in this format:
#
# when <actor_id>
# @composite_character.push (['graphic_name', index, hue])
# *for as many graphics as you want - first ones drawn first. If you
# want to know what each is, see the Instructions in the header.
#----------------------------------------------------------------------
when 1 # 1st Actor
# Create Hair Sprite
@composite_character.push (['VisEquipSample', 1, 100])
when 3 # 3rd Actor
# Create skin sprite with different hue
@composite_character.push (['VisEquipSample', 0, 20])
# Create Hair Sprites
@composite_character.push (['VisEquipSample', 2, 75])
@composite_character.push (['VisEquipSample', 3, 75])
Remove all of the @composite_character.push lines if you don't want them. Only have stuff there if you want to build the character graphic from individual parts rather than having a single base character graphic.
Ok, that helped out the flashing man problem... but now when I got to equip something, nothing hapens. I equiped the Golden Breastplate (\cg[$5_yellow, 1]) and it didn't work.
But did you rename the file too?
Quote from: Modern Algebra on April 19, 2009, 12:20:20 AM
But did you rename the file too?
If your talking about the 5_yellow, yes i renamed it to $5_yellow
And you made the change suggested here? http://rmrk.net/index.php/topic,28124.msg397508.html#msg397508
Quote from: Modern Algebra on April 19, 2009, 03:02:59 PM
And you made the change suggested here? http://rmrk.net/index.php/topic,28124.msg397508.html#msg397508
I made that change to, but it doesn't work. The character just stays the same.
Oh, of course. I didn't even see this, but where you wrote:
\cg[$5_yellow, 1]
the 1 is wrong. It should be 0, or left blank.
So:
\cg[$5_yellow]
or
\cg-$5_yellow, 0]
is what you need to do.
Great script! Exactly what i needed. I was wondering though, if i could affect hue(or maybe even graphic) with an event.
Example:
My game has an alignment system. I'd like it to change the player's appearance based on their alignment. If their alignment is more toward "evil", it should be darker... More "good" = brighter, etc. So if a player steals from/kills a merchant their alignment will change, therein changing their appearance(hue or otherwise).
If there's any way you could help with this, I'd be super appreciative.
Well, yeah, I mean you can set the hue of any character set with that third element in the array. As can be seen in the instructions:
# \CG[<Name of Character Set>, <index in character set>, <hue>]
I don't have anything where the graphic can be a gradient based on a variable, but you could easily enough just replace it manually.
I understand how to change the hue of the character set for events... It's changing the player's hues(hair and else) while in game.
Unfortunately, my scripting abilities are nil... If there is a way to describe how to "replace it manually," that would be super helpful.
I attempted to change the 720 in following code to a variable with a few methods, all of which ending in failure:
when 1 # 1st Actor
# Create Hair Sprite
@composite_character.push (['VisEquipSample', 1, 720])
Is this not the correct method? Or am i on the wrong path entirely?
Quote from: modern algebra on March 13, 2009, 11:48:53 PM
Yeah, that's the one I'm talking about. It now works the way I outlined in the previous post.
I am a beginner and still don't get it. :-\ Can you make a demo or something so it would be easier to set it up. Maybe plug'n'play ? ??? Please ... I hope you help me... Anyways thank you, for the many handy scripts you've made. :)
P.S. I tried to set it up by myself, but I got an error message:
''Unable to find file Graphics/Character/VisEuipSample''
P.S. (2) XD ;8 Do you like my mapping?
The map's not bad, but the ground types don't mesh well and the bridge looks kind of strange.
Anyway, there is a demo. It's attached to the first post. The error you are getting is because you haven't a) grabbed the VisEquipSample graphic, which you don't actually need or want. But you need to change the graphics that are set up in the initial script. Just go down until you see the
#---------------------------------------------------------------------
# EDITABLE REGION
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# An actor will automatically have whatever you set in the database
# as a bottom layer for him, but if you need to have other character
# sets piled on top, then put them in this format:
#
# when <actor_id>
# @composite_character.push (['graphic_name', index, hue])
# *for as many graphics as you want - first ones drawn first. If you
# want to know what each is, see the Instructions in the header.
#----------------------------------------------------------------------
when 1 # 1st Actor
# Create Hair Sprite
@composite_character.push (['VisEquipSample', 1, 100])
when 3 # 3rd Actor
# Create skin sprite with different hue
@composite_character.push (['VisEquipSample', 0, 20])
# Create Hair Sprites
@composite_character.push (['VisEquipSample', 2, 75])
@composite_character.push (['VisEquipSample', 3, 75])
And erase it or change it to add only the graphics you want to the actors.
Hey MA, I have a couple questions. I'm just starting to use this script so I just want to know how to customize a few things.
1: Where do I go to get rid of the hair-do on the player character from your demo.
2: Why doesn't my individual character sheets show up when I equip the items? (I have the comments like this in the notes box "\cg[$Helm_plate1]") I have not yet used your modification up somewhere for the use of the "$" symbol, so I'm about to try that and see if that fixes it. ~Edit: Nope that didn't work. My character remains blank. I also tried in the notes box "\cg[$Helm_plate1, 0]" just in case. Still nothing though.
See the post above you. Delete those lines.
And yeah, you need that patch. But I thought I had integrated it.
I also deleted those lines. Nothing changed. I still have the turquoise hair too.
Yep, I have no clue. It's probably something simple.
Here's a project with the script in it and my resources.
You changed it and then started a new game? It will still be there unless the character is reinitialized.
If you don't want ti re-initialize it, add the patch in post #24 to change Actor graphic to your game and write the code:
$game_actors[1].clear_graphic
Yeah, I was just testing the demo with my own resources but the hair wouldn't go away. Anyways, I started a new project to try it instead. I attached the demo in my last post edit. I'm not sure what's happening there. I think I did everything correctly? It's probably something easy and stupid.
When I run that project, all I get is the attached. That hair is on the sprite though, so that's why. Do you mean there is a different hair sprite on him?
Lol, I know there's hair on him already. That's my sprite. I was getting tired of erasing parts so I said screw it and left the hair on that sprite. The rest of the sheets are fine though. The hair I was actually talking about was from your demo though. Which is why I started a new project. I realize that if it starts working, that bits of hair would stick out from behind any of the helmets that are overlaid. I'm going to remove the body later sometime. I just want it to work first. :)
Well yeah, but it works fine from my testing. When does the turqoise hair show up?
The hair thing was just when I was testing your demo. So there's no problems with the project I posted???
~Did you talk to the old dude and get all the items to try? Because I definitely can't get them to appear.
~Edit: I got it to work finally. ._.
I had to replace that one line of code with:
while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
WHICH, I already did, HOWEVER, there's 2 places that line is used. I only replaced one of them. I stumbled upon the second line and replaced it and it worked. That was troubling! :D Thanks for your help, MA.
I have no scripting experience, but I was wondering if there's an easy way to place the fully loaded sprite on a HUD or anywhere else...
i guess it may help if you know my prob. I am using this (http://www.hbgames.org/forums/viewtopic.php?f=11&t=56154 (http://www.hbgames.org/forums/viewtopic.php?f=11&t=56154)) battle system, and it places the character sprite on the HUD. Problem is it seems to pull the char sprite from the data base(which is a naked/bald template), whereas i need it to pull from the composite script.
any idea on how to sync them up? I can send a blank proj file loaded with both scripts if you want...
Yeah, it's actually pretty easy (all you need to do is have, instead of Cache.character, Cache.composite_character and pass the comp. char. array), but I could probably do it faster than you if you send me the blank project.
Can you make a hair stylist NPC or something like that?
Because in my game, they get to choose their gender, and I don't get how to change their hair from what's in the database.
I was thinking I could also make different actors with different hair bases or just make the character base with hair already.
But I still want to know if or how you can change the hair through an event or something.
Because I tried using the editable region in the script and putting it in the event, and I get a syntax error.
(Sorry, I don't know alot about RMVX scripts.)
Hey MA
Sorry to bother you but what would be the code to add hair to a character like suggested in the post above, I've been looking through the codes and the posts for the last 3hours and can't seem to find it.
Thanks
Yhtomitsu
I was wondering if there's it's possible to get this to work with Kylock's translation of the Side-View Battle System by RPG Tankentai? I finally got this to work properly, and then realized that the script only uses the base Actor Graphic.
Thanks in advance.
@Monkii & Yhtomitsu:
Yeah, Just know the index and you can do this:
actor = $game_actors[x]
cc = actor.composite_character
cc.delete_at (y)
cc.insert (y, ['graphic_name', index, hue])
$game_player.refresh
where x is the actor ID and y is the index of the hair sprite. I split it up so much so that you can use it in a call script. If it extends over more than one line, the you can split it up more by setting variables to the elements of the array. So, something like this would work, as an example:
actor = $game_actors[3]
cc = actor.composite_character
cc.delete_at (1)
n = 'VisEquipSample'
cc.insert (1, [n, 5, 0])
$game_player.refresh
@Ekuell:
Yeah, I did it for someone else. I don't remember where that got off too though. Send me the project or a blank project and I'll fix it up for you. I just need to change the Cache.character calls to Cache.composite_character and pass the character array.
Yeah, I'm having the same problem as Ekuell so how do I fix it? Is there a way even a noob like me could do it?
Quote from: modern algebra on May 28, 2009, 01:43:42 AM
@Ekuell:
Yeah, I did it for someone else. I don't remember where that got off too though. Send me the project or a blank project and I'll fix it up for you. I just need to change the Cache.character calls to Cache.composite_character and pass the character array.
It's more or less a find and replace operation, which is easy, but you don't know the syntax required.
EDIT::
I looked around on my comp and found this. It might be the compatibility fix I did for the other guy, I'm not sure. In any case, you'd replace the Sideview 1 (3.3a) entry with this. Try it in a separate project, so as to avoid corrupting your real project. Obviously, it will only work with regular sprites. And no, I'm not going to make it work with those animated battler sheets.
I figured out how to change cache.character but how do you pass the character array?
Did you try the text document I attached, Your Holiness?
As for what to pass, it depends on the method. In some methods it would be @battler.composite_character, but it's different for what methods and in what classes, etc... Better to let me do it. Did replacing Sideview Battle 1 (3.3a) entry with the code in the txt document not work?
Hey sorry to bother you but could you put it into your demo or something so I can see how it works I just can't figure it out i'ma total noob whenit comes to this stuff sorry.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi40.tinypic.com%2F2ee91qv.jpg&hash=152a0e8b0ff0f1d0c8936b7517c5369b21984f85)
???
OH, nm, that code won't work to change hair colour anyway. Here, I'll just update the cript to include a wrapper for removing and adding graphics.
ok thanks
OK, updated the script. Tell me if you encounter any bugs. It was not adequately tested. Instructiond for the feature you requested are included in the script header.
Shoot, um... text document? Umm how do I look at that? Sorry for my idiocy. Is that a word? ???
Nah, it's my fault. I think I might have forgotten to upload it. It's attached to this post now.
K Thanks. I love you in a non-gay way. :)
:o Now there's a problem...
it says "Script 'Sideview 1 (3.3a)' line 6: SyntaxError occured"
Yeah, sorry, corrupted the data.
Try this one
Sweet! It works perfectly! The pope wishes to thank you with a smile: :D
Sorry... my limited knowledge tells me double posting is bad, but, could you make this compatible also with shopoholic v 2.0 by cmpsr2000 available exclusively at rpgrevolution.com/forums ??? it would be great if you could
I wouldn't have thought they were incompatible, but then I don't know anything about this Shopoholic script. I quickly did a check and found no problems right off the bat. Where is the error coming from, when you do what? What does it say? If you're getting an error, then either send me the project in which you get the error so that I can work from that or, if you are uncomfortable sharing your game project at this stage, recreate the error in a new project and send that to me. Either way is fine.
Okay, with the window_shop_details it puts up the character's sprite but not the composite sprite like to show details of defense changes and stuff.
At line 210 in Window_Shop_Details, replace:
bitmap = Cache.character(actor.character_name)
with
bitmap = Cache.composite_character(actor.composite_character)
It's beautiful. You're like... a super genius guy. This has changed my life. Forever. :) Thanks.
*feeling not smart*
I still don't get how to use the change hair sprites,
What do you mean by Index, and how come the example is different than the code?
Well, examples are different because I use actual numbers and files rather than descriptions of what goes there. In any case, if you have 1.2, then that operation is built in as codes that you can write in directly to a script call:
# remove_graphic_from_actor (actor_id, index)
# remove_graphic_from_actor (actor_id, graphic_name, graphic_index, graphic_hue)
# add_graphic_to_actor (actor_id, graphic_name, graphic_index, graphic_hue, index)
There are more details in the Instructions of the script, and an event in the demo does it so you can take a look at that.
And index is the index of the character in the character set. Note that there are eight in character sheets, index identifies which of those characters is to be used. It goes:
0 1 2 3
4 5 6 7
What if I made it so the spritesheet only has one index(using '$' at the beginning of the filename)?
Just leave it blank?
Cause that's what I've been doing and it's worked so far.
EDIT:
I got it to work. :)
I was going to post that I got an error, and then I realized I didn't put apostrophes around the file name.
Thanks, dood.
Yeah, graphic_index is 0 by default, which is what it is for ingle sprite sheets.
Also, I didn't mention this but I thought it might be what you wanted to know. index, in the
remove_graphic_from_actor (actor_id, index)
refers to the index of the graphic in the composite character array. Anyway, I'm glad you got things working.
i have a little question about this script, i'm trying to change actor graphic, but it'll look like this everytime i want to change the actor graphic:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi40.tinypic.com%2F30wpn5x.png&hash=dc6ecebe9cee15ff29a2b21c1c2cb7b015ebd4d5)
I want to change actor graphic with boat one...but it always look like that...why?
screenshot taken from the demo
thnx!
Yay a new problem... this time it's about the side view battle system again. When I use the animated enemy battlers add on theres an error "undefined method 'composite character' for #Game_Enemy:(some stuff) It would be great if you could fix it or something but you don't have to I think I might be able to live without it
http://www.rpgrevolution.com/forums/index.php?s=&showtopic=18304&view=findpost&p=212499
I don't intend to make it compatible with animated battlers, sorry. If you wish, I could put in some code so that it doesn't call that error and you could use composite characters when not in battle, but I won't make it so that you can see what you equip on the animated battlers themselves.
Hmm I think I might have given you the wrong idea. I don't want them to see what you equipped. Theres just an error and I think since the enemy animated battlers are called from the battler folder and character folder your script tries to do something to it... that kind of made sense to me.
OK, well, I'm too lazy to get the sideview battle script again, but where this is in the code:
# ????????????????
return unless @anime_flug
if @battler.actor?
self.bitmap = Cache.composite_character(@battler.composite_character)
else
self.bitmap = Cache.composite_character (@battler.composite_character)
end
Change it to:
if @battler.actor?
self.bitmap = Cache.composite_character(@battler.composite_character)
else
self.bitmap = Cache.character(file_name)
end
and see if that works
Hmmm... it was a little hard to figure out but I got it to work. Thanks again Modern! This has also changed my life forever... and my game. :)
Quote from: dnasman on June 18, 2009, 06:01:07 PM
i have a little question about this script, i'm trying to change actor graphic, but it'll look like this everytime i want to change the actor graphic:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi40.tinypic.com%2F30wpn5x.png&hash=dc6ecebe9cee15ff29a2b21c1c2cb7b015ebd4d5)
I want to change actor graphic with boat one...but it always look like that...why?
screenshot taken from the demo
thnx!
Sorry, I didn't see this post before. That's because of a patch someone had requsted that changes the "Change Actor Graphic" command to one that adds files to the character, rather than resets it. If you want to change the graphic completely, just put a Script command before it that has:
clear_character_graphic (actor_id)So
clear_character_graphic (1) would change Ralph
Added a compatibility patch for the Grid Inventory under Known Compatibility Problems. Before, it would not refresh upon equipping new items - using this patch, it will.
Hello everyone *>*
Ive got a question: Ìs there any oppertunity to show the armor etc. with this script and the Sideview Battle system?
http://rmrk.net/index.php/topic,28124.msg403285.html#msg403285
But it won't work if you're using animated spritesheets, only if you are using the regular sprites.
Also: http://rmrk.net/index.php/topic,28124.msg405118.html#msg405118
There was a little problem with the edits I provided of the Sideview system
Great script! I'll definitely be using it.
Has anyone already made any sprite sheets for this and is willing to give them to me? Of course I'd be willing to give credit where it's due. If not, that's cool.
Thanks a lot for the script!
http://rmrk.net/index.php/topic,31574.0.html has rips from Famitsu Chargen
can i ask somethin'?
i am using some sprites for wing but the prob is, when the wings is added, it goes above the character not below 'em. which it looks like this (https://rmrk.net/proxy.php?request=http%3A%2F%2Frpgrevolution.com%2Fforums%2Fuploads%2F1257899294%2Fgallery_59961_163_2084.png&hash=80f1af839e4f03f9ea87abe40c1d2123e5da87c0) (http://www.rpgrevolution.com/forums/index.php?autocom=gallery&req=si&img=5987). i want it ti look just like this (https://rmrk.net/proxy.php?request=http%3A%2F%2Frpgrevolution.com%2Fforums%2Fuploads%2F1257899294%2Fgallery_59961_163_210.png&hash=7dd1efb106053142cf1f76176c417499d333c270) (http://www.rpgrevolution.com/forums/index.php?autocom=gallery&req=si&img=5988)... see the first pic has a wings in front and the second one is in the back. how can i or can you fix it? thanks :D
I haven't looked at this script for a long time, but if I remember correctly, you can set the graphic up as:
# \CG[filename, index, hue, priority] # Character Set = Actor2 : index = 3 : hue = 50 : z = 2
If you set the priority to less than 0 it will show up behind the character. Alternatively you could edit the file itself, which you might have to do anyway since you need the priority of the wings to be greater when walking up, so you might have to split the graphic into two files.
once the script was in RMXP, and now this? :tv^:
Is there a way to have helmets replace the hair graphic? The hair sticks out the sides of all my helmets. I have tried many different ways but I can't figure it out.
Ps: I know you have no plans to make this compatible with Minkoff animated battlers but I'm wondering if it is at least possible that it could work.
No, not as it is - it would not work with animated battlers - they use different types of sprites.
It is possible to make a script like this that would work for animated battlers, but it would require some scripting.
Is There Any Way To Make It For Xp
Do a google search for Rataime Visual Equipment - I think that's the scripter who wrote one for RMXP
Hi, really great script! I love it.
But I have one small problem:
It's not compatible with 'RSSBS - Reedo's Simple Side Battle System'
[spoiler]
###############################################################################
## RSSBS - Reedo's Simple Side Battle System
## Version 1.0
## January 7, 2010
## By Reedo
###############################################################################
## SOURCE
##
## Source thread:
##
##
## Support thread:
## http://www.rpgmakervx.net/index.php?showtopic=24587
###############################################################################
## REFERENCES
##
## None. This is an original script by Reedo.
## However other people have contributed ideas and bug finds. Please see the
## support thread link above for details.
###############################################################################
## DESCRIPTION
##
## This script provides a plug-and-play Side Battle System for the default
## battle system. This is purely an asthetic script, and as such, it only
## modifies the visuals of the battle. It does not modify battle mechanics
## when used by itself.
##
## This script will:
## 1) Draw the party on the right side of the screen, facing left, during batle.
## 2) Cause actors to perform their stepping animation when they are on the
## ground, and have no state restrictions applied.
## 3) Place a shadow under the actor.
## 4) Provide a target for animations, and optionally, animations themselves.
## 5) Line up actors in a staggerd row, top to bottom, with adjustable spacing,
## recessed according to the position value of their class.
## 6) Cause actors to step forward when performing an action.
## 7) Draw actors lying down, whitened, and semi-transparent when dead.
## 8) Cause living actors to do a victory dance at the end of battle.
## 9) Provide the option to horizontally flip enemy images by enemy ID.
##
## When used with the YERD or YEZ battle scripts, you then get even more
## animation options (such as casting animations) and popups for most battle
## event messages. This SBS and YEZ combine to form an amazing SBS experience!
## YEZ Script Link: http://www.pockethouse.com/yez/
###############################################################################
## COMPATIBILITY
##
## Should be compatible with most other scripts.
##
## This script overwrites 1 method: Spriteset_Battle.update_actors
## All other methods are aliased, and those aliases are called.
## The one overwrite should not cause an issue as the only functionality it
## supresses is setting the party members to the current battle sprites. The
## rest of the original method is maintained, and this script handles the
## relationship between party members and battle sprites.
###############################################################################
## REQUIREMENTS
##
## None
###############################################################################
## INSTALLATION
##
## Plug-and-play. (and this time I mean it for reals!)
##
## Insert below Materials, above other Reedo scripts.
## All Reedo scripts should be below all YERD/YEZ scripts.
###############################################################################
## RIGHTS & RESTRICTIONS
##
## As with most Reedo scripts, this script is free to re-use, as-is,
## in personal, educational, and commercial RPGVX development projects,
## providing that: this script, as well as the rpgmakervx.net forum link
## from which it was obtained, are credited in writing displayed readily
## to the user of the final compiled code assembly.
##
## Reedo and rgpmakervx.net retain all rights of intellect and ownership.
## You forego all rights of warranty by utilizing this script.
###############################################################################
## USAGE
##
## Plug and play. Suggested to use YEZ Battle Engine Zealous, and Reedo's
## Tile-Based Battle Backgrounds scripts.
##
## Some visual options can be modified below.
###############################################################################
###############################################################################
## USER OPTIONS
###############################################################################
module REEDO_SBS
# If desired, you can modify the default script options using the constants
# below. In most cases though, you should not need to adjust these values.
###############################################################################
## This section controls the battle animations provided by this script
###############################################################################
# This controls whether or not this script will provide animations during
# battle. Set to 'true' when using this script without any other battle scene
# enhancements. Set to 'false' when using battle scene enhancements such
# as YEZ/YERD. Default is 'false'.
SBS_ACTION_ANIMES = false
# If this script is providing animations, then you can specify which
# animations to use a default.
SBS_DEFAULT_ATTACK_ANIME = 19
# Skill and item animations will use the animation assigned to the skill or
# item, if any. If none is assigned, then the default will be used. Specify
# a value of 0 if you do not want a default animation. These values have no
# effect if SBS_ACTION_ANIMES is set to 'false'.
SBS_DEFAULT_SKILL_ANIME = 1
SBS_DEFAULT_ITEM_ANIME = 1
###############################################################################
## This section adjusts the actors positions on screen
###############################################################################
ACTOR_START_LINE = 432 # The left-most position of the first actor
ACTOR_START_TOP = 88 # The top-most position of the first actor
ACTOR_STAGGER_HORZ = 8 # The amount to recess each actor to the right
ACTOR_STAGGER_VERT = 16 # The vertical spacing between characters
ACTOR_CLASS_POS_STAGGER = 16 # The extra distance to the right for class position
ACTOR_STEP_IN_DISTANCE = 64 # The distance an actor steps in during an action
ACTOR_STEP_IN_RATE = 8 # The rate at which the actor covers the distance
###############################################################################
## This section controls when an actor displays their stepping animation
###############################################################################
# If an actor has a state applied which has a restriction value listed in
# the following array, the actor will not display their stepping animation
# until the state is removed.
NO_STEP_RESTRICTIONS = [4, 5]
# Has the same effect as above, but halts the stepping animation based on
# the state's ID, without regard to the state's restriction.
NO_STEP_STATES = []
###############################################################################
## This section adjusts the appearance of an actor when dead
###############################################################################
ACTOR_DEATH_OPACITY = 175 # The tranparency of dead actors
ACTOR_DEATH_ANGLE = 270 # The angle to rotate the body
ACTOR_DEATH_TONE = [128, 128, 128, 0] # A color tone to apply to the image
ACTOR_DEATH_OFFSET_X = -8 # A horizontal offset to move the body by
ACTOR_DEATH_OFFSET_Y = -8 # A vertical offset to move the body by
###############################################################################
## This section adjusts the actor's shadow
###############################################################################
ACTOR_SHADOW_IMAGE = "Shadow" # The name of the system image to use
ACTOR_SHADOW_CUSTOM_PICTURE = nil # The name of a resource picture to use instead; nil to use system image
ACTOR_SHADOW_OFFSET_X = 0 # The horizontal offset to the actor's position
ACTOR_SHADOW_OFFSET_Y = 8 # The vertical offset to the actor's position
ACTOR_DEATH_SHADOW_OFFSET_X = 8 # Additional X offset added when dead
ACTOR_DEATH_SHADOW_OFFSET_Y = 2 # Additional Y offset added when dead
###############################################################################
## This section adjusts the victory dance
###############################################################################
VICTORY_DANCE_JUMP_HEIGHT = 16 # The height of the jump
VICTORY_DANCE_JUMP_INCREMENT = 2 # The rate of jump movement
VICTORY_DANCE_JUMP_HOVER = 4 # The number of frames to wait in the air
VICTORY_DANCE_JUMP_WAIT = 70 # The number of frames before jumping again
VICTORY_DANCE_JUMP_TWIST = true # True to twirl when jumping; false to face forward
###############################################################################
## This section adjusts the battle floor location
###############################################################################
BATTLE_FLOOR_TOP = 0 # Allows you to set the top of the battle floor
###############################################################################
## This section adjusts enemy images
###############################################################################
# Specify the ID of enemies who should have their image flipped in battle
FLIP_ENEMY = [
2, 3, 4, 5, 8, 10, 12, 13, 14, 16, 17,
18, 19, 21, 22, 23, 25, 28, 29,
]
end
###############################################################################
## MAIN SCRIPT
###############################################################################
## EDITS BEYOND THIS POINT ARE AT YOUR OWN RISK!!!
###############################################################################
class Game_Battler
alias reedo_sbs_gb_add_state add_state
def add_state(state_id)
reedo_sbs_gb_add_state(state_id)
if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle)
bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id)
return if bs == nil
bs.reedo_bc_sprite.character.step_anime = reedo_check_step_anime
reedo_update_life_state
end
end
alias reedo_sbs_gb_remove_state remove_state
def remove_state(state_id)
reedo_sbs_gb_remove_state(state_id)
if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle)
bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id)
return if bs == nil
bs.reedo_bc_sprite.character.step_anime = reedo_check_step_anime
reedo_update_life_state
end
end
def reedo_check_step_anime
return false if dead?
for state in states
return false if REEDO_SBS::NO_STEP_STATES.include?(state.id)
return false if REEDO_SBS::NO_STEP_RESTRICTIONS.include?(state.restriction)
end
return true
end
def reedo_update_life_state(battle_sprite = nil)
if dead?
if !@reedo_dead_set
reedo_set_dead_state(battle_sprite)
@reedo_dead_set = true
end
else
if @reedo_dead_set
reedo_set_live_state(battle_sprite)
@reedo_dead_set = false
end
end
end
def reedo_reset_dead_set
@reedo_dead_set = false
end
def reedo_set_dead_state(battle_sprite = nil)
if battle_sprite == nil
bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id)
else
bs = battle_sprite
end
return if bs == nil
return if bs.reedo_bc_sprite.is_dead
bs.reedo_bc_sprite.angle = REEDO_SBS::ACTOR_DEATH_ANGLE
tone = REEDO_SBS::ACTOR_DEATH_TONE
bs.reedo_bc_sprite.tone.set(tone[0], tone[1], tone[2], tone[3])
bs.reedo_bc_sprite.character.opacity = REEDO_SBS::ACTOR_DEATH_OPACITY
bs.reedo_bc_sprite.character.screen_x += REEDO_SBS::ACTOR_DEATH_OFFSET_X
bs.reedo_bc_sprite.character.screen_y += REEDO_SBS::ACTOR_DEATH_OFFSET_Y
bs.reedo_bc_sprite.shadow_sprite.x += REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_X
bs.reedo_bc_sprite.shadow_sprite.y += REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_Y
bs.reedo_bc_sprite.is_dead = true
end
def reedo_set_live_state(battle_sprite = nil)
if battle_sprite == nil
bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id)
else
bs = battle_sprite
end
return if bs == nil
return if bs.reedo_bc_sprite.is_dead != true
bs.reedo_bc_sprite.angle = 0
bs.reedo_bc_sprite.tone.set(0, 0, 0, 0)
bs.reedo_bc_sprite.character.opacity = 255
bs.reedo_bc_sprite.character.screen_x -= REEDO_SBS::ACTOR_DEATH_OFFSET_X
bs.reedo_bc_sprite.character.screen_y -= REEDO_SBS::ACTOR_DEATH_OFFSET_Y
bs.reedo_bc_sprite.shadow_sprite.x -= REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_X
bs.reedo_bc_sprite.shadow_sprite.y -= REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_Y
bs.reedo_bc_sprite.is_dead = false
end
end
class Game_Actor
attr_accessor :reedo_battle_sprite_id
attr_accessor :screen_x
attr_accessor :screen_y
end
class Game_Actors
def members
return @data
end
end
class Game_Troop
def troop_id
return @troop_id
end
end
class Game_Character
alias reedo_sbs_gc_screen_x screen_x
def screen_x
if $scene.is_a?(Scene_Battle)
return @battle_screen_x
else
return reedo_sbs_gc_screen_x
end
end
alias reedo_sbs_gc_screen_y screen_y
def screen_y
if $scene.is_a?(Scene_Battle)
return @battle_screen_y
else
return reedo_sbs_gc_screen_y
end
end
def opacity=(value)
@opacity = value
end
def screen_x=(value)
@battle_screen_x = value
end
def screen_y=(value)
@battle_screen_y = value
end
def step_anime
return @step_anime
end
def step_anime=(value)
@step_anime = value
end
end
class Sprite_Base
attr_accessor :reedo_victory_wait
end
class Sprite_Character
attr_accessor :shadow_sprite
attr_accessor :is_dead
alias reedo_sbs_sc_dispose dispose
def dispose
@shadow_sprite.dispose if @shadow_sprite != nil
reedo_sbs_sc_dispose
end
def create_shadow_sprite
@shadow_sprite = Sprite_Base.new(self.viewport)
bmp = Cache.picture(REEDO_SBS::ACTOR_SHADOW_CUSTOM_PICTURE) if REEDO_SBS::ACTOR_SHADOW_CUSTOM_PICTURE != nil
bmp = Cache.system(REEDO_SBS::ACTOR_SHADOW_IMAGE) if bmp == nil
@shadow_sprite.bitmap = bmp
@shadow_sprite.src_rect = Rect.new(0, 0, bmp.width, bmp.height)
@shadow_sprite.x = self.x - self.ox + REEDO_SBS::ACTOR_SHADOW_OFFSET_X
@shadow_sprite.y = self.y - self.oy + REEDO_SBS::ACTOR_SHADOW_OFFSET_Y
@shadow_sprite.z = self.z - 1
end
alias reedo_sbs_sc_update update
def update
reedo_sbs_sc_update
@shadow_sprite.update if @shadow_sprite != nil
end
end
class Sprite_Battler
attr_accessor :reedo_bc_sprite
alias reedo_sbs_sb_dispose dispose
def dispose
@reedo_bc_sprite.dispose if @reedo_bc_sprite != nil
reedo_sbs_sb_dispose
end
alias reedo_sbs_sb_update update
def update
reedo_sbs_sb_update
@reedo_bc_sprite.update if @reedo_bc_sprite != nil
end
end
class Spriteset_Battle
alias reedo_sbs_ssb_create_battlefloor create_battlefloor
def create_battlefloor
reedo_sbs_ssb_create_battlefloor
@battlefloor_sprite.y = REEDO_SBS::BATTLE_FLOOR_TOP
end
alias reedo_sbs_ssb_create_actors create_actors
def create_actors
if @actor_sprites != nil
dispose_actors
end
reedo_sbs_ssb_create_actors
@reedo_start_points = {}
@actor_sprites = []
i = 1
for actor in $game_party.members
actor.reedo_battle_sprite_id = i - 1
gc = Game_Character.new
gc.set_graphic(actor.character_name, actor.character_index)
gc.set_direction(4)
gc.screen_x = 0; gc.screen_y = 0
bc = Sprite_Character.new(@viewport1, gc)
gc.screen_x = REEDO_SBS::ACTOR_START_LINE +
($data_classes[actor.class_id].position *
REEDO_SBS::ACTOR_CLASS_POS_STAGGER) +
((i - 1) * REEDO_SBS::ACTOR_STAGGER_HORZ)
gc.screen_y = REEDO_SBS::ACTOR_START_TOP + ((bc.height * i) +
(REEDO_SBS::ACTOR_STAGGER_VERT * i))
actor.screen_x = gc.screen_x; actor.screen_y = gc.screen_y
sb = Sprite_Battler.new(@viewport1, actor)
sb.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_HOVER
sb.reedo_bc_sprite = bc
gc.step_anime = actor.reedo_check_step_anime
@reedo_start_points[sb] = [gc.screen_x, gc.screen_y]
@actor_sprites.push(sb)
bc.update
bc.create_shadow_sprite
actor.reedo_reset_dead_set
actor.reedo_update_life_state(sb)
i += 1
end
end
alias reedo_sbs_ssb_create_enemies create_enemies
def create_enemies
reedo_sbs_ssb_create_enemies
for sprite in @enemy_sprites
if REEDO_SBS::FLIP_ENEMY.include?(sprite.battler.enemy_id)
sprite.mirror = true
end
end
end
def update_actors
if $scene.is_a?(Scene_Battle)
if $scene.victory_dance_time
reedo_update_victory_dance
end
end
for sprite in @actor_sprites
sprite.reedo_bc_sprite.character.update
sprite.update
end
end
def reedo_get_battle_sprite(sprite_id)
return nil if !sprite_id.is_a?(Fixnum)
return nil if sprite_id < 0
return nil if sprite_id >= @actor_sprites.length
return @actor_sprites[sprite_id]
end
def reedo_update_victory_dance
if @victory_delta == nil
@victory_delta = -REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT
for sp in @actor_sprites
sp.reedo_bc_sprite.character.step_anime = false
end
end
for sp in @actor_sprites
next if sp.battler.reedo_check_step_anime == false
stpt = @reedo_start_points[sp]
if sp.reedo_bc_sprite.character.screen_y < stpt[1] - REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT
if sp.reedo_victory_wait <= 0
@victory_delta = REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT
sp.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_WAIT
else
@victory_delta = 0
sp.reedo_victory_wait -= 1
end
end
if sp.reedo_bc_sprite.character.screen_y > stpt[1]
if sp.reedo_victory_wait <= 0
@victory_delta = -REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT
sp.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_HOVER
sp.reedo_bc_sprite.character.step_anime = false
else
@victory_delta = 0
sp.reedo_victory_wait -= 1
sp.reedo_bc_sprite.character.step_anime = true if !sp.reedo_bc_sprite.character.step_anime
end
end
if REEDO_SBS::VICTORY_DANCE_JUMP_TWIST
if sp.reedo_bc_sprite.character.screen_y <= stpt[1]
if (sp.reedo_bc_sprite.character.screen_y - stpt[1]) % (REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT / 4) == 0
case sp.reedo_bc_sprite.character.direction
when 4; sp.reedo_bc_sprite.character.set_direction(2)
when 2; sp.reedo_bc_sprite.character.set_direction(6)
when 6; sp.reedo_bc_sprite.character.set_direction(8)
when 8; sp.reedo_bc_sprite.character.set_direction(4)
end
end
else
sp.reedo_bc_sprite.character.set_direction(4) if sp.reedo_bc_sprite.character.direction != 4
end
end
sp.reedo_bc_sprite.character.screen_y += @victory_delta
sp.battler.screen_y += @victory_delta
end
end
end
class Scene_Battle
attr_reader :victory_dance_time
alias reedo_sbs_sb_start start
def start
reedo_sbs_sb_start
@current_party = $game_party.members
end
alias reedo_sbs_sb_terminate terminate
def terminate
reedo_teardown_actors
reedo_sbs_sb_terminate
end
alias reedo_sbs_sb_update update
def update
if @current_party != $game_party.members
@spriteset.create_actors
@current_party = $game_party.members
end
reedo_sbs_sb_update
end
alias reedo_sbs_sb_execute_action_attack execute_action_attack
def execute_action_attack
reedo_do_execute_action("attack")
end
alias reedo_sbs_sb_execute_action_skill execute_action_skill
def execute_action_skill
reedo_do_execute_action("skill")
end
alias reedo_sbs_sb_execute_action_item execute_action_item
def execute_action_item
reedo_do_execute_action("item")
end
alias reedo_sbs_sb_process_victory process_victory
def process_victory
@victory_dance_time = true
reedo_sbs_sb_process_victory
end
def reedo_get_battle_sprite(sprite_id)
return @spriteset.reedo_get_battle_sprite(sprite_id)
end
def reedo_teardown_actors
for actor in $game_actors.members
actor.reedo_battle_sprite_id = nil if actor != nil
end
end
def reedo_do_execute_action(action_method)
targets = @active_battler.action.make_targets
if @active_battler.is_a?(Game_Actor)
reedo_actor_step_in
if REEDO_SBS::SBS_ACTION_ANIMES
targets.each do |t|
if t.is_a?(Game_Actor)
bs = reedo_get_battle_sprite(t.reedo_battle_sprite_id)
bs.reedo_bc_sprite.character.animation_id = eval("reedo_get_" + action_method + "_animation") if bs != nil
end
end
end
eval("reedo_sbs_sb_execute_action_" + action_method)
reedo_actor_step_back
else
if REEDO_SBS::SBS_ACTION_ANIMES
targets.each do |t|
if t.is_a?(Game_Actor)
bs = reedo_get_battle_sprite(t.reedo_battle_sprite_id)
bs.reedo_bc_sprite.character.animation_id = eval("reedo_get_" + action_method + "_animation") if bs != nil
end
end
end
eval("reedo_sbs_sb_execute_action_" + action_method)
end
end
def reedo_get_attack_animation
return REEDO_SBS::SBS_DEFAULT_ATTACK_ANIME
end
def reedo_get_skill_animation
skill = $data_skills[@active_battler.action.skill_id]
aid = REEDO_SBS::SBS_DEFAULT_SKILL_ANIME
aid = skill.animation_id if skill.animation_id > 0
return aid
end
def reedo_get_item_animation
item = $data_items[@active_battler.action.item_id]
aid = REEDO_SBS::SBS_DEFAULT_ITEM_ANIME
aid = item.animation_id if item.animation_id > 0
return aid
end
def reedo_actor_step_in
delta = 0
dr = REEDO_SBS::ACTOR_STEP_IN_RATE
while delta < REEDO_SBS::ACTOR_STEP_IN_DISTANCE
bs = reedo_get_battle_sprite(@active_battler.reedo_battle_sprite_id)
return if bs == nil
bs.reedo_bc_sprite.shadow_sprite.x -= dr
bs.reedo_bc_sprite.character.screen_x -= dr
bs.battler.screen_x -= dr
Graphics.update
@spriteset.update
delta += dr
end
end
def reedo_actor_step_back
delta = 0
dr = REEDO_SBS::ACTOR_STEP_IN_RATE
while delta < REEDO_SBS::ACTOR_STEP_IN_DISTANCE
bs = reedo_get_battle_sprite(@active_battler.reedo_battle_sprite_id)
return if bs == nil
bs.reedo_bc_sprite.shadow_sprite.x += dr
bs.reedo_bc_sprite.character.screen_x += dr
bs.battler.screen_x += dr
Graphics.update
@spriteset.update
delta += dr
end
end
end[/spoiler]
OK, well look for this line in reedo's:
gc.set_graphic(actor.character_name, actor.character_index)
Underneath it, try putting:
gc.composite_character = actor.composite_character
and see if that works.
I get this error :
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fwww4.picturepush.com%2Fphoto%2Fa%2F3462942%2Fimg%2F3462942.jpg&hash=809851f5698e0a45bd6f8b2d8fa882724caa1695)
Ok, well put this code somewhere in its own slot above the script:
class Game_Character
attr_writer :composite_character
end
It works!
Thank you very much!! :)
btw, is there also a way to make certain equipment change the look of certain actors only.
Like:
Iron Armour gives Actor #1: \cg[Actor1, 2]
but to Actor #2: \cg[Actor2, 2]
No, there isn't. Sorry.
Hey Modern Algebra.
You're scripts are excellent, and I especially love this one. Is there a way to display an actor in your party as a composite character event, like if they leave your party temporarily and you're able to speak with them in a pub or something, a la Star Ocean?
Not built in, but it's a good idea, so I wrote an addon. Just follow the instructions in the header:
#==============================================================================
# Set Event to Actor Graphic
# Addon for Composite Character Sets / Visual Equipment
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: June 1, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
# Paste this into its own slot in the Script Editor, below Materials but
# somewhere above Main
#
# To set an event to actor graphic, use this code in a Script call (third
# tab of event commands)
# $game_map.events[event_id].set_to_actor (actor_id)
# event_id : the ID of the event whose graphic you are changing
# actor_id : the ID of the actor whose graphic you want the event to
# have.
#
# Remember, the event will retain whatever event settings it had originally,
# including original pose, so if you want the event to be standing still
# instead of with one leg out, you have to set it up with some graphic prior
# to changing it by script and choose the pose you want the actor graphic to
# be in.
#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - set_to_actor
#==============================================================================
class Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set to Actor Graphic
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def set_to_actor (id)
@composite_character = $game_actors[id].composite_character.dup
end
end
That is so excellently cool. Thanks!
When i add hair useing a script call. (Attachment 1 aka error). This happens when i equip cloth. (Attachment 2 aka error2) The cloth goes over the hair. If i make its (z) -1 cloth doesnt show at all. XD
Hope you understand any of this.
Um, try making the z of the hair something higher, like 1, or 5.
Quote from: modern algebra on June 16, 2010, 09:20:28 PM
Um, try making the z of the hair something higher, like 1, or 5.
How would i do that useing the script? Seeing how n is the name and h is for color.
Would i just.....
n = "$WhiteBedHead"
add_graphic_to_actor (1, n, 0, z, 1)
umm:
add_graphic_to_actor (actor_id, char_name, char_index, char_hue, z)
I think is the order, so:
n = "$WhiteBedHead"
add_graphic_to_actor (1, n, 0, 0, 1)
might do the trick. I don't know though - I don't really remember this script.
Yay you did it it works.
Great script... a compatibility fix for use with Battle Engine Melody would be cool though.
http://wiki.pockethouse.com/index.php?title=Battle_Engine_Melody (http://wiki.pockethouse.com/index.php?title=Battle_Engine_Melody)
Great job on the script! But is there a way to set what the actors wear when there's nothing equiped on them? For example when there's no helmet equiped on the actor he will be wearing the hairstyle on him. And i would also like to try and make it actor-specific, different default hair for each actor. Is this possible?
I don't have much scripting knowlege so if there's something I need to add to the script i will apreciate it if you helped :)
Hey bro, is it possible to make this compatible with Kaduki Battlers using Sprite_Battler for Sideview Ver3.3c.
I'm working on a kind free roam game like dragon quest 9 using Tankentai because I make a timed hit battle system addon with the Atb which is great. But in all great free roam games you need to have cloth and customizable options and your script works great until you use the battle system. Could you please make it compatible so I can use your cool script.
P.s I did try the 3.3a and it also didn't work.
Sprite_Battler for Sideview Ver3.3c
http://pastebin.com/Zm8Fsykx
As I understand it, setting the priority for a graphic on a piece of equipment only affects the graphic in relation to other graphics on that same piece of equipment, correct? That the order in which the equipment items are drawn is determined exclusively by which slot they are equipped in?
Would it be possible to modify the script so that you can use the priority setting to customize that order instead?
For example,
If Character A was wearing Small Gloves and a Huge Baggy Robe, then it would make sense for the gloves to be drawn first, with the robe on top. But if Character B was wearing Mega Gauntlets and a Long-sleeved Shirt, it would be better for the shirt to be drawn first, with the gauntlets on top.
I initially thought this was how the priority setting worked, but after testing it and having my characters equipment drawn in a totally wrong order, I realized that I must have misunderstood the instructions.
I have an idea as to how to make this work, only I don't understand the language well enough to actually modify the script myself. Trying to read the character_graphic method of RPG::Base_Item only succeeded in giving me a headache, and that is one of the methods I'd need to change.
Errm, well that is how the priority setting should work. Lower priority are drawn first. So 0 would be the bottom layer, 1 would be the next layer, 2 the next, etc... If that isn't what's happening then that's a problem. Recreate the error in a new project and send it to me and I will see if I can fix it.
Nevermind, I figured it out. Stupid mistake on my part, I repeatedly left out one of the numbers in the notes box code, so what I thought was the priority setting was actually the hue setting... my bad. Works fine now, well, technically it always did, I just wasn't using it right, but you get the idea.
In my game, I use events to cycle between different hairstyles and different clothing styles....It's kind of hard to explain here, so could I send you a demo of the problem?
Basically, changing hair should be independent of changing clothes, but when I try to change one the other also changes as well.
umm yeah, send me a demo and I'll take a look when I have time. It might be a while from now though.
http://dl.dropbox.com/u/15385392/Gio%20Adventures%20Origins.exe (http://dl.dropbox.com/u/15385392/Gio%20Adventures%20Origins.exe)
Every time I try to change something in the code, something else goes wrong. Now the hairstyles are stacking on top of each other even though I put a script call to remove the previous style, in addition to the previous problem.
EDIT:
To cycle between styles, use left or right. To switch between hair and clothing, press up or down. All articles start on the left so you should start cycling right.
EDIT:
I fixed it. It's weird and I don't understand why, but it works perfectly now. Apparently I have to run both common events that handle the clothing and hair one right after another so that the game checks both.
Weird. Well, I'm glad you managed to fix it.
THANK YOU!!!! I HAVE BEEN SEARCHING RPGMAKERVX.NET FOR THIS SCRIPT BECAUSE I SAW IT THERE AND I'M AM GLAD YOU HAVE IT HERE BECAUSE SOMEONE ELSE POSTED A LINK!!!! :tpg:
Hope this isn't considered a necro post:
don't supose that Yanfly's extended moviement could be made compatible with this?
Link me to the script and we'll see.
Quote from: modern algebra on December 21, 2010, 03:53:42 PM
Link me to the script and we'll see.
http://wiki.pockethouse.com/index.php?title=Extended_Movement
I'm making a dungeon game, and i'm trying to use your script.
but I cant figue out how to configure the 'add_graphic_to_actor' script
the problem is, i dont get how the numbers after that are configured.
This is the part i dont understand
'index : the index of the graphic in the actor's composite_character'
what does it mean?
:tpg: Wow lots of info!
Ok, my question was asked by some one else, but not responded to...
My question: How do I remove a hair style from the hero when I equip a helm?
More to the point, I need to remove it from the (note) field on the helm, until the helm is unequipped. I have studied this code and this form for months, and all my attempts led me to think the script doesn't support the (note) field to remove graphics. I don't want to clear all of it, just the hair until the helm is removed. Any ideas would be of great help? :-\
# You can now remove and add graphics to the actor using the following codes
# in a script call:
#
# remove_graphic_from_actor (actor_id, index)
# remove_graphic_from_actor (actor_id, graphic_name, graphic_index, graphic_hue)
# add_graphic_to_actor (actor_id, graphic_name, graphic_index, graphic_hue, index)
I also think its odd that the last remove code is an add code, is this a typo?
This is a brilliant script, and will save me a lot of time on resource creation, so let me first thank you for it.
Second, and I don't hold out too much hope for this, but is there any way to make it compatible with GubiD's tactical battle system (GTBS)?
It's available here: http://www.mediafire.com/?alyjzm4qgyg
i really hope this isnt a necropsted but... is this thing gonna work on GTBS? i was hoping to minimize my work by using this and some of my tweaks. since i will do a character creation for my game, this might be helpful. i am afraid it might not work for GTBS animated or non animated battlers.
Im sorry is there a way to make this compatible with tankantai sbs 3.4d
I am very new to rpg maker vx and would like to know how i can add options provided by : http://rmrk.net/index.php/topic,31574.0.html to add more Armour / choices to my game.
Thanks for your time.
-Crimexx
Just import them into your game like you would any other character sets? If they are singles and not a set of 8 then put a $ in front of them as you would normally.
I really don't know what you mean - all the relevant instructions are in the header of the script and I really don't know how I could explain it any better in such a general way. There's also a demo which (I think) demonstrates every feature of the script. If maybe you have a more specific and focussed question about what you don't understand about the instructions or the demo, then I can clarify. But as it is, I have already explained the general aspects of the script to the best of my ability inside the script and demo and I don't know how to improve on that without knowing where you are having difficulty.
im trying to use this script, but when i start the game, the actor always has green hair. How do i get rid of this?
Sounds like you have a hue set on your hair sprites. Set the third option to zero and that should make it normal.
Example :
@ma_composite_character.push (['VisEquipSample', 2, 75])
Change to :
@ma_composite_character.push (['VisEquipSample', 2, 0])
W0 was just curious if you ever hand a chance to look at Yanfy extended movement to find a way to make it work with that
excuse me!
can you make this run with extra movement frames? will this work with bigger sprite set??
hmm not 32x32?
im using RO sprite sheet. can you make it run to have 8 frames width, 9 frames height??
im using the kaduki SBS. so it would be nice to be my $actor_idle, $actor_walk, $actor_run just have the Headgears in map.
and for my $actor_idle_1(for battle scene) should be like this.
i want to make my $actor_idle_1 graphic to be the 1st layer
2nd layer is for my weapon graphic, 3rd layer is my shield graphic, if two handed also in 2nd layer,
then 4th layer is for my head gear low, 5th layer for my headgear mid, 6th layer is for my head gear top..
Sorry For my bad English im asian, please do tell me if my english is worst and u understand what im saying i will try my best to make it more clear.
thanks in advance..
Is it possible to add an extra tag so this can effect different classes specialy, but if special class tages aren't used, the other tags will effect any untagged class?
I was thinking something like:
\cg[Actor2, 3, 50, 2, 5] # Character Set = Actor2 : index = 3 : hue = 50 : z = 2 class :5
By the way, what does z do?
EDIT: I just realized I don't need this anymore :( It probably won't work when I use the animation frames with Tankentai SBS ATB D: They extra frames make the game more awesome
Is it possible to add folder support so I could organize hair, armor, accessories, and helmets into folders?
Thanks for the awesome script,
-Crimexx
How do you fix Tankentai Sideview Battle System3.4 for the skin?
Can anyone HELP ME? :zwink:
Is it possible to tell us how to set up the Charsets for this script?
dunno. i should check this out too,
hey,modern allegra,i looked trough the posts and it seems that you have made a LOT of Edit,
so, can you post the edited script please? i dont wanna have the same error everyone had, :lol:
and one more thing..do you know a script similar to this 1 but instead of changing the sprite it change the face?
this would be COOOL for a chara maker :D and your script is AWESOOOMME!!!!!!
Well, all of the edits I made up to December 5, 2009, are included in the script.
As far as I know, the only edits I made after that are compatibility patches, meaning that they are only relevant if you have the conflicting script. As far as I know, all of the compatibility patches I made are listed in the "Known Compatibility Issues" of the first post, so just see if you have any of those scripts and, if so, grab the corresponding patch.
Amazing script, MA. I've been lurking a few months at this site but I've never commented (because I can't speak english properly) and I think this script is particularly interesting.
On the other hand, I'm using the Extra Movement Frames script and it's a shame that they're not compatible.
Is there any chance of a compatibility patch in the future?
Hey, i don't know if you still check this thread, but its worth a try. the script works amazing, but when i am in the game and i try to save, the game shuts down with an error (i named the script 'Equip'):
Script 'Equip' line 480: NoMethodError occured
undefined method 'Composite_Character' for "Actor 3":String
The only Other Scripts I Am Running Are 'Requiem ABS 9' and 'Dargor Map Name Popup'
and, of course the rtp scripts.
If Anyone can fix this, thank you.
You have to delete your old save files.
oh thats it? well, i feel stupid....
thanks bro.
Sorry for the necro but I'd love to use this script. Though I do have one question.
Is it possible to edit this script just so that not only the sprite but also the face is edited.
I'm in need of something like a character creation in the beginning of my game.
There are three races to the main face would be one of these three depending on the choice they made, also male or female. So the bases would have been chosen because of that. But I'd love to let my players choose their hair style and colour, eye style and colour, markings and accessories, something like the RMVXA character generator but then inside the VX game.
I would want to use some face-sets for different hairstyles, eye-styles, etc. depending on male/female, and the same for the hairstyles and eye-colour on sprite-bases.
If you would even consider thinking about taking this question/request about this script and changing it so that that too is made possible, I'd be very, very, very grateful.
Oh, and I love most of the scripts you made, they are all very compatible with all of the others I use.
Lovely script
I wanted to see if it was possible to add in tinting. I really only want it as a way to control brightness (RGB together) and contrast (grey).
No, there isn't. Sorry.
This script seems to block the "change character graphic" event, which I have used a LOT throughout my project. It would be a nightmare to have to associate every single one of those events with your script.
Edit: I was hesitant to use a parallel common event for what I needed, but apparently it's not going to lag the game like I thought it would. Yay!