Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Requesting a merge/edit: Caterpillar + party switcher

The thing is that I get an error from caterpillar script after using the party switcher. I tried disabling the caterpillar before opening party switcher, then re-enable afterwards; but that doesn't work as well ':|

So if there is someone who can make these 2 scripts works together, I will be eternaly grateful :lol:

ps: I use Billzard's Easy party switcher and SephirothSpawn's Trailing Characters w/Caterpillar
#==============================================================================
# Easy Party Switcher by Blizzard
# Version 1.2b
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
#
#
# This is the official Party Switcher of:
# Chaos Project - The Three Moonsâ„¢
#
#
# Special Thanks to:
# Zeriab for pointing out a few glitches and shortening the code. =D
#
#
# IMPORTANT NOTE:
#
# Be sure to set the $party_max_size to the maximum size of your party.
# There is already a preconfiguration of 4.
#
#
# Compatibility:
#
# 99% chance of full compatibility with SDK, not tested altough. Can cause
# incompatibility with Party Change Systems. WILL corrupt your old savegames.
#
#
# Features:
#
# - Set party members for "not _available" (shown transparent in the reserve)
# - Remove party members from the reserve list ("disabled_for_party")
# - Set party members, who MUST be in the party (shown transparent in the
# current party, "must_be_in_party")
# - option either to wipe the party (for multi-party use) or only remove every
# member (except 1) from the party.
# - Easy to use and easy to switch party members
# - also supports small parties (2 or 3 members) and large parties (5 or more)
#
#
# How to use:
#
# To call this script, make a "Call script" command in an event. The syntax is:
#
# $scene = Scene_PartySwitcher.new
# or
# $scene = Scene_PartySwitcher.new(XXX)
# or
# $scene = Scene_PartySwitcher.new(XXX, 1)
# or
# $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#
# - If you use the first syntax, no extra feature will be applied and you can
# switch the party as you wish.
# - If you use the second syntax, you can replace XXX for 1 to remove all party
# members except one (either one, who must be in the party or a random one), or
# replace XXX with 2, to cause a wipe party. Wiping a party will disable the
# of the current members and a NEW party of the remaining members must be
# formed. If you replace it with 3, the current party configuration will be
# stored for a later fast switch-back.
# - If you use the third sytnax, you can use the XXX as described above or just
# set it to 0 to disable it. Also the "1" in the syntax will reset any
# disabled_for_party and is made to be used after multi-party use.
# - If you use the fourth syntax you can replace ZZZ with 1 to replace the
# party with a stored one AND store the current or replace it with 2 to replace
# the party with a stored one, but without storing the current. USE THIS ONLY
# IF YOU ASSUME TO HAVE A STORED PARTY READY! This syntax will not open the
# Party Switcher and it will override the commands XXX and YYY, so you can
# replace these with any number.
#
# - Character faces go into a "Faces" folder in "Characters" and they have the
# same name as the character spritesets have.
#
#
# Other syntaxes:
# $game_actors[XXX].not_available = true/false
# $game_actors[XXX].disabled_for_party = true/false
# $game_actors[XXX].must_be_in_party = true/false
#
# - not_available will disable the possibility of an already unlocked character
# to be in th current party.
# - disabled for party will cause the character NOT to appear in the party
# switch screen.
# - must_be_in_party will cause the character to be automatically moved into
# the current party, while switching parties and also he cannot be put in the
# reserve.
#
#
# Additional note:
#
# For your own sake, do not apply the attribute "must_be_in_party" to a
# character at the same time with "not_available" or "disabled_for_party" as
# this WILL disrupt your party and party switch system.
#
#==============================================================================

$party_max_size = 4

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available

alias setup_eps_later setup
def setup(actor_id)
@must_be_in_party = false
@disabled_for_party = false
@not_available = false
setup_eps_later(actor_id)
end

end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party

def actors=(actors)
@actors = actors
end

end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base

def draw_actor_face(actor, x, y)
if actor != nil
bitmap = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
cw = 56
ch = 56
src_rect = Rect.new(0, 0, cw, ch)
if actor.not_available or actor.must_be_in_party
self.contents.blt(x, y, bitmap, src_rect, 128)
else
self.contents.blt(x, y, bitmap, src_rect)
end
end
end

end

#==============================================================================
# Window_Current
#==============================================================================

class Window_Current < Window_Selectable

