Detailed Description:
Rataime's shadow script is a nice addition to me game, however the catepillar script which is intergrated is somewhat problematic in cutscenes. The only way so far I've gotten it to work graphicly, is by removing a party member and adding them after the cutscene, but all their crap re-sets (level, what's equipped, etc.).
Here's the scripts (I didn't know which one had it, or affected it. SO I listed them all. Sorry guys. :P)
Dynamic Shadows:
Sun Effect
Mirror effect
Reflection Effect
Passability Tool
Train_actor (I think this is the catepillar script.)
Also, I've got the Script SDK.
To make this clear, I'm seeking a way to etheir temporarily remove x party member from the catepillar script temporarily, or a way for the equipment changes to be fixed.
Rataime's shadow script is a nice addition to me game, however the catepillar script which is intergrated is somewhat problematic in cutscenes. The only way so far I've gotten it to work graphicly, is by removing a party member and adding them after the cutscene, but all their crap re-sets (level, what's equipped, etc.).
Here's the scripts (I didn't know which one had it, or affected it. SO I listed them all. Sorry guys. :P)
Dynamic Shadows:
Code:
#==============================================================================
# ** Dynamic Shadows
#------------------------------------------------------------------------------
# Rataime
# Version 4.0
# 06/05/2007 (2007-05-06)
# Version 1.0 was based on Genzai Kawakami's shadows, extra features Boushy
#==============================================================================
#==============================================================================
# Here's the brand new free configuration feature
# The comments will be compared to the pattern using Regexp, except that I did
# the entire work for you, so you don't have to know regexps at all.
# Just choose the trigger ('s', 'begin shadow' or whatever), and the pattern
# The pattern can be one line or a list to use multiple comment lines.
# arg1 is the minimum angle
# arg2 is the maximum angle
# arg3 is the maximum distance
# The only thing you must do is using 'trigger' before the arguments
# Examples :
#
# SHADOWS_SOURCE_COMMENT_TRIGGER = 's'
# SHADOWS_SOURCE_COMMENT_PATTERN = ['trigger','arg1','arg2','arg3']
# SHADOWS_CHAR_COMMENT_TRIGGER = 'o'
# SHADOWS_CHAR_COMMENT_PATTERN = 'trigger'
# is the old way to use shadows, with a single 's' in the first line, and the
# arguments in following lines
#
# SHADOWS_SOURCE_COMMENT_TRIGGER = 'begin shadow source'
# SHADOWS_SOURCE_COMMENT_PATTERN =
# ['trigger','anglemin arg1','anglemax arg2','distancemax arg3']
# SHADOWS_CHAR_COMMENT_TRIGGER = 'begin shadow'
# SHADOWS_CHAR_COMMENT_PATTERN = 'trigger'
# will work with :
# Comment "begin shadow source"
# Comment "anglemin 0"
# Comment "anglemax 0"
# Comment "distancemax 250"
#
# Take the time to choose something you like, and something compatible with other
# scripts.
# Note that the comments will be detected even if they aren't in the beginning
# of the event's action list. Ah, and you can switch the arguments if you like
#==============================================================================
#==============================================================================
# Here is the method I like best, because of its compatibility with other
# scripts. But don't hesitate to change it.
# It will react to something like Shadow|0|0|250
#==============================================================================
SHADOWS_SOURCE_COMMENT_TRIGGER = 'Shadow'
SHADOWS_SOURCE_COMMENT_PATTERN = 'trigger|arg1|arg2|arg3'
SHADOWS_CHAR_COMMENT_TRIGGER = 'o'
SHADOWS_CHAR_COMMENT_PATTERN = 'trigger'
#==============================================================================
# An important option : if you set it to true, the shadows will get longer if
# you are far from the source. Nice, but induces lag : it will eat your CPU,
# and quite possibly your first born if you try that on a big map.
#==============================================================================
SHADOW_GETS_LONGER = true
#==============================================================================
# Misc options
# If an event has its opacity below SHADOWS_OPACITY_THRESHOLD, no shadow will
# be displayed.
# Set SHADOWS_CATERPILLAR_COMPATIBLE to true if you uses the caterpillar script
#==============================================================================
SHADOWS_OPACITY_THRESHOLD = 254
SHADOWS_CATERPILLAR_COMPATIBLE = true
#==============================================================================
# You probably won't need to touch this : it's the 'map' of how to display the
# shadow depending on the event's direction and his relative position to the
# source. a minus means the shadow is mirrored. It seems complex, and it is.
# Complain to Enterbrain (why didn't they use something clockwise or counter-
# clockwise ? I suspect it's because of the rm2k legacy. More explanations
# below.
#==============================================================================
SHADOWS_DIRECTION_ARRAY = Array.new
SHADOWS_DIRECTION_ARRAY[2] = [ -3, 4, -2, 1 ]
SHADOWS_DIRECTION_ARRAY[4] = [ 4, -2, 1, -3 ]
SHADOWS_DIRECTION_ARRAY[6] = [ 1, -3, 4, -2 ]
SHADOWS_DIRECTION_ARRAY[8] = [ -2, 1, -3, 4 ]
#------------------------------------------------------------------------------
# * SDK Log Script and Check requirements
#------------------------------------------------------------------------------
SDK.log('Shadows', 'rataime', 1.00, '05.06.2007')
SDK.check_requirements(2, [1,2])
#==============================================================================
# ** Game_Party, for compatibility with the caterpillar script.
#==============================================================================
class Game_Party
attr_reader :characters
end
#==============================================================================
# ** Sprite_Shadow, the meat of this script
#==============================================================================
class Sprite_Shadow < RPG::Sprite
attr_accessor :character
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(viewport, character = nil,source = nil,anglemin=0, \
anglemax=0,distancemax=700)
super(viewport)
@anglemin=anglemin.to_f
@anglemax=anglemax.to_f
@distancemax=distancemax.to_f
@character = character
@source = source
self.color = Color.new(0, 0, 0)
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if @character.transparent or @character.opacity <= SHADOWS_OPACITY_THRESHOLD
self.visible = false
return
end
@deltax=(@source.real_x-@character.real_x)/4
@deltay= (@source.real_y-@character.real_y)/4
@distance = (((@deltax ** 2) + (@deltay ** 2))** 0.5)
if @distancemax !=0 and @distance>@distancemax
self.visible = false
return
end
self.angle = 57.3*Math.atan2(@deltax, @deltay )
@angle_trigo= (self.angle+90) % 360
if @anglemin !=0 or @anglemax !=0
if (@angle_trigo<@anglemin or @angle_trigo>@anglemax) and \
@anglemin<@anglemax
self.visible = false
return
elsif (@angle_trigo<@anglemin and @angle_trigo>@anglemax) and \
@anglemin>@anglemax
self.visible = false
return
end
end
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = true
self.x = @character.screen_x
self.y = @character.screen_y-8
self.z = @character.screen_z(@ch)-1
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
if @tile_id == 0
sx = @character.pattern * @cw
quarter = ((@angle_trigo/90+0.5).floor)%4
# The quarter is the position of the event relative to the source.
# Imagine the source is the o point (0,0). Trace the 2 lines
# y=x and y=-x : you get something like a big X
# On the right, quarter=0. Up, quarter = 1, and so on
# Take the @character.direction row (2,4,6,8), and the quarter
# column (0,1,2,3) (remember, it starts at 0), and you'll get
# a number between 1 and 4. It correspond to the row of the charset
# the shadow will be, and mirrored if negative.
# Yes, it isn't obvious, but I didn't find any simple operation to
# get those.
magic = SHADOWS_DIRECTION_ARRAY[@character.direction][quarter]
magic = -magic
if magic < 0
self.mirror = true
magic = -magic
else
self.mirror = false
end
sy = (magic-1)*@ch
self.src_rect.set(sx, sy, @cw, @ch)
end
# This is the formula of the opacity in function of the distance
# ** 2 means square
self.opacity = 1200/((@distance ** 2)/ 1000 + 6)
# This is the formula of the size in function of the distance
# The 0.75 is here so you have a size of 1:1 when next to the source.
self.zoom_y=0.75 + @distance / 256 if SHADOW_GETS_LONGER
end
end
#======================================================================
# ** Sprite_Character EDIT
#======================================================================
# All those things could go somewhere else, but they
# work quite well here.
#======================================================================
class Sprite_Character < RPG::Sprite
@@regexp_source = nil
@@regexp_source_short = nil
@@regexp_char = nil
@@regexp_char_short = nil
alias rataime_shadow_initialize initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
if @@regexp_source == nil
regexp_initialize
end
@character = character
super(viewport)
@ombrelist=[]
if (character.is_a?(Game_Event) and character.list!=nil)
# Let's check the comments in our event list
for j_list in 0..character.list.size-1
#p [@@regexp_source_short, character.list[j_list].parameters[0]]
if (character.list[j_list].code == 108 and \
@@regexp_source_short.match(character.list[j_list].parameters[0])!= nil)
# Haha ! We found a trigger tag ! Time to retrieve the parameters !
parameter_string = character.list[j_list].parameters[0]
j_list += 1
while j_list < character.list.size and \
(character.list[j_list].code == 108 or \
character.list[j_list].code == 408)
parameter_string = parameter_string + "\n" + \
character.list[j_list].parameters[0]
j_list += 1
end
# The following line is a nifty piece of code. Really.
@anglemin,@anglemax,@distancemax = \
(regexp_get_parameters(parameter_string, true)+[nil]*3)[0..2]
# We have our source parameters. Let's find which events we should
# make have a shadow
for i in $game_map.events.keys.sort
if ($game_map.events[i].is_a?(Game_Event) and \
$game_map.events[i].list!=nil)
for i_list in 0..$game_map.events[i].list.size-1
if (($game_map.events[i].list[i_list].code == 108 or \
$game_map.events[i].list[i_list].code == 408 )and \
@@regexp_char_short.match( \
$game_map.events[i].list[i_list].parameters[0])!= nil)
@ombrelist[i+1] = Sprite_Shadow.new(viewport, $game_map.events[i],\
self,@anglemin,@anglemax,@distancemax)
break # no need to add more than one shadow per source per event
end
end # end for
end
end # end for
@ombrelist[1] = Sprite_Shadow.new(viewport, $game_player,self,@anglemin,\
@anglemax,@distancemax)
#===================================================
# Compatibility with fukuyama's caterpillar script
#===================================================
if SHADOWS_CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
@ombrelist.push(Sprite_Shadow.new(viewport, member,self,@anglemin,\
@anglemax,@distancemax))
end
end
#===================================================
# End of the compatibility
#===================================================
end
break # We don't need to go further in the source's list
end # end for
end
rataime_shadow_initialize(viewport, @character)
end
alias rataime_shadow_update update
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
rataime_shadow_update
if @ombrelist!=[]
for i in [email=1..@ombrelist.size]1..@ombrelist.size[/email]
if @ombrelist[i]!=nil
@ombrelist[i].update
end
end
end
end
#--------------------------------------------------------------------------
# * Real_x : it just returns the character's real_x
#--------------------------------------------------------------------------
def real_x
return @character.real_x
end
#--------------------------------------------------------------------------
# * Real_y : it just returns the character's real_y
#--------------------------------------------------------------------------
def real_y
return @character.real_y
end
#--------------------------------------------------------------------------
# * regexp_initialize : the brand new configuration function
# This function generate the regexps based on the configuration
#--------------------------------------------------------------------------
def regexp_initialize
@@regexp_source = regexp_generate(true)
@@regexp_char = regexp_generate(false)
@@regexp_source_short = @@regexp_source
@@regexp_char_short = @@regexp_char
if SHADOWS_SOURCE_COMMENT_PATTERN.is_a?(Array)
@@regexp_source_short = regexp_generate_short(@@regexp_source)
end
if SHADOWS_CHAR_COMMENT_PATTERN.is_a?(Array)
@@regexp_char_short = regexp_generate_short(@@regexp_char)
end
end
#--------------------------------------------------------------------------
# * regexp_generate generate a full length regexp including the arguments
# detection.
#--------------------------------------------------------------------------
def regexp_generate(source = false)
if source
pattern = SHADOWS_SOURCE_COMMENT_PATTERN
trigger = SHADOWS_SOURCE_COMMENT_TRIGGER
@@argument_indexes_source = []
indexes = @@argument_indexes_source
else
pattern = SHADOWS_CHAR_COMMENT_PATTERN
trigger = SHADOWS_CHAR_COMMENT_TRIGGER
@@argument_indexes_char = []
indexes = @@argument_indexes_char
end
if pattern.is_a?(Array)
string = Regexp.escape(pattern.join("\n"))
else
string = Regexp.escape(pattern)
end
string = string.gsub('trigger',')('+trigger+')(')
splitted = string.split('arg')
regexp = '\A(' + splitted[0] + '(\d+)){0,1}'
for i in 1..splitted.size-1
if splitted[i][0..0].to_i == 0
p 'Error : You probably forgot a digit after an arg'
raise
else
indexes.push(splitted[i][0..0].to_i)
regexp = regexp + '(' + splitted[i][1..splitted[i].size-1] + '(\d+)){0,1}'
end
end
return Regexp.new(regexp.chomp('(\d+)){0,1}') + ')')
end
#--------------------------------------------------------------------------
# * Will return a shorter regexp, but still able to identify the trigger
#--------------------------------------------------------------------------
def regexp_generate_short(regexp)
string = regexp.inspect
string = string.split('\n')[0]
string = string[1..string.size-2]
return Regexp.new(string)
end
#--------------------------------------------------------------------------
# * regexp_get_parameters is called whenever a trigger has been identify,
# and the script wants to know the arguments. It returns an array in the
# right orger [arg1,arg2,arg3]
#--------------------------------------------------------------------------
def regexp_get_parameters(string, source = false)
if source
regexp = @@regexp_source
indexes = @@argument_indexes_source.dup
else
regexp = @@regexp_char
indexes = @@argument_indexes_char.dup
end
indexes = indexes.reverse!
match_array = regexp.match(string).captures
return_array = Array.new
if match_array.size > 3
for i in 2..match_array.size-1
if ((i.to_f/2).ceil)*2 != i and match_array[i]!=nil
return_array[indexes.pop-1] = match_array[i]
end
end
end
return return_array
end
end
Code:
# NOT UPDATED !
#==============================================================================
# ■ Sprite_Sun
# # Based on Sprite_Shadow, modified by Rataime
#==============================================================================
CATERPILLAR_COMPATIBLE = true
class Game_Party
attr_reader :characters
end
class Sprite_Sun < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil, self_angle = 45,self_opacity = 128)
super(viewport)
@character = character
@self_angle=self_angle
@self_opacity=self_opacity
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
@direct=@character.direction
if self.angle>90 or angle<-90
if @direct== 6
sy = ( 4- 2) / 2 * @ch
end
if @direct== 4
sy = ( 6- 2) / 2 * @ch
end
if @direct != 4 and @direct !=6
sy = (@character.direction - 2) / 2 * @ch
end
else
sy = (@character.direction - 2) / 2 * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y-5
self.z = @character.screen_z(@ch)-1
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
self.angle = @self_angle-90
self.color = Color.new(0, 0, 0)
$game_map.sun==-1 ? self.opacity = 0: self.opacity = @self_opacity
end
end
#===================================================
# ▼ CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
alias sun_initialize initialize
def initialize(viewport, character = nil)
@character = character
super(viewport)
@sunlist=[]
if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["sun"])
if (character.list[1]!=nil and character.list[1].code == 108)
@self_angle=character.list[1].parameters[0]
else
@self_angle=45
end
if (character.list[2]!=nil and character.list[2].code == 108)
@self_opacity=character.list[2].parameters[0]
else
@self_opacity=128
end
for i in $game_map.events.keys.sort
if ($game_map.events[i].is_a?(Game_Event) and $game_map.events[i].list!=nil and $game_map.events[i].list[0].code == 108 and $game_map.events[i].list[0].parameters == ["o"])
@sunlist[i+1] = Sprite_Sun.new(viewport, $game_map.events[i],@self_angle,@self_opacity)
end
end
@sunlist[1] = Sprite_Sun.new(viewport, $game_player,@self_angle,@self_opacity)
#===================================================
# ● Compatibility with fukuyama's caterpillar script
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
@sunlist.push(Sprite_Sun.new(viewport, member,@self_angle,@self_opacity))
end
end
#===================================================
# ● End of the compatibility
#===================================================
end
sun_initialize(viewport, @character)
end
alias sun_update update
def update
sun_update
if @sunlist!=[]
for i in [email=1..@sunlist.size]1..@sunlist.size[/email]
if @sunlist[i]!=nil
@sunlist[i].update
end
end
end
end
end
#===================================================
# ▼ CLASS Scene_Save edit
#===================================================
class Scene_Save < Scene_File
alias sun_write_save_data write_save_data
def write_save_data(file)
$game_map.sun = nil
sun_write_save_data(file)
end
end
#===================================================
# ▼ CLASS Game_Map edit
#===================================================
class Game_Map
attr_accessor :sun
end
Mirror effect
Code:
# NOT UPDATED !
#==============================================================================
# ■ Sprite_Mirror
# Based on Sprite_Shadow, modified by Rataime
#==============================================================================
class Sprite_Mirror < RPG::Sprite
attr_accessor :character
attr_accessor :events
attr_accessor :event_y
def initialize(viewport=nil)
super(viewport)
@character = $game_player
@events=0
@event_y=0
self.opacity=0
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = (@character.pattern) * @cw
sy = (@character.direction - 2) / 2 * @ch
if @character.direction==8
sy = 0 * @ch
end
if @character.direction==2
sy = 3 * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = self.event_y-($game_player.screen_y-self.event_y).abs+30
self.z = 10
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
#===================================================
# ▼ CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
alias mirror_initialize initialize
def initialize(viewport, character = nil)
@character = character
super(viewport)
if character.is_a?(Game_Player)
$game_map.mirror=Sprite_Mirror.new(viewport)
end
mirror_initialize(viewport, @character)
end
alias mirror_update update
def update
mirror_update
if (@mirror!=nil and character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["m"])
if $game_player.screen_y-self.y<80 and self.y<$game_player.screen_y and ($game_player.screen_x-self.x).abs<17
if (character.list[1]!=nil and character.list[1].code == 108)
@mirror.opacity=character.list[1].parameters[0].to_f
else
@mirror.opacity=$game_player.opacity
end
@mirror.events=self.id
@mirror.event_y=self.y
else
if @mirror.events==self.id
@mirror.events=0
else
if @mirror.events==0
@mirror.opacity=0
end
end
end
end
@mirror=$game_map.mirror
if character.is_a?(Game_Player)
@mirror.update
end
end
end
#===================================================
# ▼ CLASS Scene_Save edit
#===================================================
class Scene_Save < Scene_File
alias mirror_write_save_data write_save_data
def write_save_data(file)
$game_map.mirror = nil
mirror_write_save_data(file)
end
end
#===================================================
# ▼ CLASS Game_Map edit
#===================================================
class Game_Map
attr_accessor :mirror
end
#===================================================
# ▼ CLASS Scene_Map edit
#===================================================
class Spriteset_Map
alias mirror_map_initialize initialize
def initialize
$game_map.mirror=nil
mirror_map_initialize
end
end
Reflection Effect
Code:
# NOT UPDATED !
#==============================================================================
# ■ Sprite_Reflection
# Based on Sprite_Mirror, Modified By: JmsPlDnl, rewritten entirely by Rataime
#==============================================================================
CATERPILLAR_COMPATIBLE = true
class Game_Party
attr_reader :characters
end
class Sprite_Reflection < RPG::Sprite
attr_accessor :character
def initialize(viewport=nil, character=nil,self_angle = 180)
super(viewport)
@character = character
@self_angle=self_angle
self.opacity=0
@reflected=false
@former=false
@moving=false
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+1)==7
@reflected=true
@former=true
end
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = (@character.pattern) * @cw
sy = (@character.direction - 2) / 2 * @ch
if @character.direction== 6
sy = ( 4- 2) / 2 * @ch
end
if @character.direction== 4
sy = ( 6- 2) / 2 * @ch
end
if @character.direction != 4 and @character.direction != 6
sy = (@character.direction - 2) / 2 * @ch
end
end
self.x = @character.screen_x
self.y = @character.screen_y-5
@moving=!(@character.real_x%128==0 and @character.real_y%128==0)
@d=@character.direction
@rect=[sx, sy, @cw, @ch]
if !(@moving)
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+1)==7
@reflected=true
@former=true
else
@reflected=false
@former=false
end
else
case @d
when 2
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+2)==7
@reflected=true
if @former==false
@offset = (@character.screen_y%32)*@ch/32
@rect=[sx, sy, @cw, @offset]
self.y=@character.screen_y-5
end
else
@reflected=false
end
when 4
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+1)!=7
@offset = ((@character.screen_x-@cw/2)%32)*@cw/32
@rect=[sx, sy, @offset, @ch]
self.x=@character.screen_x
else
@reflected=true
if @former==false
@offset = ((@character.screen_x-@cw/2)%32)*@cw/32
@rect=[sx+@offset, sy, @cw-@offset, @ch]
self.x=@character.screen_x-@offset
end
end
when 6
if $game_map.terrain_tag(@character.real_x/128+1,@character.real_y/128+1)!=7
@offset = ((@character.screen_x-@cw/2)%32)*@cw/32
@rect=[sx+@offset, sy, @cw-@offset, @ch]
self.x=@character.screen_x-@offset
else
@reflected=true
if @former==false
@offset = ((@character.screen_x-@cw/2)%32)*@cw/32
@rect=[sx, sy, @offset, @ch]
self.x=@character.screen_x
end
end
when 8
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+2)==7
@reflected=true
if $game_map.terrain_tag(@character.real_x/128,@character.real_y/128+1)!=7
@offset = (@character.screen_y%32)*@ch/32
@rect=[sx, sy, @cw, @offset]
self.y=@character.screen_y-5
end
else
@reflected=false
end
end
end
if @reflected
self.opacity=128
else
@rect=[sx, sy, @cw, @ch]
self.opacity=0
end
if $game_map.terrain_tag((@character.real_x+64)/128,@character.real_y/128+2)!=7
if $game_map.terrain_tag((@character.real_x+64)/128,@character.real_y/128+2)!=7
@rect[1]= @rect[1]+@ch/2
@rect[3]= @rect[3]/2
self.y = self.y - @ch/2
else
@reflected=false
end
end
self.src_rect.set(@rect[0],@rect[1],@rect[2],@rect[3])
@character.is_a?(Game_Player) ? self.z = 9 : self.z = 5
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
self.angle = @self_angle
end
end
#===================================================
# ▼ CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
alias reflect_initialize initialize
def initialize(viewport, character = nil)
@character = character
@reflection = []
super(viewport)
if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["r"])
@reflection.push(Sprite_Reflection.new(viewport,@character))
end
if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["hero_r"])
@reflection.push(Sprite_Reflection.new(viewport,$game_player))
#===================================================
# ● Compatibility with fukuyama's caterpillar script
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
@reflection.push(Sprite_Reflection.new(viewport,member))
end
end
#===================================================
# ● End of the compatibility
#===================================================
end
reflect_initialize(viewport, @character)
end
alias reflect_update update
def update
reflect_update
if @reflection!=nil
for reflect in @reflection
reflect.update
end
end
end
end
Code:
#============================================================================
# ** Passability Tool
#----------------------------------------------------------------------------
# Rataime
# Version 1.00
# 22/04/2007 (2007-04-22)
#============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script and Check requirements
#------------------------------------------------------------------------------
SDK.log('Passability_Tool', 'rataime', 1.00, '04.22.2007')
SDK.check_requirements(2, [1,2])
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Passability_Tool')
#==============================================================================
# ** Sprite_Passability_Map_Rataime
#------------------------------------------------------------------------------
# This sprite class is used to display the picture representing the passability
# of the map's tiles
#==============================================================================
class Sprite_Passability_Map_Rataime < Sprite
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
@base_bitmap = Bitmap.new($game_map.width * 32, $game_map.height * 32)
@counter = 0
@update_every_n_frame = 10
green = Color.new(0,255,0,100)
dark_red = Color.new(130,0,0,150)
red = Color.new(255,0,0,140)
for x in 0..$game_map.width-1
for y in 0..$game_map.height-1
if !$game_map.passable?(x,y,0)
@base_bitmap.fill_rect(x*32, y*32, 32, 32, red)
else
#self.bitmap.fill_rect(x*32, y*32, 32, 32, green)
dir = get_passability_direction(x,y)
@base_bitmap.fill_rect(x*32, y*32 + 22, 32, 10, dark_red) if dir[0]==false
@base_bitmap.fill_rect(x*32, y*32, 10, 32, dark_red) if dir[1]==false
@base_bitmap.fill_rect(x*32 + 22, y*32, 10, 32, dark_red) if dir[2]==false
@base_bitmap.fill_rect(x*32, y*32, 32, 10, dark_red) if dir[3]==false
end
end
end
update
end
#--------------------------------------------------------------------------
# * Get_passability_direction
#--------------------------------------------------------------------------
def get_passability_direction(x,y)
down = $game_map.passable?(x,y,2)
left = $game_map.passable?(x,y,4)
right = $game_map.passable?(x,y,6)
up = $game_map.passable?(x,y,8)
return [down, left, right, up]
end
#--------------------------------------------------------------------------
# * Event_passable?
#--------------------------------------------------------------------------
def event_passable?(x,y)
for event in $game_map.events.values
# If event coordinates are consistent with position
if event.x == x and event.y == y
# If through is OFF
unless event.through
if event.character_name != ""
# impassable
return false
end
end
end
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
if @base_bitmap != nil
@base_bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
if @counter == 0
@counter = @update_every_n_frame
self.bitmap = @base_bitmap.dup
dark_blue = Color.new(30,30,100,150)
for x in 0..$game_map.width-1
for y in 0..$game_map.height-1
if !event_passable?(x,y)
self.bitmap.fill_rect(x*32, y*32, 32, 32, dark_blue)
end
end
end
end
self.ox = $game_map.display_x / 4
self.oy = $game_map.display_y / 4
@counter -=1
end
end
#==============================================================================
# ** Spriteset_Map
#==============================================================================
class Spriteset_Map
alias rataime_passability_spriteset_map_update update
SDK.log_alias(:Spriteset_Map, :update, :rataime_passability_spriteset_map_update)
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if SDK.enabled?('Passability_Tool')
if @sprite_passability == nil
@sprite_passability = Sprite_Passability_Map_Rataime.new(@viewport2)
end
@sprite_passability.update
end
rataime_passability_spriteset_map_update
end
alias rataime_passability_spriteset_map_dispose dispose
SDK.log_alias(:Spriteset_Map, :dispose, :rataime_passability_spriteset_map_dispose)
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
if SDK.enabled?('Passability_Tool')
@sprite_passability.dispose
end
rataime_passability_spriteset_map_dispose
end
end
#==============================================================================
end
#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------
Train_actor (I think this is the catepillar script.)
Code:
#
# Train_Actor
#
# [email=fukuyama@alles.or.jp]fukuyama@alles.or.jp[/email]
# [url=http://www4.big.or.jp/~fukuyama/]http://www4.big.or.jp/~fukuyama/[/url]
#
# ●透明状態用スイッチ設定
# true だとスイッチ制御を行う
# TRAIN_ACTOR_TRANSPARENT_SWITCH = false
TRAIN_ACTOR_TRANSPARENT_SWITCH = true
# ●透明状態用スイッチ番号
# この番号のスイッチがONだと透明になる
TRAIN_ACTOR_TRANSPARENT_SWITCHES_INDEX = 20
# 定数
#Input::DOWN = 2
#Input::LEFT = 4
#Input::RIGHT = 6
#Input::UP = 8
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5
class Game_Party_Actor < Game_Character
def initialize
super()
@through = true
end
def setup(actor)
# キャラクターのファイル名と色相を設定
if actor != nil
@character_name = actor.character_name
@character_hue = actor.character_hue
else
@character_name = ""
@character_hue = 0
end
# 不透明度と合成方法を初期化
@opacity = 255
@blend_type = 0
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
#--------------------------------------------------------------------------
# ● 下に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# 下を向く
if turn_enabled
turn_down
end
# 通行可能な場合
if passable?(@x, @y, Input::DOWN)
# 下を向く
turn_down
# 座標を更新
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 左に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# 左を向く
if turn_enabled
turn_left
end
# 通行可能な場合
if passable?(@x, @y, Input::LEFT)
# 左を向く
turn_left
# 座標を更新
@x -= 1
end
end
#--------------------------------------------------------------------------
# ● 右に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# 右を向く
if turn_enabled
turn_right
end
# 通行可能な場合
if passable?(@x, @y, Input::RIGHT)
# 右を向く
turn_right
# 座標を更新
@x += 1
end
end
#--------------------------------------------------------------------------
# ● 上に移動
# turn_enabled : その場での向き変更を許可するフラグ
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# 上を向く
if turn_enabled
turn_up
end
# 通行可能な場合
if passable?(@x, @y, Input::UP)
# 上を向く
turn_up
# 座標を更新
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● 左下に移動
#--------------------------------------------------------------------------
def move_lower_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
end
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
# 座標を更新
@x -= 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 右下に移動
#--------------------------------------------------------------------------
def move_lower_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
end
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
# 座標を更新
@x += 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● 左上に移動
#--------------------------------------------------------------------------
def move_upper_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
end
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
# 座標を更新
@x -= 1
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● 右上に移動
#--------------------------------------------------------------------------
def move_upper_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
end
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
# 座標を更新
@x += 1
@y -= 1
end
end
def set_move_speed(move_speed)
@move_speed = move_speed
end
end
class Spriteset_Map
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if !setup_actor_character_sprites?
index_game_player = 0
@character_sprites.each_index do |i|
if @character_sprites[i].character.instance_of?(Game_Player)
index_game_player = i
break
end
end
for character in characters.reverse
@character_sprites.unshift(
Sprite_Character.new(@viewport1, character)
)
end
@setup_actor_character_sprites_flag = true
end
end
end
class Scene_Map
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end
class Game_Party
def set_transparent_actors(transparent)
@transparent = transparent
end
def setup_actor_character_sprites
if @characters == nil
@characters = []
for i in 1 .. 4
@characters.push(Game_Party_Actor.new)
end
end
if @actors_chach == nil
@actors_chach = []
end
if @actors_chach != @actors
@actors_chach = @actors.clone
for i in 1 .. 4
@characters[i - 1].setup(actors[i])
end
end
if $scene.instance_of?(Scene_Map)
$scene.setup_actor_character_sprites(@characters)
end
end
def update_party_actors
setup_actor_character_sprites
transparent = $game_player.transparent
if transparent == false
if TRAIN_ACTOR_TRANSPARENT_SWITCH
transparent = $game_switches[TRAIN_ACTOR_TRANSPARENT_SWITCHES_INDEX]
else
transparent = $game_player.transparent
end
end
for character in @characters
character.transparent = transparent
character.set_move_speed($game_player.get_move_speed)
character.update
end
end
def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
if @move_list == nil
@move_list = []
end
for i in 0 .. 10
@move_list[i] = nil
end
end
def move_party_actors
if @move_list == nil
@move_list = []
for i in 0 .. 10
@move_list[i] = nil
end
end
@move_list.each_index do |i|
if @characters[i] != nil
case @move_list[i].type
when Input::DOWN
@characters[i].move_down(@move_list[i].args[0])
when Input::LEFT
@characters[i].move_left(@move_list[i].args[0])
when Input::RIGHT
@characters[i].move_right(@move_list[i].args[0])
when Input::UP
@characters[i].move_up(@move_list[i].args[0])
when DOWN_LEFT
@characters[i].move_lower_left
when DOWN_RIGHT
@characters[i].move_lower_right
when UP_LEFT
@characters[i].move_upper_left
when UP_RIGHT
@characters[i].move_upper_right
when JUMP
@characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
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 add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end
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
def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
end
end
module Game_Player_Module
def update
$game_party.update_party_actors
super
end
def moveto( x, y )
super
$game_party.moveto_party_actors( x, y )
end
def move_down(turn_enabled = true)
if passable?(@x, @y, Input::DOWN)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_left(turn_enabled = true)
if passable?(@x, @y, Input::LEFT)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_right(turn_enabled = true)
if passable?(@x, @y, Input::RIGHT)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_up(turn_enabled = true)
if passable?(@x, @y, Input::UP)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end
def move_lower_left
# 下→左、左→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
$game_party.move_lower_left_party_actors
end
super
end
def move_lower_right
# 下→右、右→下 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
$game_party.move_lower_right_party_actors
end
super
end
def move_upper_left
# 上→左、左→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
$game_party.move_upper_left_party_actors
end
super
end
def move_upper_right
# 上→右、右→上 のどちらかのコースが通行可能な場合
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
$game_party.move_upper_right_party_actors
end
super
end
def jump(x_plus, y_plus)
# 新しい座標を計算
new_x = @x + x_plus
new_y = @y + y_plus
# 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
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
# -----------------------------------------------
# move_speed を外から見れるように
# -----------------------------------------------
def get_move_speed
return @move_speed
end
end
class Game_Player
include Game_Player_Module
end
To make this clear, I'm seeking a way to etheir temporarily remove x party member from the catepillar script temporarily, or a way for the equipment changes to be fixed.