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 5408
537 HUD KH HUD (HP MP 게이지바 스크립트) 41 아방스 2010.12.17 6422
536 전투 GTBS 1.5.1.4 - GubiD's Tactical Battle System 10 아방스 2010.12.11 4455
535 메뉴 기본메인 메뉴 아이콘 추가 10 아방스 2010.12.11 4573
534 HUD HUD 스크립트 모음 10 아방스 2010.12.11 3658
533 전투 전투후 HP/MP 퍼센테이지(지정) 회복 5 하얀슬픔 2010.12.06 2495
532 이동 및 탈것 3D 던젼 스크립트 38 아방스 2010.12.06 5775
531 장비 장비 레벨 개념 추가 스크립트 14 아방스 2010.12.06 3275
530 스킬 체스트 팝업 3.0 9 file 파이어 2010.12.05 3037
529 미니맵 MiniMap 1.0 미니맵 스크립트. 39 아방스 2010.12.02 4740
528 전투 사이드 뷰 시스템 [시트르산님 제공] 56 아방스 2010.11.29 7499
527 변수/스위치 HG_SelfVariables 셀프 변수 8 file 허걱 2010.11.19 2341
526 기타 HG_SHOOT_ANIMATION 4 file 허걱 2010.11.17 2596
525 기타 RMVX Patcher 1.2.0 by Yeyinde 5 file Alkaid 2010.11.12 2118
524 아이템 아이템 무게, 아이템별 소지수 적용 16 file 허걱 2010.11.11 2981
523 스킬 Simple Sort Skill Inventory 1.1 by cozziekuns 5 file Alkaid 2010.11.10 2350
522 스킬 Simple Sort Inventory 1.3a by cozziekuns 5 file Alkaid 2010.11.10 1636
521 전투 RPG tankentai에서의 치명적 문제점을 보완한 스크립트 2 file 톰소여동생 2010.11.03 3117
520 전투 포켓몬 스크립트 한글화 완료 26 file 서울냥이 2010.10.11 6030
519 기타 Modified Advanced Weather Script VX 1.1 3 file Alkaid 2010.10.08 1967
518 기타 책 읽기 스크립트 44 file 히류 2010.10.05 4506
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32