CharSet Frame Change
#1
CharSet Frame Change
by XeroVolume
Oct 22 2006

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Use this code if you have a CharSet that uses more than 4 frames for animation.

Features:

Allows loading of CharSets being of any column width, such as that of 8-frame movement characters.

Usage:

If you do not wish to use the default 4 frames movement, place "w_x" within the filename of the CharSet to be used. "x" represents the number of frames being used. For example:

"hero2 w_8.png" might be the name of a CharSet that uses 8 frames for movement.

Installation:

Apply the edits found in the sections below.



Game_Character 1

Add on line 28, after attr_accessor: transparent
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
attr_accessor :charset_tile_width          # Amount of frames, i.e. columns of characters in the charset.
#-------------Edit-----------------------------Edit-----------------------------Edit----------------



Game_Character 2

Replace @pattern = (@pattern + 1) % 4 (should be line 31) with:
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
# Pattern is the current movement frame (i.e. column) the character is currently on.
@pattern = (@pattern + 1) % @charset_tile_width
#-------------Edit-----------------------------Edit-----------------------------Edit----------------

Replace @character_name = command.parameters[0] (should be line 323) with:
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
#Def: @character_name = command.parameters[0]
set_charset command.parameters[0]
#-------------Edit-----------------------------Edit-----------------------------Edit----------------




Game_Event

Replace @character_name = actor.character_name (should be line 141) with:
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
#def: @character_name = @page.graphic.character_name
set_charset @page.graphic.character_name
#-------------Edit-----------------------------Edit-----------------------------Edit----------------



Game_Player

Replace @character_name = actor.character_name (should be line 106) with:
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
#Def: @character_name = actor.character_name
# Update character name, auto sets tile width.
set_charset actor.character_name
#-------------Edit-----------------------------Edit-----------------------------Edit----------------



Sprite_Character

Replace @cw = bitmap.width / 4 (should be line 47) with:
Code:
#-------------Edit-----------------------------Edit-----------------------------Edit----------------
# def: @cw = bitmap.width / 4
@cw = bitmap.width / @character.charset_tile_width
#-------------Edit-----------------------------Edit-----------------------------Edit----------------



Now add a new class after Game_Character 3 called Game_Character_CFC

Paste this into it:
Code:
class Game_Character
  #--------------------------------------------------------------------------
  # Reads the name of the charset to determine the tile width of the
  # character.
  #--------------------------------------------------------------------------
  def set_charset(charname)
    @character_name=charname
    # Default tile width.
    @charset_tile_width = 4
    charname.gsub(/w\_(\d+)/) {@charset_tile_width = $1.to_i}
  end
end


*NOTE*

I did not write this script!!! Sorry, but I don't know who the original author is. That being said, if anyone recognizes this or knows who wrote it, please let me know so I can give them the credit they deserve!!!

P.S. This is my first script post. How'd I do?
}




Users browsing this thread: 1 Guest(s)