DISABLING A SCRIPT WHILE IN GAME, [VX]
Posts
Pages:
1
Ok, I want to know if it is possible to disable a script while in game in RPG maker vx, I mean I want an event to disable it. Is this possible?
Can anyone help me?
Thanks,
Adon
Can anyone help me?
Thanks,
Adon
/me has never used VX or XP but I'm pretty sure you can do this with a trigger switch you can turn ON and OFF (like a common event in 2k3). I can't tell you the details as to how though sorry, I just know it can be done.
ok... I sorta like RPG maker 2003, better because it was a lot more simpler...
But I like VX cause it's new, and it has a lot more customization.
But I like VX cause it's new, and it has a lot more customization.
It would depend on the script completely. It would need to have the disable feature scripted into it.
It would be best if you posted the script, perhaps a link to it properly formatted as Ruby code (pastebin.ca will do this for you) and someone can look at it, and if it doesn't have a disable feature they may be able to add one for you.
It would be best if you posted the script, perhaps a link to it properly formatted as Ruby code (pastebin.ca will do this for you) and someone can look at it, and if it doesn't have a disable feature they may be able to add one for you.
The argument you want is
"if $game_switches{switch number}"
This is assuming that the switch is ON. ("if switch# is ON, then...")
For example, on top of the script you want to disable via switch,
break if $game_switches{100}
will stop the script from going past that line at all if switch #100 is on. Prexus' advice is good, though, for figuring out exactly how to insert this into the script properly without throwing yourself errors.
note: do not hold down shift when using { } brackets.
"if $game_switches{switch number}"
This is assuming that the switch is ON. ("if switch# is ON, then...")
For example, on top of the script you want to disable via switch,
break if $game_switches{100}
will stop the script from going past that line at all if switch #100 is on. Prexus' advice is good, though, for figuring out exactly how to insert this into the script properly without throwing yourself errors.
note: do not hold down shift when using { } brackets.
That is an awful way of disabling a script lol. Actually, that could cause so many problems.. I don't even..
argh!
argh!
author=prexus
That is an awful way of disabling a script lol. Actually, that could cause so many problems.. I don't even..
argh!
Yeah, it can cause a lot of problems. I don't recommend disabling an ENTIRE SCRIPT like this, just individual methods or branches. I use it just fine in several scripts. The light script jumps to hand because I have it open right now:
FIRE == 101
if $game_switches{FIRE}
effect.light.visible = true
else
if switch #101 is on, the lights are on
Maybe telling you to use break was the bad advice here :x
It's a Caterpillar Script
class Game_Player
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
super
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
super
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
super
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
super
end
end
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super()
@through = true
@actor = actor
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
@actor = actor
setup
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@character_name = $game_actors.character_name
@character_index = $game_actors.character_index
else
@character_name = ""
@character_index = 0
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end
#--------------------------------------------------------------------------
# * Screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
return result
end
end
class Spriteset_Map
alias_method :spriteset_map_create_characters, :create_characters
def create_characters
spriteset_map_create_characters
$game_party.followers.each do |char|
@character_sprites << Sprite_Character.new(@viewport1, char)
end
end
end
class Game_Party
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
MAX_SIZE = 8
CATERPILLAR = 2
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :followers
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_party_initialize, :initialize
def initialize
trick_caterpillar_party_initialize
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
@move_list =
end
#--------------------------------------------------------------------------
# * Update Followers
#--------------------------------------------------------------------------
def update_followers
flag = $game_player.transparent || $game_switches
@followers.each_with_index do |char, i|
char.actor = @actors
char.move_speed = $game_player.move_speed
if $game_player.dash?
char.move_speed += 1
end
char.update
char.transparent = flag
end
end
#--------------------------------------------------------------------------
# * Move To Party
#--------------------------------------------------------------------------
def moveto_party(x, y)
@followers.each {|char| char.moveto(x, y)}
@move_list.clear
end
#--------------------------------------------------------------------------
# * Move Party
#--------------------------------------------------------------------------
def move_party
@move_list.each_index do |i|
if @followers == nil
@move_list = nil
next
end
case @move_list.type
when 2
@followers.move_down(*@move_list.args)
when 4
@followers.move_left(*@move_list.args)
when 6
@followers.move_right(*@move_list.args)
when 8
@followers.move_up(*@move_list.args)
when 1
@followers.move_lower_left
when 3
@followers.move_lower_right
when 7
@followers.move_upper_left
when 9
@followers.move_upper_right
when 5
@followers.jump(*@move_list.args)
end
end
end
#--------------------------------------------------------------------------
# * Add Move List
#--------------------------------------------------------------------------
def update_move(type, *args)
move_party
@move_list.unshift(Game_MoveListElement.new(type, args))
end
end
class Game_MoveListElement
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(type, args)
@type = type
@args = args
end
#--------------------------------------------------------------------------
# * Type
#--------------------------------------------------------------------------
def type
return @type
end
#--------------------------------------------------------------------------
# * Args
#--------------------------------------------------------------------------
def args
return @args
end
end
class Game_Player
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_update, :update
def update
$game_party.update_followers
trick_caterpillar_player_update
end
#--------------------------------------------------------------------------
# * Moveto
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_moveto, :moveto
def moveto(x, y)
$game_party.moveto_party(x, y)
trick_caterpillar_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# * Move Down
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_down, :move_down
def move_down(turn_enabled = true)
if passable?(@x, @y+1)
$game_party.update_move(2, turn_enabled)
end
trick_caterpillar_player_move_down(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_left, :move_left
def move_left(turn_enabled = true)
if passable?(@x-1, @y)
$game_party.update_move(4, turn_enabled)
end
trick_caterpillar_player_move_left(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_right, :move_right
def move_right(turn_enabled = true)
if passable?(@x+1, @y)
$game_party.update_move(6, turn_enabled)
end
trick_caterpillar_player_move_right(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Up
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_up, :move_up
def move_up(turn_enabled = true)
if passable?(@x, @y-1)
$game_party.update_move(8, turn_enabled)
end
trick_caterpillar_player_move_up(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
def move_lower_left
if passable?(@x - 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(1)
end
trick_caterpillar_player_move_lower_left
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
def move_lower_right
if passable?(@x + 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(3)
end
trick_caterpillar_player_move_lower_right
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
def move_upper_left
if passable?(@x - 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(7)
end
trick_caterpillar_player_move_upper_left
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
def move_upper_right
if passable?(@x + 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(9)
end
trick_caterpillar_player_move_upper_right
end
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_jump, :jump
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)
$game_party.update_move(5, x_plus, y_plus)
end
trick_caterpillar_player_jump(x_plus, y_plus)
end
end###########
###########
###########
class Game_Player
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
super(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
super
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
super
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
super
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
super
end
end
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :actor
attr_accessor :move_speed
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super()
@through = true
@actor = actor
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
@actor = actor
setup
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
if @actor != nil
@character_name = $game_actors.character_name
@character_index = $game_actors.character_index
else
@character_name = ""
@character_index = 0
end
@opacity = 255
@blend_type = 0
@priority_type = 0
end
#--------------------------------------------------------------------------
# * Screen Z
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant (Disabled)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
return result
end
end
class Spriteset_Map
alias_method :spriteset_map_create_characters, :create_characters
def create_characters
spriteset_map_create_characters
$game_party.followers.each do |char|
@character_sprites << Sprite_Character.new(@viewport1, char)
end
end
end
class Game_Party
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
MAX_SIZE = 8
CATERPILLAR = 2
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :followers
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_party_initialize, :initialize
def initialize
trick_caterpillar_party_initialize
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)}
@move_list =
end
#--------------------------------------------------------------------------
# * Update Followers
#--------------------------------------------------------------------------
def update_followers
flag = $game_player.transparent || $game_switches
@followers.each_with_index do |char, i|
char.actor = @actors
char.move_speed = $game_player.move_speed
if $game_player.dash?
char.move_speed += 1
end
char.update
char.transparent = flag
end
end
#--------------------------------------------------------------------------
# * Move To Party
#--------------------------------------------------------------------------
def moveto_party(x, y)
@followers.each {|char| char.moveto(x, y)}
@move_list.clear
end
#--------------------------------------------------------------------------
# * Move Party
#--------------------------------------------------------------------------
def move_party
@move_list.each_index do |i|
if @followers == nil
@move_list = nil
next
end
case @move_list.type
when 2
@followers.move_down(*@move_list.args)
when 4
@followers.move_left(*@move_list.args)
when 6
@followers.move_right(*@move_list.args)
when 8
@followers.move_up(*@move_list.args)
when 1
@followers.move_lower_left
when 3
@followers.move_lower_right
when 7
@followers.move_upper_left
when 9
@followers.move_upper_right
when 5
@followers.jump(*@move_list.args)
end
end
end
#--------------------------------------------------------------------------
# * Add Move List
#--------------------------------------------------------------------------
def update_move(type, *args)
move_party
@move_list.unshift(Game_MoveListElement.new(type, args))
end
end
class Game_MoveListElement
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(type, args)
@type = type
@args = args
end
#--------------------------------------------------------------------------
# * Type
#--------------------------------------------------------------------------
def type
return @type
end
#--------------------------------------------------------------------------
# * Args
#--------------------------------------------------------------------------
def args
return @args
end
end
class Game_Player
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :move_speed
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_update, :update
def update
$game_party.update_followers
trick_caterpillar_player_update
end
#--------------------------------------------------------------------------
# * Moveto
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_moveto, :moveto
def moveto(x, y)
$game_party.moveto_party(x, y)
trick_caterpillar_player_moveto(x, y)
end
#--------------------------------------------------------------------------
# * Move Down
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_down, :move_down
def move_down(turn_enabled = true)
if passable?(@x, @y+1)
$game_party.update_move(2, turn_enabled)
end
trick_caterpillar_player_move_down(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_left, :move_left
def move_left(turn_enabled = true)
if passable?(@x-1, @y)
$game_party.update_move(4, turn_enabled)
end
trick_caterpillar_player_move_left(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_right, :move_right
def move_right(turn_enabled = true)
if passable?(@x+1, @y)
$game_party.update_move(6, turn_enabled)
end
trick_caterpillar_player_move_right(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Up
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_up, :move_up
def move_up(turn_enabled = true)
if passable?(@x, @y-1)
$game_party.update_move(8, turn_enabled)
end
trick_caterpillar_player_move_up(turn_enabled)
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_left, :move_lower_left
def move_lower_left
if passable?(@x - 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(1)
end
trick_caterpillar_player_move_lower_left
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_lower_right, :move_lower_right
def move_lower_right
if passable?(@x + 1, @y) and passable?(@x, @y + 1)
$game_party.update_move(3)
end
trick_caterpillar_player_move_lower_right
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_left, :move_upper_left
def move_upper_left
if passable?(@x - 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(7)
end
trick_caterpillar_player_move_upper_left
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_move_upper_right, :move_upper_right
def move_upper_right
if passable?(@x + 1, @y) and passable?(@x, @y - 1)
$game_party.update_move(9)
end
trick_caterpillar_player_move_upper_right
end
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
alias_method :trick_caterpillar_player_jump, :jump
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)
$game_party.update_move(5, x_plus, y_plus)
end
trick_caterpillar_player_jump(x_plus, y_plus)
end
end###########
###########
###########
$game_party.update_followers unless $game_switches{####}
trick_caterpillar_player_update unless $game_switches
^^^ try that. I'm not 100% on this because I've never used this script, and I don't have it installed to experiment. But that will stop the caterpillar script from refreshing without shattering it (I think). However, this might just mean that the player's party appears on the map and then never follows you around (never refreshes/updates). If that's the case, you need to do something with like
trick_caterpillar_party_initialize unless $game_switches
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)} unless $game_switches
@move_list = unless $game_switches
trick_caterpillar_player_update unless $game_switches
^^^ try that. I'm not 100% on this because I've never used this script, and I don't have it installed to experiment. But that will stop the caterpillar script from refreshing without shattering it (I think). However, this might just mean that the player's party appears on the map and then never follows you around (never refreshes/updates). If that's the case, you need to do something with like
trick_caterpillar_party_initialize unless $game_switches
@followers = Array.new(MAX_SIZE - 1) {Game_Follower.new(nil)} unless $game_switches
@move_list = unless $game_switches
Better idea: Find another caterpillar script. I'm using one that lets you turn it on/off via a switch. I'll post it here when I get home.
Yea, I JUST found one like that, byt I would like to see yours,cause I want to see if they are the same, and if not compare them. :3
It's Wortana's with some changes. Let me know if it doesn't work, I don't think it has any dependencies but if it does it should be quick fix.
# GRS- Changed it so it works with the speed script which defines dash speeds # instead of hardcoding them. Also changed it so the party train also gets on # vehicles when the player does too #=============================================================== # ● [VX] ◦ Plug 'n Play Caterpillar System ◦ □ # * Create party members follow the player on map * #-------------------------------------------------------------- # ◦ by Woratana [woratana@hotmail.com] # ◦ Thaiware RPG Maker Community # ◦ Released on: 29/02/2009 # ◦ Version: 2.0 #-------------------------------------------------------------- # ◦ Update: #-------------------------------------------------------------- # □ Version 2.0 (29/02/2009) # - Fix direction bug # - Fix vehicle bug # - Add max following members # □ Version 1.5 (17/02/2009) # - Fix dash bug # - More compatible with script that edit Spriteset_Map.create_characters #-------------------------------------------------------------- # ◦ Compatibility: #-------------------------------------------------------------- # □ This script will rewrite 0 method(s): # # # □ This script will alias 14 method(s): # Spriteset_Map.create_characters # Spriteset_Map.update_characters # Game_Player.move_down # Game_Player.move_left # Game_Player.move_right # Game_Player.move_up # Game_Player.move_lower_left # Game_Player.move_lower_right # Game_Player.move_upper_left # Game_Player.move_upper_right # Game_Player.jump # Game_Player.get_off_vehicle # Game_Player.moveto # Game_Map.setup # # □ This script should work with most scripts # #-------------------------------------------------------------- # ◦ Installation: #-------------------------------------------------------------- # 1) This script should be placed JUST BEFORE ▼ Main Process. # # □ Like this: # ▼ Materials # ... # ... # * Caterpillar System # ▼ Main Process # Main # # 2) Setup this script in Setup Part below. # #-------------------------------------------------------------- # ◦ How to use: #-------------------------------------------------------------- # □ Place this script and setup in the setup part. # #================================================================= module Wora #================================================================= # ++ Setup Part #----------------------------------------------------------------- CATERPILLAR_HIDE_SWITCH = 48 # Turn ON this switch to HIDE caterpillar actors # Turn OFF this switch to SHOW caterpillar actors CATERPILLAR_MAX_ACTORS = 14 # Maximum number of the following actors #----------------------------------------------------------------- def self.add_upd_cater(code = nil) # Add new move action to caterpillar $game_cateracter.each_index do |i| act = $game_cateracter[i] eval($cater_movelist[$cater_movelist.size - 1 - i]) end $cater_movelist.shift $cater_movelist.push(code) unless code.nil? end def self.reset_cater_pos # Reset caterpillar position $game_cateracter.each_index {|i| $game_cateracter[i].refresh } $cater_movelist = Array.new(Wora::CATERPILLAR_MAX_ACTORS - 1) {''} end end class Game_WCateracter < Game_Character attr_accessor :actor def initialize(member_id) super() @wmember_id = member_id refresh end def update(*args) super(*args) actor = $game_party.members[@wmember_id] unless actor.nil? @character_name = actor.character_name @character_index = actor.character_index @transparent = ($game_switches[Wora::CATERPILLAR_HIDE_SWITCH] or $game_player.in_vehicle? or $game_player.transparent) @opacity = $game_player.opacity # GRS - Don't do any dash stuff here, just override the dash method @move_speed = $game_player.move_speed #@move_speed = $game_player.move_speed + ($game_player.dash? ? 1 : 0) else @character_name = '' @character_index = 0 end end def screen_z return $game_player.screen_z end def check_event_trigger_touch(x, y) return false end def passable?(x, y) return true end def refresh @direction = $game_player.direction moveto($game_player.x, $game_player.y) end # GRS - Have this event dash if the player is dashing def dash? return false if $game_player == nil return $game_player.dash? end end class Spriteset_Map alias wora_cater_sprmap_crechara create_characters alias wora_cater_sprmap_updchara update_characters #-------------------------------------------------------------------------- # * Create Character Sprite #-------------------------------------------------------------------------- def create_characters(*args) wora_cater_sprmap_crechara(*args) # Remove Game_Player sprite, this will be add later ((@character_sprites.size-1)..0).each do |i| next if @character_sprites[i].nil? if @character_sprites[i].character.is_a?(Game_Player) @character_sprites[i].dispose @character_sprites.delete_at(i) break end end # Create party members sprite (1..(Wora::CATERPILLAR_MAX_ACTORS-1)).each do |n| @character_sprites.push(Sprite_Character.new(@viewport1, $game_cateracter[n-1])) end @character_sprites.push(Sprite_Character.new(@viewport1, $game_player)) end #-------------------------------------------------------------------------- # * Update Character Sprite #-------------------------------------------------------------------------- def update_characters(*args) $game_cateracter.each {|cater| cater.update } wora_cater_sprmap_updchara(*args) end end class Game_Player < Game_Character attr_reader :move_speed unless method_defined?('wora_cater_gampla_movdown') alias wora_cater_gampla_movdown move_down alias wora_cater_gampla_movleft move_left alias wora_cater_gampla_movright move_right alias wora_cater_gampla_movup move_up alias wora_cater_gampla_movll move_lower_left alias wora_cater_gampla_movlr move_lower_right alias wora_cater_gampla_movul move_upper_left alias wora_cater_gampla_movur move_upper_right alias wora_cater_gampla_jump jump alias wora_cater_gampla_getoffveh get_off_vehicle alias wora_cater_gampla_moveto moveto #-------------------------------------------------------------------------- # * Move Down #-------------------------------------------------------------------------- def move_down(turn_ok = true) wora_cater_gampla_movdown(turn_ok) Wora.add_upd_cater("act.move_down(#{turn_ok})") unless @move_failed end #-------------------------------------------------------------------------- # * Move Left #-------------------------------------------------------------------------- def move_left(turn_ok = true) wora_cater_gampla_movleft(turn_ok) Wora.add_upd_cater("act.move_left(#{turn_ok})") unless @move_failed end #-------------------------------------------------------------------------- # * Move Right #-------------------------------------------------------------------------- def move_right(turn_ok = true) wora_cater_gampla_movright(turn_ok) Wora.add_upd_cater("act.move_right(#{turn_ok})") unless @move_failed end #-------------------------------------------------------------------------- # * Move up #-------------------------------------------------------------------------- def move_up(turn_ok = true) wora_cater_gampla_movup(turn_ok) Wora.add_upd_cater("act.move_up(#{turn_ok})") unless @move_failed end #-------------------------------------------------------------------------- # * Move Lower Left #-------------------------------------------------------------------------- def move_lower_left wora_cater_gampla_movll Wora.add_upd_cater('act.move_lower_left') unless @move_failed end #-------------------------------------------------------------------------- # * Move Lower Right #-------------------------------------------------------------------------- def move_lower_right wora_cater_gampla_movlr Wora.add_upd_cater('act.move_lower_right') unless @move_failed end #-------------------------------------------------------------------------- # * Move Upper Left #-------------------------------------------------------------------------- def move_upper_left wora_cater_gampla_movul Wora.add_upd_cater('act.move_upper_left') unless @move_failed end #-------------------------------------------------------------------------- # * Move Upper Right #-------------------------------------------------------------------------- def move_upper_right wora_cater_gampla_movur Wora.add_upd_cater('act.move_upper_right') unless @move_failed end #-------------------------------------------------------------------------- # * Jump #-------------------------------------------------------------------------- def jump(x, y) wora_cater_gampla_jump(x, y) Wora.add_upd_cater("act.jump(#{x},#{y})") end #-------------------------------------------------------------------------- # * Get Off Vehicle #-------------------------------------------------------------------------- def get_off_vehicle(*args) wora_cater_gampla_getoffveh(*args) Wora.reset_cater_pos end #-------------------------- # GRS changes #alias get_on_vehicle_caterpillar_ori get_on_vehicle unless $@ GET_ON_NONE = 0 GET_ON_BOAT = 1 GET_ON_SHIP = 2 GET_ON_AIR = 3 def get_on_vehicle # Find out what vehicle the player is getting on but don't call the # method that makes the player board the vehicle. Just force-move the # player forward, move the caterpillar, THEN board the vehicle got_on = GET_ON_NONE front_x = $game_map.x_with_direction(@x, @direction) front_y = $game_map.y_with_direction(@y, @direction) if $game_map.airship.pos?(@x, @y) # Is it overlapping with airship? got_on = GET_ON_AIR elsif $game_map.ship.pos?(front_x, front_y) # Is there a ship in front? force_move_forward got_on = GET_ON_SHIP elsif $game_map.boat.pos?(front_x, front_y) # Is there a boat in front? force_move_forward got_on = GET_ON_BOAT end if got_on != GET_ON_NONE # Move the caterpillar onto the vehicle count = 0 while got_on and count < (32 / Speed.player) * $game_party.members.size Wora.add_upd_cater("") if count % (32 / Speed.player) * $game_party.members.size == 0 $scene.update_basic count += 1 end # Call the appropriate board vehicle method case got_on when GET_ON_BOAT get_on_boat when GET_ON_SHIP get_on_ship when GET_ON_AIR get_on_airship end return true else # The player didn't get on a vehicle return false end end # Change get_on_boat/ship methods so the player doesn't move forward # when they get on, the caterpillar get_on_vehicle will do that def get_on_boat @vehicle_getting_on = true # Boarding flag @vehicle_type = 0 # Set vehicle type #force_move_forward # Move one step forward @walking_bgm = RPG::BGM::last # Memorize walking BGM $game_map.boat.get_on # Boarding processing end def get_on_ship @vehicle_getting_on = true # Board @vehicle_type = 1 # Set vehicle type #force_move_forward # Move one step forward @walking_bgm = RPG::BGM::last # Memorize walking BGM $game_map.ship.get_on # Boarding processing end #-------------------------------------------------------------------------- # * Move to Designated Position #-------------------------------------------------------------------------- def moveto(*args) wora_cater_gampla_moveto(*args) Wora.reset_cater_pos end end end class Game_Map attr_accessor :events alias wora_cater_gammap_setup setup def setup(*args) wora_cater_gammap_setup(*args) # Create caterpillar actors $game_cateracter = [] (1..(Wora::CATERPILLAR_MAX_ACTORS-1)).each do |n| $game_cateracter.push(Game_WCateracter.new(n)) end $cater_movelist = Array.new(Wora::CATERPILLAR_MAX_ACTORS - 1) {''} end end
Oh, clever!
It uses the switch to simply turn everything transparent. derp
@transparent = ($game_switches[Wora::CATERPILLAR_HIDE_SWITCH] or $game_player.in_vehicle? or $game_player.transparent)
It uses the switch to simply turn everything transparent. derp
Pages:
1

















