VX 스크립트

다른 VX 따라다니기 스크립트를 써봤는데 제 컴에서 오류 없이 작동 되는 것은 이것 뿐이더군요.

사용하려면 손을 대야하는 부분만 번역하여 올려봅니다. 출처


저 같은 생초보 분들을 위해서 사족을 붙이자면... 밑에

  CATERPILLAR_HIDE_SWITCH = 1
  # 따라다니기용 스위치를 작성하고 동료 없이 다니려면 해당 스위치를 ON 하세요.
  # 동료가 따라다니게 하고 싶으면 스위치를 OFF 로 설정하세요

라는 부분이 있는데 "따라다니기용 스위치"는

이벤트 작성 -> 이벤트 커맨드 탭1 -> 스위치 조작 -> 단독 에서 (...) 클릭 ->

사용하지 않는 스위치 하나 정하고 알아보기 쉽게 표기 -> 해당 스위치 아이디 기억 (예: 0001)

->CATERPILLAR_HIDE_SWITCH =   옆 에다가 숫자를 씁니다.

예를 들어 0023 에다가 정했으면 CATERPILLAR_HIDE_SWITCH = 23 이라고 입력합니다.

동료가 따라다니게 하고 싶은 화면에다가 투명 이벤트 하나를 만들고 해당 스위치를 OFF 시켜놓습니다.

(껐다 키면 스위치가 리셋 되는 지는 잘 모르겠네요... 저는 아무데서나 저장 못하게 되어 있어서

저장할 수 있는 화면 (즉 로드되는 화면) 마다 이벤트를 만들고 스위치 OFF 하게 놨습니다.)



#===============================================================
# ● [VX] ◦ Plug 'n Play Caterpillar System ◦ □
# * 동료가 주인공 따라다니게 하기 *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com] 
# ◦ 번역 - MinaAubert @ AVANGS [syung1127@msn.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 # #-------------------------------------------------------------- # ◦ 설치방법: #-------------------------------------------------------------- # 1) 1) 메인 카테고리 (▼메인) 바로 위에 삽입하세요 # # □ 아래와 같이 합니다: # ▼ 소재 # ... # ... # * Caterpillar System # ▼ 메인 # Main # # 2) "셋업" 파트에서 수정합니다. # #-------------------------------------------------------------- # ◦ 사용법: #-------------------------------------------------------------- # □ "셋업 파트"에서 스위치 아이디를 정하여 사용하세요. # #================================================================= module Wora #================================================================= # ++ 셋업 파트 #----------------------------------------------------------------- CATERPILLAR_HIDE_SWITCH = 1 # 따라다니기용 스위치를 작성하고 동료 없이 다니려면 해당 스위치를 ON 하세요. # 동료가 따라다니게 하고 싶으면 스위치를 OFF 로 설정하세요. CATERPILLAR_MAX_ACTORS = 5 # 따라다닐 수 있는 동료의 최대 수 설정 #----------------------------------------------------------------- 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 @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 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 #-------------------------------------------------------------------------- # * 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
Comment '5'