def initialize
if $party_max_size > 4
super(0, 0, 240 + 32, 480)
else
super(0, 0, 240 + 32, $party_max_size * 120)
end
@item_max = $party_max_size
self.contents = Bitmap.new(width - 32, 480 - 32 + (@item_max - 4) * 120)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 15
refresh
self.active = false
self.index = -1
end

def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 0
y = i * 120 - 4
actor = $game_party.actors
self.contents.font.color = normal_color
if actor != nil
draw_actor_face(actor, x, y + 8)
draw_actor_name(actor, x + 160, y)
draw_actor_level(actor, x + 96, y)
draw_actor_hp(actor, x + 96, y + 32)
draw_actor_sp(actor, x + 96, y + 64)
end
end
end

def setactor(index_1, index_2)
temp = $game_party.actors[index_1]
$game_party.actors[index_1] = $game_party.actors[index_2]
$game_party.actors[index_2] = temp
refresh
end

def getactor(index)
return $game_actors[$game_party.actors[index].id]
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = 0
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(x, y, self.width - 32, 88)
end

def clone_cursor
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = 0
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = RPG::Cache.windowskin("Cursor_Current")
self.contents.blt(x, y, bitmap, src_rect, 192)
end

def top_row
return self.oy / 116
end

def top_row=(row)
row = row % row_max
self.oy = row * 120
end

def page_row_max
return (self.height / 120)
end

end

#==============================================================================
# Window_Reserve
#==============================================================================

class Window_Reserve < Window_Selectable

def initialize
super(0, 0, 400 - 32, 320)
setup
@column_max = 3
if (@item_max / @column_max) >= 3
self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96)
else
self.contents = Bitmap.new(width - 32, height - 32)
end
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 15
self.active = false
self.index = -1
refresh
end

def setup
@actors = []
for i in 0...$data_actors.size
flag = false
for j in 0...$game_party.actors.size
if $game_actors == $game_party.actors[j]
flag = true
end
end
if flag == false
unless $game_actors == nil or $game_actors.disabled_for_party
@actors.push($game_actors)
end
end
end
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end

def refresh
self.contents.clear
for i in 0... @actors.size
drawing(@actors, i)
end
end

def drawing(actor, i)
x = (i % 3) * 112 + 16
y = (i / 3) * 96 - 8
self.contents.font.color = normal_color
draw_actor_face(actor, x, y + 18)
end

def getactor(index)
return @actors[index]
end

def setactor(index_1, index_2)
temp = @actors[index_1]
@actors[index_1] = @actors[index_2]
@actors[index_2] = temp
refresh
end

def setparty(index_1, index_2)
temp = @actors[index_1]
@actors[index_1] = $game_party.actors[index_2]
$game_party.actors[index_2] = temp
refresh
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = (@index % @column_max) * 112 + 8
y = (@index / @column_max) * 96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end

def clone_cursor
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = (@index % @column_max) * 112 + 8
y = (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = RPG::Cache.windowskin("Cursor_Reserve")
self.contents.blt(x, y, bitmap, src_rect, 192)
end

def top_row
return self.oy / 96
end

def top_row=(row)
row = row % row_max
self.oy = row * 96
end

def page_row_max
return (self.height - 32) / 96
end

end

#==============================================================================
# Window_HelpStatus
#==============================================================================

class Window_HelpStatus < Window_Base

def initialize(gotactor)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 15
refresh(gotactor)
self.active = false
end

def refresh(actor)
self.contents.clear
if actor != nil
x = 0
y = 0
self.contents.font.color = normal_color
if actor.not_available
self.contents.draw_text(x + 8, y, 160, 32, "not available", 0)
end
draw_actor_face(actor, x, y + 40)
draw_actor_name(actor, x + 160, y + 32)
draw_actor_level(actor, x + 96, y + 32)
draw_actor_hp(actor, x + 96, y + 64)
draw_actor_sp(actor, x + 96, y + 96)
end
end

end

#==============================================================================
# Window_Warning
#==============================================================================

class Window_Warning < Window_Base

def initialize
super(0, 0, 320, 96)
self.visible = false
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 15
self.x = 320 - (width / 2)
self.y = 240 - (height / 2)
self.z = 9999
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 288, 32, "You cannot remove", 1)
self.contents.draw_text(0, 32, 288, 32, "the last party member!", 1)
end

end

#==============================================================================
# Scene_PartySwitcher
#==============================================================================

