VX 스크립트

스크립터: BigEd781

보통 게임을 만들 때, 이벤트의 위치가 이동을 할 때가 있죠.

하지만 그 위치가 다른 맵에 갔다가 다시 돌아오면 처음에 지정되어 있던 위치로

다시 바껴있는 경우가 허다해, 스위치를 이용해 새 이벤트를 만들어야만 했던

귀찮았던 때가 있었죠.

이제 이 스크립트로 그 문제를 해결하세요!! (무슨 홈쇼핑 광고 같다...)

그렇다고 이 스크립트는 무작정 이벤트의 위치가 전에 있던 것으로 옮겨주는 건 아니고...

이 스크립트에 해당되는 스위치를 켜야 활성화가 됩니다.

한마디로 필요하지 않을 땐 그냥 스위치를 끄면 간단하게 OK!!

또 이벤트에다 주석으로 'no mem'이라고 적으면 그 이벤트 역시 그 장소를 저장하지 않습니다!!!!!! (놀랍네요!)

스위치 지정은

alias :eds_old_pre_mem_setup :setup
  def setup(map_id)    
    save_positions if $game_switches[1]
    eds_old_pre_mem_setup(map_id)    
    restore_positions  if $game_switches[1]
  end

이 부분을 찾으셔서

$game_switches[1] 라고 적혀 있는 곳에 있는 [ ]  안에

원하는 스위치 id를 지정하세요. (참고로 두부분이 있고, 두부분 모두 바꿔줘야 합니다..)

설명 끝 -0-;


#-----------------------------------------------------------------------
#                       Memorize Event Positions
#                               BigEd781
#-----------------------------------------------------------------------
class Game_System
  
  alias :eds_old_pre_mem_intialize :initialize
  def initialize
    eds_old_pre_mem_intialize
    @event_pos_data = {}    
  end
  
  def save_event_position_data(map_id, data)
    @event_pos_data[map_id] = data
  end
  
  def get_event_position_data(map_id)
    return @event_pos_data[map_id].nil? ? [] : @event_pos_data[map_id]
  end
  
end

class Game_Event < Game_Character

  def comment?(comment)
    unless @list.nil?
      @list.each { |line|
        next if line.code != 108                              
        return true if line.parameters[0].upcase == comment.upcase }      
    end    
    return false
  end  
  
end

class Game_Map
  #스위치 지정하는 곳
  alias :eds_old_pre_mem_setup :setup
  def setup(map_id)    
    save_positions if $game_switches[1]
    eds_old_pre_mem_setup(map_id)    
    restore_positions  if $game_switches[1]
  end
  
  def save_positions
    return if @events.nil? || @events == { }        
    data = []
    @events.values.each { |event| data += [[ event.id, event.x, event.y, event.direction ]] }      
    $game_system.save_event_position_data(@map_id, data)    
  end
  
  def restore_positions    
    return if @events.nil? || @events == { }        
    $game_system.get_event_position_data(@map_id).each { |data|  
    event = @events[data[0]]  
      unless event.nil? || event.comment?('no mem')
        x, y, direction = data[1], data[2], data[3]
        event.moveto(x, y) unless event.pos?(x, y)
        event.set_direction(direction)
      end
    }    
  end
  
end


출처: rpgrevolution.com

Who's Tofuman

?
WE ARE!? PENN STATE!!!!!
Comment '10'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
217 타이틀/게임오버 Title Skip System : 타이틀 스킵 file 허걱 2014.03.19 1510
216 맵/타일 Tileset Reader VX 2.1 by DerVVulfman 4 Alkaid 2010.09.20 2376
215 전투 Team_Ilias's_Old_Project_Demo 4 습작 2012.07.11 2099
214 전투 Target 몬스터 플래시 스크립트 16 아방스 2008.01.24 4513
213 Tankentai SBS 2.8 업데이트 [사이드뷰 배틀시스템 ] 42 file RPGbooster 2008.10.08 5140
212 기타 TagNote v2.0 5 Man... 2008.10.28 1996
211 스킬 SW_BookSkill && EchantScroll(상호충돌수정버전) 6 시옷전사 2011.08.22 1758
210 맵/타일 SwapXT by bulletxt 습작 2013.05.13 1292
209 상태/속성 Stat Distribution System 1.71 by Lettuce 7 file Alkaid 2010.09.14 2339
208 기타 Staff Roll 13 file 허걱 2009.01.31 3523
207 전투 SRPGコンバータ for VX by AD.Bank 습작 2013.05.13 2970
206 Sprite Mover 2 Man... 2008.10.27 1529
205 전투 Spirits System 정령 장착?이라고해야되나; 26 file 카르와푸딩의아틀리에 2009.08.19 3869
204 전투 Spin Battle System [완성버젼] 38 file 할렘 2009.11.14 6835
203 전투 Slip_Damage_Ex - 슬립데미지 확장기능 (상태별 슬립데미지 적용) 7 허걱 2012.07.24 2194
202 Skill Delay VX 4 Man... 2008.10.28 1503
201 스킬 Simple Sort Skill Inventory 1.1 by cozziekuns 5 file Alkaid 2010.11.10 2350
200 스킬 Simple Sort Inventory 2.0 by cozziekuns 1 file Alkaid 2011.09.29 2350
199 스킬 Simple Sort Inventory 1.3a by cozziekuns 5 file Alkaid 2010.11.10 1636
198 Simple Fon Chage 3 Man... 2008.10.28 1212
Board Pagination Prev 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32