Atoa Caterpillar VX
3 participantes
Galáxia RPG Maker :: Central Galática do RPG Maker
:: Scripts (RGSS/RGSS2) :: RGSS/RGSS2 :: RPG Maker VX - RGSS2
Página 1 de 1
Atoa Caterpillar VX
Introdução
Este é um sistema de caterpillar feito por Atoa. Neste sistema os personagens são mostrados na tela e seguem o herói.
Este sistema possuim um movimento um pouco diferente dos outros sistemas caterpillar.
Características
• Personagens do grupo são exibidos na tela e seguem o personagem na frene
• Movimente um pouco diferenciado dos outros caterpillares disponíveis.
Como usar
Para instalá-lo, apenas cole o script acima do main.
Demo
Não necessita de Demo
Script
Créditos e Agradecimentos
•Feito por Atoa
•Eu por disponibilizar aqui na Galáxia RPG Maker :face:
Este é um sistema de caterpillar feito por Atoa. Neste sistema os personagens são mostrados na tela e seguem o herói.
Este sistema possuim um movimento um pouco diferente dos outros sistemas caterpillar.
Características
• Personagens do grupo são exibidos na tela e seguem o personagem na frene
• Movimente um pouco diferenciado dos outros caterpillares disponíveis.
Como usar
Para instalá-lo, apenas cole o script acima do main.
Demo
Não necessita de Demo
Script
- Spoiler:
- Código:
#=============================================================================
# Atoa Atoa Caterpillar
# Por Atoa
#==============================================================================
# Este script permite vizualizar os membros no mapa, eles irão seguir o herói
# Um pouco diferente dos outros caterpillar, neste os personagens
# Só se movimentam caso necessário (portanto eles não ficam igual "barata tonta"
# se você ficar indo e voltando.
#
# Para juntar os personagens use o comando: $game_player.caterpillar_gather
#
# Um aviso importante: O script não funciona muito bem com movimeno em diagonal
# ele fica visualmente bonito apenas com 3 ou 2 pesonagens no grupo.
# Após usa-lo, use o comando de reunir grupo.
#==============================================================================
module Atoa
# Numero máximos de personagens seguindo o herói na tela
Max_Caterpillar_Actor = 3
# ID do switch que esconde a vizualização dos personagens quando ativado
Caterpillar_Hide_Switch = 1
# Permitir alterar ordem do grupo apertando-se as teclas Q ou W?
Allow_Reorder = true
# Distancia máxima entre os personagens do grupo
# Deixe 0 para desativar
Max_Distance = 0
end
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
attr_accessor(:direction)
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
attr_accessor(:catterpillar, :old_x, :old_y, :move_speed)
#--------------------------------------------------------------------------
alias atoa_caterpillar_refresh refresh if !method_defined?(:atoa_caterpillar_refresh)
def refresh
catterpillar_update
atoa_caterpillar_refresh
end
#--------------------------------------------------------------------------
def catterpillar_update
if @catterpillar == nil
@catterpillar = []
for i in 1...(Max_Caterpillar_Actor + 1)
@catterpillar[i - 1] = Atoa_Catterpillar.new(i)
end
end
for cat in @catterpillar
cat.refresh
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_update update if !method_defined?(:atoa_caterpillar_update)
def update
for cat in @catterpillar
cat.update
end
atoa_caterpillar_update
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_moveto moveto if !method_defined?(:atoa_caterpillar_moveto)
def moveto(x, y)
atoa_caterpillar_moveto(x, y)
catterpillar_update if @catterpillar.nil? or @move_update.nil?
for i in 0...@catterpillar.size
@catterpillar[i].moveto(x, y)
end
end
#--------------------------------------------------------------------------
def set_old_direction
@old_x = @x
@old_y = @y
for i in 0...@catterpillar.size
@catterpillar[i].old_x = @catterpillar[i].x
@catterpillar[i].old_y = @catterpillar[i].y
end
end
#--------------------------------------------------------------------------
def cat_moved?(i, d)
cat = i == 0 ? self : @catterpillar[i - 1]
cat2 = @catterpillar[i]
if d == 1 or d == 3 or d == 7 or d == 9
return true
elsif (cat.direction == 2 or cat.direction == 8) and cat.y == cat2.y
return false
elsif (cat.direction == 4 or cat.direction == 6) and cat.x == cat2.x
return false
elsif cat.old_x != cat.x or cat.old_y != cat.y
return true
end
return false
end
#--------------------------------------------------------------------------
def move_cat(i, d)
if cat_moved?(i, d)
@catterpillar[i].move_player
if i == 0 or (i != 0 and (d == 1 or d == 3 or d == 7 or d == 9))
@catterpillar[i].move_update.push(d)
else
@catterpillar[i].move_update.push(@catterpillar[i - 1].direction)
end
else
if i == 0 or check_same_tile(i)
@catterpillar[i].move_update.clear
else
cat = @catterpillar[i].move_update[0]
@catterpillar[i].move_update.clear
@catterpillar[i].move_update.push(cat)
end
end
end
#--------------------------------------------------------------------------
def check_same_tile(i)
return false if i == 0
cat = @catterpillar[i - 1]
cat2 = @catterpillar[i]
return true if cat.x == cat2.x and cat.y == cat2.y
return false
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_down move_down if !method_defined?(:atoa_caterpillar_move_down)
def move_down(turn_ok = true)
set_old_direction
passable = passable?(@x, @y+1)
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_down
if passable
for i in 0...@catterpillar.size
move_cat(i, 2)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_left move_left if !method_defined?(:atoa_caterpillar_move_left)
def move_left(turn_ok = true)
set_old_direction
passable = passable?(@x-1, @y)
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_left
if passable
for i in 0...@catterpillar.size
move_cat(i, 4)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_right move_right if !method_defined?(:atoa_caterpillar_move_right)
def move_right(turn_ok = true)
set_old_direction
passable = passable?(@x+1, @y)
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_right
if passable
for i in 0...@catterpillar.size
move_cat(i, 6)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_up move_up if !method_defined?(:atoa_caterpillar_move_up)
def move_up(turn_ok = true)
set_old_direction
passable = passable?(@x, @y-1)
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_up
if passable
for i in 0...@catterpillar.size
move_cat(i, 8)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_lower_left move_lower_left if !method_defined?(:atoa_caterpillar_move_lower_left)
def move_lower_left
set_old_direction
passable = (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or (passable?(@x-1, @y) and passable?(@x-1, @y+1))
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_lower_left
if passable
for i in 0...@catterpillar.size
move_cat(i, 1)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_lower_right move_lower_right if !method_defined?(:atoa_caterpillar_move_lower_right)
def move_lower_right(turn_ok = true)
set_old_direction
passable = (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or (passable?(@x+1, @y) and passable?(@x+1, @y+1))
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_lower_right
if passable
for i in 0...@catterpillar.size
move_cat(i, 3)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_upper_left move_upper_left if !method_defined?(:atoa_caterpillar_move_upper_left)
def move_upper_left(turn_ok = true)
set_old_direction
passable = (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or (passable?(@x-1, @y) and passable?(@x-1, @y-1))
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_upper_left
if passable
for i in 0...@catterpillar.size
move_cat(i, 7)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_move_upper_right move_upper_right if !method_defined?(:atoa_caterpillar_move_upper_right)
def move_upper_right(turn_ok = true)
set_old_direction
passable = (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or (passable?(@x+1, @y) and passable?(@x+1, @y-1))
catterpillar_update if @catterpillar.nil? or @move_update.nil?
atoa_caterpillar_move_upper_right
if passable
for i in 0...@catterpillar.size
move_cat(i, 9)
end
end
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_get_on_vehicle get_on_vehicle if !method_defined?(:atoa_caterpillar_get_on_vehicle)
def get_on_vehicle
enter = atoa_caterpillar_get_on_vehicle
caterpillar_gather if enter
return enter
end
#--------------------------------------------------------------------------
alias atoa_caterpillar_get_off_vehicle get_off_vehicle if !method_defined?(:atoa_caterpillar_get_off_vehicle)
def get_off_vehicle
for i in 0...@catterpillar.size
@catterpillar[i].moveto(@x, @y)
end
atoa_caterpillar_get_off_vehicle
caterpillar_gather
end
#--------------------------------------------------------------------------
def caterpillar_gather
for i in 0...@catterpillar.size
@catterpillar[i].gather_party
end
end
end
#==============================================================================
# ■ Atoa_Catterpillar
#==============================================================================
class Atoa_Catterpillar < Game_Character
#--------------------------------------------------------------------------
attr_accessor(:move_update, :member, :old_x, :old_y, :x, :y, :move_speed)
#--------------------------------------------------------------------------
def initialize(member)
super()
@move_update = []
@member = member
moveto($game_player.x, $game_player.y)
@through = true
refresh
end
#--------------------------------------------------------------------------
def moveto(x, y)
super(x, y)
@move_update.clear
end
#--------------------------------------------------------------------------
def refresh
party = $game_party.members
if party.size < @member
@character_name = ""
@character_hue = 0
return
end
actor = party[@member]
if actor == nil
@character_name = ""
@character_hue = 0
return
end
@character_name = actor.character_name
@character_index = actor.character_index
@opacity = 255
@blend_type = 0
end
#--------------------------------------------------------------------------
def screen_z
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z - 1
end
super
end
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
return false
end
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
return false
end
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return false
end
#--------------------------------------------------------------------------
def update
member = @member == 1 ? $game_player : $game_player.catterpillar[@member - 2]
diff = ((player_distance(member) >= Max_Distance) or !$game_player.moving?) ? 0 : 1
@move_speed = [member.move_speed - diff, 1].max
super
@transparent = $game_player.transparent
@transparent = @transparent ? @transparent : $game_switches[Caterpillar_Hide_Switch]
end
#--------------------------------------------------------------------------
def player_distance(member)
if far_from_member(member)
dist_x = ((member.screen_x - self.screen_x)/32).to_i.abs
dist_y = ((member.screen_y - self.screen_y)/32).to_i.abs
return dist_x - 1 if dist_x >= dist_y
return dist_y - 1 if dist_y >= dist_x
end
return 0
end
#--------------------------------------------------------------------------
def far_from_member(member)
return true if (member.screen_x > self.screen_x) and ((member.screen_x - self.screen_x) > 32)
return true if (member.screen_y > self.screen_y) and ((member.screen_y - self.screen_y) > 32)
return true if (member.screen_x < self.screen_x) and ((self.screen_x - member.screen_x) > 64)
return true if (member.screen_y < self.screen_y) and ((self.screen_y - member.screen_y) > 64)
return false
end
#--------------------------------------------------------------------------
def move_player
refresh
return if @move_update.empty?
case @move_update[0]
when 1
move_lower_left
when 2
move_down
when 3
move_lower_right
when 4
move_left
when 6
move_right
when 7
move_upper_left
when 8
move_up
when 9
move_upper_right
end
@move_update.delete_at(0)
end
#--------------------------------------------------------------------------
def gather_party
for i in 0...$game_party.members.size
move_toward_player
end
@x = $game_player.x
@y = $game_player.y
@move_update.clear
end
end
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
alias atoa_caterpillar_create_characters create_characters if !method_defined?(:atoa_caterpillar_create_characters)
def create_characters
atoa_caterpillar_create_characters
for caterpillar in $game_player.catterpillar.reverse
sprite = Sprite_Character.new(@viewport1, caterpillar)
@character_sprites.push(sprite)
end
@old_party = $game_party.members.dup
end
#--------------------------------------------------------------------------
def update_characters
for sprite in @character_sprites
sprite.update
end
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
attr_accessor :actors
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
alias atoa_caterpillar_update update if !method_defined?(:atoa_caterpillar_update)
def update
atoa_caterpillar_update
if Input.trigger?(Input::L) and Allow_Reorder
Sound.play_decision
reorder_party(true)
end
if Input.trigger?(Input::R) and Allow_Reorder
Sound.play_decision
reorder_party(false)
end
end
#--------------------------------------------------------------------------
def reorder_party(order)
if order
party = $game_party.actors.shift
$game_party.actors << party
else
party = $game_party.actors.pop
$game_party.actors.unshift(party)
end
$game_player.refresh
end
end
Créditos e Agradecimentos
•Feito por Atoa
•Eu por disponibilizar aqui na Galáxia RPG Maker :face:
AllaN- Moderadores
- Engine :
Mensagens : 163
Idade : 27
Localização : Area 51.
Re: Atoa Caterpillar VX
Muito bom carinha, está postando bastante hoje hein?
Ótimo trabalho, muito obrigado por dispor!! :):
Ótimo trabalho, muito obrigado por dispor!! :):
Galáxia RPG Maker :: Central Galática do RPG Maker
:: Scripts (RGSS/RGSS2) :: RGSS/RGSS2 :: RPG Maker VX - RGSS2
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|