class Scene_PartySwitcher

def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party = wipe_party
@store = store
@reset = reset
@current_window_temp = 0
@reserve_window_temp = 0
@canceler = false
@temp_window = ""
end

def main
if @store == 0
if @wipe_party == 1
setup_forced_party
elsif @wipe_party == 2
wipe_party
elsif @wipe_party == 3
store_party
wipe_party
end
@current_window = Window_Current.new
@current_window.index = 0
@current_window.active = true
@reserve_window = Window_Reserve.new
@reserve_window.x = 240 + 32
@reserve_window.y = 160
@warning_window = Window_Warning.new
actor = @reserve_window.getactor(0)
@help_window = Window_HelpStatus.new(actor)
@help_window.x = 240 + 32
if @reset == 1
actor.not_available = false
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@current_window.dispose
@reserve_window.dispose
@help_window.dispose
else
swap_parties(@store)
$scene = Scene_Map.new
end
sort_party
$game_player.refresh
Graphics.transition
end

def update
check = @reserve_window.index
if @reserve_window.active
reserve_update
@reserve_window.update
end
if check != @reserve_window.index
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
if @temp_window == "Current" or @temp_window == ""
@help_window.refresh(actor)
end
end
if @current_window.active
current_update
@current_window.update
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @canceler == false
$scene = Scene_Map.new
elsif @canceler == true
@temp_window = ""
@canceler = false
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
if @temp_window == "Current" or @temp_window == ""
@help_window.refresh(actor)
end
@current_window.refresh
@reserve_window.refresh
end
return
end
if Input.trigger?(Input::A)
sort_party
@current_window.refresh
end
end

def current_update
if Input.trigger?(Input::C)
if @canceler == false
$game_system.se_play($data_system.decision_se)
@canceler = true
@temp_actor_index = @current_window.index
@temp_window = "Current"
@current_window.clone_cursor
elsif @canceler == true
switch_members
end
return
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@current_window.active = false
@reserve_window.active = true
@current_window_temp = @current_window.index
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.index = -1
@reserve_window.index = @reserve_window_temp
if @canceler == false
@help_window.refresh(actor)
end
return
end
end

def reserve_update
if Input.trigger?(Input::C)
if @canceler == false
$game_system.se_play($data_system.decision_se)
@canceler = true
@temp_actor_index = @reserve_window.index
@temp_window = "Reserve"
@reserve_window.clone_cursor
elsif @canceler == true
switch_members
end
return
end
if (@reserve_window.index % 3) == 0
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@reserve_window.active = false
@current_window.active = true
@reserve_window_temp = @reserve_window.index
@reserve_window.index = -1
@current_window.index = @current_window_temp
end
return
end
end

def switch_members
if @temp_window == "Reserve" and @reserve_window.active
@reserve_window.setactor(@temp_actor_index, @reserve_window.index)
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
end
if @temp_window == "Current" and @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == "Reserve" and @current_window.active
actor1 = @current_window.getactor(@current_window.index)
actor2 = @reserve_window.getactor(@temp_actor_index)
if call_warning(@current_window.index, actor2)
if actor1 != nil and actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
if actor2 != nil and actor2.not_available
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@temp_actor_index, @current_window.index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window_temp)
@help_window.refresh(actor)
else
warning
end
end
if @temp_window == "Current" and @reserve_window.active
actor1 = @current_window.getactor(@temp_actor_index)
actor2 = @reserve_window.getactor(@reserve_window.index)
if call_warning(@temp_actor_index, actor2)
if actor1 != nil and actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window.index)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
if actor2 != nil and actor2.not_available
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window.index)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@reserve_window.index, @temp_actor_index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
else
warning
end
end
$game_system.se_play($data_system.decision_se)
@canceler = false
@temp_window = ""
return
end

def sort_party
actors = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor != nil
actors.push($game_actors[actor.id])
end
end
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors
if actor != nil
actor.must_be_in_party = false
end
end
end

def wipe_party
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor != nil
actor.not_available = true
end
end
actors = []
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors
if actor != nil and actor.must_be_in_party and not actor.not_available
$game_party.add_actor(actor.id)
end
end
if $game_party.actors.size == 0
for i in 0...$data_actors.size
actor = $game_actors
unless actor == nil or actor.not_available or actor.disabled_for_party
$game_party.add_actor(actor.id)
return
end
end
end
end

