Guest Access
Go to page : 1, 2, 3
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
Yo Drago, is this for the stop character animation?
I'm still wrenching on the site but this may take a small edit or placing above cog's extra animation script but it sounds like you got it working.
I will have to check this out.
I'm still wrenching on the site but this may take a small edit or placing above cog's extra animation script but it sounds like you got it working.
I will have to check this out.
Administrator
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
I'm still not finished though...
It still not cross engined
It still not cross engined
Active Member
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
making this compatible with VX and XAS at the same time is quite a pain, I think I should give up on cross enginering it
- Spoiler:
- Code:
################################################################################
#※※※※※※※====== XAS CATERPILLAR script V1.1 by gameface101 2-4-2011 ======※※※※※※※
#based off of Fukuyama's original train_actor *free to use and must give credit
#
# ------edited
################################################################################
module XAS_CAT
#-----------------------------------------------------------------------------
# When TRANSPARENT_SWITCHES_INDEX is not nil,
# transparency will be activated if the switch of this number is on
TRANSPARENT_SWITCHES_INDEX = 3 # nil
# WARNING = A bit of LAGG
#-----------------------------------------------------------------------------
# Maximum actors in your party
XCAT_ACTORS_SIZE_MAX = 4
#-----------------------------------------------------------------------------
# Put any actor IDs who should have a "stopped animation" if in the caterpillar
# i.e. if a party member "is floating" it will look stupid if he suddenly stops
ACTOR_IDS = []#[2, 3, 4]
# NOT WORKING !! (JUST USE XRXS - ANIMATED CHAR INSTEAD)
#-----------------------------------------------------------------------------
# Party can go through a wall?
PARTY_THROUGH = false
#-----------------------------------------------------------------------------
end
#==============================================================================
# ■ Spriteset_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
module Spriteset_Map_Module
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if !setup_actor_character_sprites?
for character in characters.reverse
@character_sprites.unshift(
Sprite_Character.new(@viewport1, character)
)
end
@setup_actor_character_sprites_flag = true
end
end
end
end
#==============================================================================
# ■ Scene_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
module Scene_Map_Module
def setup_actor_character_sprites(characters)
@old_id = characters
@spriteset.setup_actor_character_sprites(characters)
end
end
end
module Kernel
if !defined? rpgvx?
def rpgvx?
return true if defined? Graphics.resize_screen
return false
end
end
end
#==============================================================================
# ■ Game_Party_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 10
TOWARD_PLAYER = 11
module Game_Party_Module
attr_reader :characters
def update_party_order() return actors end
def setup_actor_character_sprites
if @characters.nil?
@characters = []
for i in 1 ... XCAT_ACTORS_SIZE_MAX
@characters.push(Game_Party_Actor.new)
end
end
setup_actors = update_party_order
for i in 1 ... XCAT_ACTORS_SIZE_MAX
@characters[i - 1].setup(setup_actors[i])
end
if $scene.class.method_defined?('setup_actor_character_sprites')
$scene.setup_actor_character_sprites(@characters)
end
end
def member
return @characters
end
def update_party_actors
update_party_order
setup_actor_character_sprites
transparent = $game_player.transparent
if $XRXS_BreakActs and
!$game_player.character_name.upcase.include?(XRXS_BreakActs::SUFFIX)
$game_player.step_anime = false
end
if transparent == false and TRANSPARENT_SWITCHES_INDEX != nil
transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
for character in @characters
character.transparent = transparent
character.move_speed = $game_player.move_speed
if ACTOR_IDS.include?(character.id) #for stopped animation
character.step_anime = true #for stopped animation
else #stopped animation
if $XRXS_BreakActs and
character.character_name.upcase.include?(XRXS_BreakActs::SUFFIX)
character.step_anime = true
else
character.step_anime = false
end
end #for stopped animation
character.update
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
@move_list = [] if @move_list == nil
move_list_setup
end
def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if @characters[i] != nil
case @move_list[i].type
when Input::DOWN then @characters[i].move_down(@move_list[i].args[0])
when Input::LEFT then @characters[i].move_left(@move_list[i].args[0])
when Input::RIGHT then @characters[i].move_right(@move_list[i].args[0])
when Input::UP then @characters[i].move_up(@move_list[i].args[0])
when DOWN_LEFT then @characters[i].move_lower_left
when DOWN_RIGHT then @characters[i].move_lower_right
when UP_LEFT then @characters[i].move_upper_left
when UP_RIGHT then @characters[i].move_upper_right
when JUMP then @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
when TOWARD_PLAYER then @characters[i].move_toward_player
end
end
end
end
class Move_List_Element
def initialize(type,args)
@type = type
@args = args
end
def type() return @type end
def args() return @args end
end
def move_list_setup
for i in 0 .. XCAT_ACTORS_SIZE_MAX
@move_list[i] = nil
end
end
def add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
def move_toward_player_party_actors(turn_enabled = true)
move_party_actors
add_move_list(TOWARD_PLAYER,turn_enabled)
end
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
end
#----------------------NOT IMPORTANT CODE-----------------------------
def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end
def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end
def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end
def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end
def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end
def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end
def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end
def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end
#-------------------------------------------------------------------
end
end
#==============================================================================
# ■ Game_Player_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
module Game_Player_Module
attr_reader :move_speed
attr_reader :step_anime
def update
if TRANSPARENT_SWITCHES_INDEX == nil or
(TRANSPARENT_SWITCHES_INDEX != nil and
not $game_switches[TRANSPARENT_SWITCHES_INDEX])
$game_party.update_party_actors
$game_party.move_toward_player_party_actors
end
super
end
def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end
def jump(x_plus, y_plus)
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end
end
end
#==============================================================================
# ■ Game_Event_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
module Game_Event_Module
def passable?(x, y, d)
result = super(x, y, d)
if result
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
for actor in $game_party.characters
if not actor.character_name.empty?
if actor.x == new_x and actor.y == new_y
return false if self != $game_player
end
end
end
end
return result
end
end
end
#==============================================================================
# ■ Game_Party_Actor
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================
module XAS_CAT
class Game_Party_Actor < Game_Character
if $XRXS_BreakActs
include XRXS_BreakActs
end
attr_reader :cp_id
attr_writer :move_speed
attr_writer :step_anime
def initialize
super()
end
def step_anime
return @step_anime
end
def name
return @actor.name
end
def battler
return $game_actors[@cp_id]#0
end
def hp
return $game_actors[@cp_id].hp if !@cp_id.nil?
end
def dead?
return self.battler == nil ? false : self.battler.dead?
end
def setup(actor)
@cp_id = $data_actors[actor.id].id
@actor = $game_actors[@cp_id]
if actor != nil
@character_name = @actor.character_name
@character_hue = @actor.character_hue
else
@character_name = ""
@character_hue = 0
end
if $xrxs_xas
update_fall
update_blink if !@fall
end
if @actor.hp == 0 or
(TRANSPARENT_SWITCHES_INDEX != nil and
$game_switches[TRANSPARENT_SWITCHES_INDEX])
@opacity = 0
@blend_type = 0
elsif @actor.hp > 0
@opacity = 255 if !@fall
@blend_type = 0
end
@walk_anime = true
@direction_fix = false
end
def return_to_position
@animation_id = XAS::FALL_ANIMATION_ID
@pre_opacity = @opacity
@opacity = 0
@fall = true
@fall_time = XAS::FALL_TIME + 10
end
def update_fall
if @fall_time > 0
@fall_time -= 1
return if @fall_time > 0
self.moveto($game_player.x,$game_player.y)
self.animation_id = XAS::FALL_ANIMATION_ID2
@fall = false
@blink_duration = 40
end
end
def update_blink
return if @blink_duration == 0
@blink_duration -= 1
ex = rand(3)
@opacity = 100 + (ex * 50)
@opacity = @pre_opacity if @blink_duration == 0
end
def controllable?
return false if @actor == nil
return false if moving?
return false if @move_route_forcing or $game_temp.message_window_showing
return false if $game_system.map_interpreter.running?
return false if self.action != nil
return false if @character_name != @actor.character_name
return false if terrain_tag == XAS::FALL_TERRAIN
return true
end
def screen_z(height = 0)
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z(height) - 1
end
super(height)
end
def move_down(turn_enabled = true)
turn_down if turn_enabled
if passable?(@x, @y, 2)
turn_down
@y += 1
end
end
def move_left(turn_enabled = true)
turn_left if turn_enabled
if passable?(@x, @y, 4)
turn_left
@x -= 1
end
end
def move_right(turn_enabled = true)
turn_right if turn_enabled
if passable?(@x, @y, 6)
turn_right
@x += 1
end
end
def move_up(turn_enabled = true)
turn_up if turn_enabled
if passable?(@x, @y, 8)
turn_up
@y -= 1
end
end
def move_lower_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
@x -= 1
@y += 1
end
end
def move_lower_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
@x += 1
@y += 1
end
end
def move_upper_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
@x -= 1
@y -= 1
end
end
def move_upper_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
if ((passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8)))
@x += 1
@y -= 1
end
end
def move_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
i = $game_actors[@cp_id].index.to_i
if (sx == 0 and sy == 0)
return back_fall? ? move_forward : move_backward
elsif (sx <= i and sy <= i) and (sx >= -i and sy >= -i)
return turn_toward_player
end
return if $xrxs_xas and (terrain_tag == XAS::SLIP_TERRAIN or
terrain_tag == XAS::FALL_TERRAIN)
abs_sx, abs_sy = sx.abs, sy.abs
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1 if abs_sx == abs_sy
if abs_sx
if sx < 0 and sy > 0 then move_upper_right
elsif sx > 0 and sy > 0 then move_upper_left
elsif sx > 0 and sy < 0 then move_lower_left
elsif sx < 0 and sy < 0 then move_lower_right
elsif sx < 0 then move_right
elsif sx > 0 then move_left
elsif sy > 0 then move_up
elsif sy < 0 then move_down
end
end
end
def back_fall?
case @direction
when 2 then new_x, new_y = @x, @y-1
when 4 then new_x, new_y = @x+1, @y
when 6 then new_x, new_y = @x-1, @y
when 8 then new_x, new_y = @x, @y+1
end
tera = $game_map.terrain_tag(new_x, new_y)
if !$game_map.passable?(new_x, new_y, @direction) then return true
else
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if event.character_name != "" then return true end
end
end
end
end
return false if !$xrxs_xas
return (tera == XAS::SLIP_TERRAIN or tera == XAS::FALL_TERRAIN)
end
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return false unless $game_map.valid?(new_x, new_y)
if @through then return true if PARTY_THROUGH end
return false unless $game_map.passable?(x, y, d, self)
return false unless $game_map.passable?(new_x, new_y, 10 - d)
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if self != $game_player then return false end
if event.character_name != "" then return false end
end
end
end
if @x == new_x and @y == new_y
unless @through
if @character_name != "" then return false end
end
end
return true
end
end
end
class Game_Party
include XAS_CAT::Game_Party_Module
end
class Game_Player
include XAS_CAT::Game_Player_Module
end
class Game_Event
include XAS_CAT::Game_Event_Module
end
class Spriteset_Map
include XAS_CAT::Spriteset_Map_Module
end
class Scene_Map
include XAS_CAT::Scene_Map_Module
end
$xas_caterpillar = true
Active Member
Show Signature
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
I can imagine, can't wait to try your latest edit..
once I'm done with this HTML, I'll get back to RGSS
having a fully functional caterpillar and leader switch for XAS that allows combos based upon your party would be awesome to have...
once I'm done with this HTML, I'll get back to RGSS
having a fully functional caterpillar and leader switch for XAS that allows combos based upon your party would be awesome to have...
Administrator
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
forgot to mention, there is a bug
if you use hookshot when your character position is same as one of your party, the game will freeze
if you use hookshot when your character position is same as one of your party, the game will freeze
Active Member
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
I need someone to edit this to fit with xas
to test it
$game_party.caterpillar(true/false)
btw, this forum is so laggy on computer with low bandwith :swt:
- Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# [Xp] Caterpillar
# Version: 1.00
# Author : LiTTleDRAgo
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
module Caterpillar
ACTOR_MAX_PARTY = 4
PARTY_SPEED = 4
end
#------------------------------------------------------------------------------
# SDK Check
#------------------------------------------------------------------------------
if Object.const_defined?('SDK')
SDK.log('Caterpillar', 'LiTTleDRAgo', 2, '22.06.11')
@drg_caterpillar_disabled = !SDK.enabled?('Caterpillar')
end
if !@drg_caterpillar_disabled
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias cater_game_map_setup setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(map_id)
cater_game_map_setup(map_id)
setup_caterpillar
end
#--------------------------------------------------------------------------
# * Setup Train Actors
#--------------------------------------------------------------------------
def setup_caterpillar
map_event = RPG::Event.new(0, 0)
size = (2000+Caterpillar::ACTOR_MAX_PARTY)-1
for i in 2001..size
map_event.id = i
@events[i] = Game_Event.new(0, map_event)
@events[i].move_speed = Caterpillar::PARTY_SPEED
@events[i].move_frequency = 6
@events[i].follow_event_id = 0
@events[i].uncensor = true
end
$game_party.caterpillar($game_party.caterpillar_visible)
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :caterpillar_visible
#--------------------------------------------------------------------------
# * Train Actors
#--------------------------------------------------------------------------
def caterpillar(visible)
@caterpillar_visible = visible.nil? ? false : visible
size = (2000+Caterpillar::ACTOR_MAX_PARTY)-1
for i in 2001..size
actor = $game_party.actors[i-2000]
next if $game_map.events[i].nil?
if $game_party.caterpillar_visible and actor
$game_map.events[i].move_type = 5
$game_map.events[i].moveto($game_player.x,$game_player.y)
$game_map.events[i].character_name = actor.character_name
$game_map.events[i].character_hue = actor.character_hue
else $game_map.events[i].move_type = 4
end
end
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < Caterpillar::ACTOR_MAX_PARTY && !@actors.include?(actor)
@actors.push(actor)
$game_player.refresh
end
end
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character_name,:character_hue,
:through, :move_speed, :move_frequency, :move_type,
:follow_event_id, :uncensor,
:x2, :y2
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias init_cater_fusion initialize
alias update_cater_fusion update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
init_cater_fusion
setup_caterpillar
end
#--------------------------------------------------------------------------
# * Setup Caterpillar
#--------------------------------------------------------------------------
def setup_caterpillar
@follow_event_id = 0
@x2 = @y2 = 0
end
#--------------------------------------------------------------------------
# * Fusion with Event
#--------------------------------------------------------------------------
def move_type_fusion_with_event
event = (@follow_event_id == 0) ? $game_player : $game_map.events[@follow_event_id]
return unless event
@x, @y, @x2, @y2 = event.x, event.y, event.x2, event.y2
unless @character_name.empty?
sx, sy = (@real_x - event.real_x).abs, (@real_y - event.real_y).abs
speed = 7
if Math.hypot(sx, sy) < 2**speed * 2
self.character_name = "" if sx == 0 && sy == 0
else turn_toward_event(@follow_event_id)
end
else# @real_x, @real_y = @x2, @y2
end
end
#--------------------------------------------------------------------------
# * Move to Party Leader
#--------------------------------------------------------------------------
def move_type_to_leader
sx, sy = (@x - $game_player.x), (@y - $game_player.y)
return if $xrxs_xas && self.throw_active
return (sx == 0 && sy == 0) ? move_random : move_toward_player
turn_toward_event if (sx <= 1 && sx >= -1) && (sy <= 1 && sy >= -1)
method_defined?(:move_to_me) ? move_to_me :
unless moving? || @direction_fix
x = @direction == 4 ? -1 : @direction == 6 ? 1 : 0
y = @direction == 2 ? 1 : @direction == 8 ? -1 : 0
passable?(@x+x, @y+y, @direction) && !(x == 0 && y == 0) ? jump(x*2,y*2) :
move_toward_player
end
@wait_count = 30 * 2 - 1 if !moving?
end
#--------------------------------------------------------------------------
# * Turn Toward Event
#--------------------------------------------------------------------------
$noupperleft = true if !method_defined?(:turn_upper_left)
def turn_toward_event(event_id = 0)
event = (event_id == 0) ? $game_player : $game_map.events[event_id]
return unless event
sx, sy = @x - event.x, @y - event.y
return if sx == 0 and sy == 0
if sx.abs == sy.abs
return if $noupperleft
sy > 0 ? (sx > 0 ? turn_upper_left : turn_upper_right) :
(sx > 0 ? turn_lower_left : turn_lower_right)
else
sx.abs > sy.abs ? (sx > 0 ? turn_left : turn_right) :
(sy > 0 ? turn_up : turn_down)
end
end
#--------------------------------------------------------------------------
# * Turn Away From Event
#--------------------------------------------------------------------------
def turn_away_from_event(event_id = 0)
event = (event_id == 0) ? $game_player : $game_map.events[event_id]
return unless event
sx, sy = @x - event.x, @y - event.y
return if sx == 0 and sy == 0
if sx.abs == sy.abs
return if $noupperleft
sy > 0 ? (sx > 0 ? turn_lower_right : turn_lower_left) :
(sx > 0 ? turn_upper_right : turn_upper_left)
else
sx.abs > sy.abs ? (sx > 0 ? turn_right : turn_left) :
(sy > 0 ? turn_down : turn_up)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_cater_fusion
return if @wait_count > 0 or @move_route_forcing or @starting or lock?
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 4 then move_type_fusion_with_event
when 5 then move_type_to_leader
end
end
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias cater_game_player_moveto moveto
alias cater_game_player_refresh refresh
alias passable_cater passable?
#--------------------------------------------------------------------------
# * Moveto
#--------------------------------------------------------------------------
def moveto(x, y)
cater_game_player_moveto(x, y)
size = (2000+Caterpillar::ACTOR_MAX_PARTY)-1
(2001..size).each {|i| $game_map.events[i].moveto(x, y)}
end
#--------------------------------------------------------------------------
# * Move to Designated Position
# x : x-coordinate
# y : y-coordinate
#--------------------------------------------------------------------------
def originmoveto(x, y)
@x,@y = x % $game_map.width, y % $game_map.height
@real_x,@real_y = @x * 128, @y * 128
@prelock_direction = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
cater_game_player_refresh
self.character_name = @character_name
$game_party.caterpillar($game_party.caterpillar_visible)
end
#--------------------------------------------------------------------------
# * Passable
#--------------------------------------------------------------------------
def passablecater?(x, y, d)
result = passable_cater(x,y,d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return true if $xrxs_xas && self.is_a?(Game_Player) && $game_system.fly
return false unless $game_map.valid?(new_x, new_y)
return result if @through
return false unless $game_map.passable?(x, y, d, self) &&
$game_map.passable?(new_x, new_y, 10 - d)
$game_map.events.each_value {|event|
if event.x == new_x && event.y == new_y
unless event.through
return true if event.name =~ /<Tembus>/i or
event.id > 2000
return false if self != $game_player
return false if event.character_name != ""
end
end }
if $game_player.x == new_x and $game_player.y == new_y
unless $game_player.through
return false if @character_name != ""
end
end
return result
end
#--------------------------------------------------------------------------
# * Passable
#--------------------------------------------------------------------------
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return true if $DEBUG and Input.press?(Input::CTRL)
return false unless $game_map.valid?(new_x, new_y)
return passablecater?(x, y, d)
end
end
#===============================================================================
# ■ Patch for XAS
#===============================================================================
if $xrxs_xas
module XRXS_EnemySensor
#--------------------------------------------------------------------------
# ● Update Sensor
#--------------------------------------------------------------------------
alias update_sensor_uncensor update_sensor
def update_sensor
update_sensor_uncensor if !self.uncensor
end
end
end
#--------------------------------------------------------------------------
# SDK Check End
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# END OF SCRIPT
#--------------------------------------------------------------------------
to test it
$game_party.caterpillar(true/false)
btw, this forum is so laggy on computer with low bandwith :swt:
Active Member
Show Signature
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
O.o what's this? You made a newer version!?
maybe I can test this in the newer X-plat?
I would like to include the leader switch and caterpillar like in the old one.
more and more methods...
yeah, it could also be the host Forumotion, I use multiple pcz to test this site:
my netbook with good bandwidth and low processing can be laggy for anything video / flash
my desktop low bandwidth and high processing
just browsing can be choppy
my tower high bandwidth and high processing
runs like a charm ^,^
most of the time it's fine, but there are times where it's choppy like a mofo..
I've started a simple site, maybe I'll add more to it...? http://gameface101.playogame.com/h1-g101
ok, I hope to get a solid working version for X3.91 even when XAS4 comes out with the Ally System, I'll still be making projects with XAS3.91
maybe I can test this in the newer X-plat?
I would like to include the leader switch and caterpillar like in the old one.
more and more methods...
yeah, it could also be the host Forumotion, I use multiple pcz to test this site:
my netbook with good bandwidth and low processing can be laggy for anything video / flash
my desktop low bandwidth and high processing
just browsing can be choppy
my tower high bandwidth and high processing
runs like a charm ^,^
most of the time it's fine, but there are times where it's choppy like a mofo..
I've started a simple site, maybe I'll add more to it...? http://gameface101.playogame.com/h1-g101
ok, I hope to get a solid working version for X3.91 even when XAS4 comes out with the Ally System, I'll still be making projects with XAS3.91
Administrator
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
there are problems that I haven't fix,
1. if the actor dies the caterpillar still following the player as if nothing happened
2. when use leader switch, the position didn't swap
3. when party member fall, they didn't return
1. if the actor dies the caterpillar still following the player as if nothing happened
2. when use leader switch, the position didn't swap
3. when party member fall, they didn't return
Active Member
Show Signature
Active Member
Active Member
Active Member
profile
LiTTleDRAgo
profile
Here is another caterpillar script
ripped and modified from tons of addons to fit xas
credit to blizzard
ripped and modified from tons of addons to fit xas
credit to blizzard
- Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Caterpillar by Blizzard
# Version: 2.2b
# Type: Game Experience Improvement
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 93% compatible with SDK v1.x. 60% compatible with SDK v2.x. You might
# experience problems with pixel movement scripts or map graphic manipulating
# scripts. Blizz-ABS disables this add-on automatically and uses the
# Blizz-ABS Caterpillar system.
#
#
# Features:
#
# - your party members follow you on the map
# - less code than other caterpillar scripts
# - use $game_player.update_buffer('reset') if you need all party members to
# gather around the player
#
# To disable/enable = $game_system.CATERPILLAR = true/false
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# max number of party members
MAX_PARTY = 4
# actor IDs where the actor is animated even when not walking
ANIMATED_IDS = []
# 0 - shows all characters; 1 - shows "ghosts"; 2 - removes from caterpillar
DEAD_DISPLAY = 1
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
alias passable_caterpillar_later? passable?
def passable?(x, y, d)
result = passable_caterpillar_later?(x, y, d)
return result if $BlizzABS && BlizzABS::VERSION >= 1.01
return result if self.is_a?(Game_Player) || self.is_a?(Game_Member)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
unless @through
$game_player.members.each {|member|
if member.character_name != '' && member.x == new_x && member.y == new_y
return false
end}
end
return result
end
end
#==============================================================================
# Game_Player
#==============================================================================
class Game_Player
attr_reader :members
attr_reader :move_speed
alias init_caterpillar_later initialize
def initialize
init_caterpillar_later
@members = []
(1...MAX_PARTY).each {|i| @members.push(Game_Member.new(i))} unless $BlizzABS
end
alias upd_caterpillar_later update
def update
upd_caterpillar_later
refresh if DEAD_DISPLAY > 0
@members.each {|member| member.update}
if ANIMATED_IDS.include?(actor.id)
@step_anime = true
end
end
alias straighten_caterpillar_later straighten
def straighten
straighten_caterpillar_later
@members.each {|member| member.straighten}
end
alias refresh_caterpillar refresh
def refresh
unless $game_system.CATERPILLAR
refresh_caterpillar
return
end
act, $game_party.actors[0] = $game_party.actors[0], actor
$game_party.actors.pop if $game_party.actors[0] == nil
refresh_caterpillar
return if actor == nil
$game_party.actors[0] = act
if actor.dead? && DEAD_DISPLAY == 1
@opacity = Graphics.frame_count % 4 / 2 * 255
@blend_type = 1
end
end
def actor
if DEAD_DISPLAY > 0
$game_party.actors.each {|actor| return actor unless actor.dead?}
end
return $game_party.actors[0]
end
def update_buffer(next_move)
if next_move == nil
@members.each {|member| member.buffer = []}
else
@members.each {|member| member.update_buffer(
next_move == 'reset' ? nil : next_move)}
end
end
alias move_down_caterpillar_later move_down
def move_down(turn_enabled = true)
update_buffer(2) if passable?(@x, @y, 2)
move_down_caterpillar_later
end
alias move_left_caterpillar_later move_left
def move_left(turn_enabled = true)
update_buffer(4) if passable?(@x, @y, 4)
move_left_caterpillar_later
end
alias move_right_caterpillar_later move_right
def move_right(turn_enabled = true)
update_buffer(6) if passable?(@x, @y, 6)
move_right_caterpillar_later
end
alias move_up_caterpillar_later move_up
def move_up(turn_enabled = true)
update_buffer(8) if passable?(@x, @y, 8)
move_up_caterpillar_later
end
alias move_lower_left_caterpillar_later move_lower_left
def move_lower_left
if passable?(@x, @y, 2) && passable?(@x, @y + 1, 4) ||
passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)
update_buffer(1)
end
move_lower_left_caterpillar_later
end
alias move_lower_right_caterpillar_later move_lower_right
def move_lower_right
if passable?(@x, @y, 2) && passable?(@x, @y + 1, 6) ||
passable?(@x, @y, 6) && passable?(@x + 1, @y, 2)
update_buffer(3)
end
move_lower_right_caterpillar_later
end
alias move_upper_left_caterpillar_later move_upper_left
def move_upper_left
if passable?(@x, @y, 8) && passable?(@x, @y - 1, 4) ||
passable?(@x, @y, 4) && passable?(@x - 1, @y, 8)
update_buffer(7)
end
move_upper_left_caterpillar_later
end
alias move_upper_right_caterpillar_later move_upper_right
def move_upper_right
if passable?(@x, @y, 8) && passable?(@x, @y - 1, 6) ||
passable?(@x, @y, 6) && passable?(@x + 1, @y, 8)
update_buffer(9)
end
move_upper_right_caterpillar_later
end
alias jump_caterpillar_later jump
def jump(x_plus, y_plus)
if (x_plus != 0 || y_plus != 0) && passable?(@x + x_plus, @y + y_plus, 0)
update_buffer([x_plus, y_plus])
end
jump_caterpillar_later(x_plus, y_plus)
end
alias moveto_caterpillar moveto
def moveto(x, y)
update_buffer(nil)
moveto_caterpillar(x, y)
@members.each {|member|
member.moveto(x, y)
case @direction
when 2 then member.turn_down
when 4 then member.turn_left
when 6 then member.turn_right
when 8 then member.turn_up
end}
end
end
#==============================================================================
# Game_Member
#==============================================================================
class Game_Member < Game_Character
attr_accessor :buffer
attr_reader :battler
def dead?
return actor != nil ? actor.dead? : false
end
def initialize(index)
super()
@index, @force_movement, @buffer, @through = index, 0, [], true
end
def refresh
unless $game_system.CATERPILLAR && actor != nil
@character_name, @character_hue = '', 0
return
end
@character_name = actor.character_name
@character_hue = actor.character_hue
if actor.dead? && DEAD_DISPLAY == 1
@opacity, @blend_type = Graphics.frame_count % 4 / 2 * 255, 1
else
@opacity, @blend_type = 255, 0
end
end
def actor
case DEAD_DISPLAY
when 0 then return $game_party.actors[@index]
when 1
alive = 0
$game_party.actors.each {|actor| alive += 1 unless actor.dead?}
if @index >= alive
ind, flag = @index - alive, true
else
ind, flag = @index, false
end
$game_party.actors.each_index {|i|
ind -= 1 if (flag == $game_party.actors[i].dead?)
return $game_party.actors[i] if ind < 0}
when 2
ind = @index
$game_party.actors.each_index {|i|
ind -= 1 unless $game_party.actors[i].dead?
return $game_party.actors[i] if ind < 0}
end
return nil
end
def update
refresh
@transparent = $game_player.transparent
@move_speed = $game_player.move_speed
unless moving? || @buffer.size <= @index && @force_movement <= 0
if @buffer.size > 0
move = @buffer.shift
if move.is_a?(Array)
jump(move[0], move[1])
else
case move
when 1 then move_lower_left
when 2 then move_down(true)
when 3 then move_lower_right
when 4 then move_left(true)
when 6 then move_right(true)
when 7 then move_upper_left
when 8 then move_up(true)
when 9 then move_upper_right
end
end
@force_movement -= 1 if @force_movement > 0
end
end
super
@step_anime = (ANIMATED_IDS.include?($game_party.actors[@index].id))
end
def update_buffer(next_move)
if next_move == nil
@force_movement = @buffer.size
else
@buffer.push(next_move)
@force_movement = @buffer.size if next_move.is_a?(Array)
end
end
def check_event_trigger_touch(x, y) # don't remove this, it's necessary...
end
def screen_z(height = 0)
return (super - @index)
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
alias init_caterpillar_later initialize
def initialize
init_caterpillar_later
return if $BlizzABS && BlizzABS::VERSION >= 1.01
$game_player.members.each {|member|
sprite = Sprite_Character.new(@viewport1, member)
sprite.update
@character_sprites.push(sprite)}
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias transfer_player_caterpillar_later transfer_player
def transfer_player
transfer_player_caterpillar_later
return if $BlizzABS
case $game_temp.player_new_direction
when 2 then $game_player.members.each {|member| member.turn_down}
when 4 then $game_player.members.each {|member| member.turn_left}
when 6 then $game_player.members.each {|member| member.turn_right}
when 8 then $game_player.members.each {|member| member.turn_up}
end
end
end
class Game_System
attr_accessor :CATERPILLAR
alias init_system_cater initialize
def initialize
init_system_cater
@CATERPILLAR = true
end
end
Active Member
Show Signature
Active Member
Active Member
Active Member
profile
kimono
profile
Hello G@mef@ce,
The script works perfectly, I suggest some minor improvement if you want to add this:
- the followers can use the _ANI graphic when they don't move.
- the script may add a "one step tower Hero" command rather than be stupidly stuck behind the hero.
Great script with Switch Leader, thanks for release it for XAS 3.91!
The script works perfectly, I suggest some minor improvement if you want to add this:
- the followers can use the _ANI graphic when they don't move.
- the script may add a "one step tower Hero" command rather than be stupidly stuck behind the hero.
Great script with Switch Leader, thanks for release it for XAS 3.91!
Active Member
Show Signature
Active Member
Go to page : 1, 2, 3
GAMEFACE101 » MEDIA » PLAY with CODE! » PLAY with CODE (scripts and software) » RGSS (RMXP SCRIPTS) »RMXP + XAS = CATERPILLAR!
Similar topics