결정 키로 이벤트 시작하는 조건분기 (RPG VX Ace용)
◆게임 창작 관련/코드, 스크립트 :: 2016. 1. 16. 20:42RPG 만들기 2000/2003의 조건분기를 보면 '결정 키로 이 이벤트를 시작'이라는 항목이 있는데 XP 이후 이 항목이 사라졌습니다.
하지만 스크립트를 조금만 고치면 결정 키로 이벤트를 시작하는 조건분기를 넣을 수 있습니다.
이 포스트에서는 RPG VX Ace용으로 만들었습니다.
(C 버튼을 누르고 있는지의 여부로 하는 방법은 결정 키를 누른 상태에서 접촉해도 인식하므로 완벽한 방법이 아닙니다.)
다음 스크립트를 복사해서 스크립트창(F11)의 '▼ Materials' 부분 밑에 새 스크립트를 추가해 붙여넣기하시면 됩니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # Start with OK Button in Conditional Branch v1.0 # '결정 키로 이벤트 시작' 조건분기 스크립트입니다. # # 만든이: Juwan Park # # 저작권: Creative Commons BY 3.0 # (영리/비영리 여부에 관계없이 자유롭게 이용 가능합니다.) # # [사용법] # 조건분기에서 스크립트 선택 후 다음과 같이 넣으면 됩니다. # $game_player.swob? # 그리고 결정 키로 이벤트를 시작했을 경우 실행될 커맨드를 넣으면 됩니다. class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias playerinit initialize def initialize playerinit @start_with_ok_button = false end #-------------------------------------------------------------------------- # * Determine if Touch Event is Triggered #-------------------------------------------------------------------------- def check_event_trigger_touch(x, y) @start_with_ok_button = false start_map_event(x, y, [ 1 , 2 ], true ) end #-------------------------------------------------------------------------- # * Determine if Event Start Caused by [OK] Button #-------------------------------------------------------------------------- def check_action_event return false if in_airship? check_event_trigger_here([ 0 ]) return true if $game_map .setup_starting_event @start_with_ok_button = true check_event_trigger_there([ 0 , 1 , 2 ]) $game_map .setup_starting_event end #-------------------------------------------------------------------------- # * Start with [OK] Button? #-------------------------------------------------------------------------- def swob? return @start_with_ok_button end #-------------------------------------------------------------------------- # * SWOB to false #-------------------------------------------------------------------------- def noswob @start_with_ok_button = false end end class Game_Event < Game_Character #-------------------------------------------------------------------------- # * Determine if Touch Event is Triggered #-------------------------------------------------------------------------- def check_event_trigger_touch(x, y) return if $game_map .interpreter.running? if @trigger == 2 && $game_player .pos?(x, y) $game_player .noswob start if !jumping? && normal_priority? end end #-------------------------------------------------------------------------- # * Unlock #-------------------------------------------------------------------------- def unlock if @locked @locked = false set_direction( @prelock_direction ) $game_player .noswob end end end |
예제는 다음 첨부파일에 있습니다.
위의 소스코드만 따로 빼낸 파일은 다음과 같습니다.