def setup_forced_party
actors = []
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors
if actor != nil and actor.must_be_in_party and
not actor.disabled_for_party and not actor.not_available
$game_party.add_actor(actor.id)
end
end
end

def store_party
$stored_party = $game_party.actors
end

def swap_parties(swap)
temp = $game_party.actors
for i in 0...temp.size
if temp != nil
temp.not_available = true
end
end
for i in 0...$stored_party.size
if $stored_party != nil
$stored_party.not_available = false
end
end
$game_party.actors = $stored_party
if swap == 1
$stored_party = temp
else
$stored_party = nil
end
end

def call_warning(index, actor2)
actor1 = $game_party.actors[index]
if actor1 != nil and actor2 == nil
count = 0
for i in $game_party.actors
if i != nil
count += 1
end
end
if count <= 1
return false
end
end
return true
end

def warning
$game_system.se_play($data_system.buzzer_se)
@warning_window.visible = true
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
@warning_window.visible = false
@current_window.refresh
@reserve_window.refresh
break
end
end
return
end

end

#==============================================================================
# ** Trailing Characters
#==============================================================================
# SephirothSpawn
# Version 1
# 2006-05-24
#------------------------------------------------------------------------------
# * Instructions:
#
# ~ Adding Trailing Character:
# <game_character>.add_trailing_character(<name>, <hue>)
#
# ~ Deleting Trailing Character at a index
# <game_character>.delete_trailing_character(<index>)
#
# ~ Delete Last Trailing Character
# <game_character>.pop_trailing_character
#
# ~ Get Last Trailing Character
# <game_character>.last_trailing_character
#
# ~ Get Number of Trailing Characters
# <game_character>.number_of_trailing_characters
#
# * For Events, Replace <game_character> with
# $game_map.events[<event_id>]
#
# * For Player, Replace <game_character> with
# $game_player
#
# ~ Enable or Disable Caterpillar
# $game_player.enable_caterpillar = True (On) or False (Off)
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Trailing Characters', 'SephirothSpawn', 1, '2006-05-24')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Trailing Characters') == true

#==============================================================================
# ** Game_TrailingCharacter
#==============================================================================

class Game_TrailingCharacter < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :trail_number
attr_accessor :character_hue
attr_accessor :character_name
attr_accessor :x, :y, :direction
#--------------------------------------------------------------------------
# * Screen Z
#--------------------------------------------------------------------------
def screen_z(height = 0)
# Get Original Z Value
n = super(height)
# Decrease Z By 1 and return
return n - @trail_number
end
#--------------------------------------------------------------------------
# * Setup Initialization
#--------------------------------------------------------------------------
def setup(parent_character, character_name, character_hue)
# Set X & Y Coordinates
@x, @y = parent_character.x, parent_character.y
@real_x, @real_y = @x * 128, @y * 128
@direction = parent_character.direction
# Sets Character Sprite Information
@character_name = character_name
@character_hue = character_hue
# Turns Through On
@through = true
# If Parent Character is a Trailing Character
if parent_character.is_a?(Game_TrailingCharacter)
# Sets Trailing Number + 1
@trail_number = parent_character.trail_number + 1
else
# Sets 1 to Trailing Number
@trail_number = 1
end
end
#--------------------------------------------------------------------------
# * Delete
#--------------------------------------------------------------------------
def delete
# Return No Trailing Sprite
return if @trailing_character.nil?
# Switch Properties with trailing sprite
@character_name = @trailing_character.character_name
@character_hue = @trailing_character.character_hue
@trail_number = @trailing_character.trail_number
# Delete Trail Sprite
@trailing_character.delete
end
end

#==============================================================================
# ** Game_Character
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# * Trailing Character Movements
#--------------------------------------------------------------------------
Trailing_Character_Movements = [[], [], [], [], []]
Trailing_Character_Movements[0][2] = '@trailing_character.move_right'
Trailing_Character_Movements[1][1] =
'@direction == 2 ? @trailing_character.move_right : @trailing_character.move_down'
Trailing_Character_Movements[1][2] =
'@trailing_character.turn_right unless @trailing_character.direction == 6'
Trailing_Character_Movements[1][3] =
'@direction == 8 ? @trailing_character.move_right : @trailing_character.move_up'
Trailing_Character_Movements[2][0] = '@trailing_character.move_down'
Trailing_Character_Movements[2][1] =
'@trailing_character.turn_down unless @trailing_character.direction == 2'
Trailing_Character_Movements[2][3] =
'@trailing_character.turn_up unless @trailing_character.direction == 8'
Trailing_Character_Movements[2][4] = '@trailing_character.move_up'
Trailing_Character_Movements[3][1] =
'@direction == 2 ? @trailing_character.move_left : @trailing_character.move_down'
Trailing_Character_Movements[3][2] =
'@trailing_character.turn_left unless @trailing_character.direction == 4'
Trailing_Character_Movements[3][3] =
'@direction == 8 ? @trailing_character.move_left : @trailing_character.move_up'
Trailing_Character_Movements[4][2] = '@trailing_character.move_left'
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :trailing_character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_trailingchara_gmchar_init initialize
alias seph_trailingchara_gmchar_update update
alias seph_trailingchara_gmchar_jump jump
alias seph_trailingchara_gmchar_mt moveto
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_trailingchara_gmchar_init
# Create Nil Trailing Character
@trailing_character = nil
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original Frame Update
seph_trailingchara_gmchar_update
# If Trailing Sprite Exist
unless @trailing_character.nil?
# Update Trailing Character
@trailing_character.update
# Update Trailing Character Movements
update_trailing_character_movements
end
end
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
# Original Jump Method
seph_trailingchara_gmchar_jump(x_plus, y_plus)
# Return if No Trailing Character
return if @trailing_character.nil?
# If Jumping
if self.jumping?
x_plus = @x - @trailing_character.x
y_plus = @y - @trailing_character.y
# Jump Trialing Character
@trailing_character.jump(x_plus, y_plus)
end
end
#--------------------------------------------------------------------------
# * Move to Designated Position
#--------------------------------------------------------------------------
def moveto(x, y)
# Original Moveto Method
seph_trailingchara_gmchar_mt(x, y)
# Move Trailing Sprite
unless @trailing_character.nil?
# Move Trailing Character
@trailing_character.moveto(x, y)
end
end
#--------------------------------------------------------------------------
# * Frame Update : Trailing Sprite Movements
#--------------------------------------------------------------------------
def update_trailing_character_movements
# Return if Trailing Character is Moving or Jumping
return if @trailing_character.moving? || @trailing_character.jumping?
# Calculate X & Y Difference
x_diff = @trailing_character.x - @x + 2
y_diff = @trailing_character.y - @y + 2
# Trailing Character Movements
unless Trailing_Character_Movements[x_diff][y_diff].nil?
eval Trailing_Character_Movements[x_diff][y_diff]
end
end
#--------------------------------------------------------------------------
# * Add Trailing Character
#--------------------------------------------------------------------------
def add_trailing_character(name = '', hue = 0)
# Add Trailing Character
if @trailing_character.nil?
@trailing_character = Game_TrailingCharacter.new
@trailing_character.setup(self, name, hue)
# Adds Sprite to Spriteset
if $scene.is_a?(Scene_Map)
$scene.spriteset.add_trailing_character(@trailing_character)
end
# Add Trailing Character to Trailing Sprite
else
@trailing_character.add_trailing_character(name, hue)
end
end
#--------------------------------------------------------------------------
# * Delete Trailing Character
#--------------------------------------------------------------------------
def delete_trailing_character(index = 0)
# Return if No Trailing Character
return if @trailing_character.nil?
# Start Indexing
n = 0
tc = @trailing_character
# Gets Trialing Character Index
while n < index
# Return if No Trailing Character
return if tc.trailing_character.nil?
# Add Index
n += 1
# Get Next Trailing Character
tc = tc.trailing_character
end
# Delete all Trailing Characters
tc.delete
# Pop Last Character
pop_trailing_character
end
#--------------------------------------------------------------------------
# * Pop Trailing Character
#--------------------------------------------------------------------------
def pop_trailing_character
# Return if No Trailing Character
return nil if @trailing_character.nil?
# If Trailing Sprite has a trailing Sprite
if @trailing_character.trailing_character != nil
@trailing_character.pop_trailing_character
# Delete Trailing Character
else
# Remove from Spriteset
$scene.spriteset.pop_trailing_character(@trailing_character)
# Delete Trailing Sprite
@trailing_character = nil
end
end
#--------------------------------------------------------------------------
# * Last Trailing Character
#--------------------------------------------------------------------------
def last_trailing_character
# Return nil if no trailing character
return nil if @trailing_character.nil?
# Fetches Last Character
tc = @trailing_character
until tc.trailing_character.nil?
tc = tc.trailing_character
end
return tc
end
#--------------------------------------------------------------------------
# * Number of Trailing Character
#--------------------------------------------------------------------------
def number_of_trailing_characters
# Returns 0 if no Trailing Character
return 0 if @trailing_character.nil?
# Starts Counter
n = 1
tc = @trailing_character
# Adds to Counter when more Trailing Characters
until tc.trailing_character.nil?
n += 1
tc = tc.trailing_character
end
# Return Counter
return n
end
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :enable_caterpillar
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_catapillar_gmplyr_init initialize
alias seph_catapillar_gmplyr_refresh refresh
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_catapillar_gmplyr_init
# Enables Catapillar
@enable_caterpillar = true
end
#--------------------------------------------------------------------------
# * Enable Caterpiller
#--------------------------------------------------------------------------
def enable_caterpillar=(boolean)
# If Enabling
if boolean
@enable_caterpillar = true
else
# Deletes Party Members
($game_party.actors.size - 1).times do
delete_trailing_character
end
@enable_caterpillar = false
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh
seph_catapillar_gmplyr_refresh
# Delete all Trailing Characters
until number_of_trailing_characters <
(@enable_caterpillar ? $game_party.actors.size : 1)
pop_trailing_character
end
# Return unless Caterpillar Disabled
return unless @enable_caterpillar
# Refreshes Actors
unless @trailing_character.nil?
tc, i = @trailing_character, 0
loop do
i += 1
actor = $game_party.actors
tc.character_name = actor.character_name
tc.character_hue = actor.character_hue
tc.trailing_character.nil? ? break : tc = tc.trailing_character
end
end
# Add Party Characters
for i in (number_of_trailing_characters + 1)...$game_party.actors.size
# Gets Actor
actor = $game_party.actors
# Adds Actor
add_trailing_character(actor.character_name, actor.character_hue)
end
end
#--------------------------------------------------------------------------
# * Pop Trailing Character
#--------------------------------------------------------------------------
def pop_trailing_character
# If Caterpillar Enabled
if @enable_caterpillar
# If No Extra Trailing Characters
return if number_of_trailing_characters < $game_party.actors.size
end
super
end
#--------------------------------------------------------------------------
# * Delete Trailing Character
#--------------------------------------------------------------------------
def delete_trailing_character(index = 0)
# If Caterpillar Enabled
if @enable_caterpillar
# Return if trying to delete a party member
return if (index + 1) < $game_party.actors.size
end
super(index)
end
end

#==============================================================================
# ** Spriteset_Map
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_trailingchara_ssetm_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_trailingchara_ssetm_init
# Adds Trailing Characters (Player)
unless $game_player.trailing_character.nil?
trailing_character = $game_player.trailing_character
add_trailing_character(trailing_character)
until trailing_character.trailing_character.nil?
trailing_character = trailing_character.trailing_character
add_trailing_character(trailing_character)
end
end
# Adds Trailing Characters (Events)
for event in $game_map.events.values
unless event.trailing_character.nil?
trailing_character = event.trailing_character
add_trailing_character(trailing_character)
until trailing_character.trailing_character.nil?
trailing_character = trailing_character.trailing_character
add_trailing_character(trailing_character)
end
end
end
end
#--------------------------------------------------------------------------
# * Add Trailing Character
#--------------------------------------------------------------------------
def add_trailing_character(character = nil)
# Return if nil Character
return if character.nil?
# Adds Character Sprite
@character_sprites.push(Sprite_Character.new(@viewport1, character))
end
#--------------------------------------------------------------------------
# * Pop Trailing Character
#--------------------------------------------------------------------------
def pop_trailing_character(character)
# Return if nil character
return if character.nil?
# Passes through all Character Sprites
for sprite in @character_sprites
# Pops Sprites Character
if sprite.character == character
# Disposes Sprite
sprite.dispose
# Deletes from Character Sprites
@character_sprites.delete(sprite)
return
end
end
end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
attr_accessor :spriteset
end


#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end


Thanks in advance! :lol:
 
>>bumps<<

is this not possible? :O

::Edited::
what the bleep! Now it works together O_O. but then if there are less than 4 people in party, it start giving out errors again :(
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top