질문과 답변

Extra Form

저 스크립트 초보라 많이 힘드네요;;

강좌에는 저장을 예로 설명했던데 장비는 어렵네요.

Who's 라유

?

안녕하세요~~~~~~~~~~~~~~~~~~~~

Comment '5'
  • profile
    습작 2011.08.19 00:41
    #==============================================================================
    # ■ Scene_Menu
    #------------------------------------------------------------------------------
    # 메뉴 화면의 처리를 실시하는 클래스입니다.
    #==============================================================================

    class Scene_Menu < Scene_Base
      #--------------------------------------------------------------------------
      # ● 오브젝트 초기화
      #     menu_index : 커멘드의 커서 초기 위치
      #--------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
      end
      #--------------------------------------------------------------------------
      # ● 개시 처리
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        create_command_window
        @gold_window = Window_Gold.new(0, 360)
        @status_window = Window_MenuStatus.new(160, 0)
      end
      #--------------------------------------------------------------------------
      # ● 종료 처리
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_menu_background
        @command_window.dispose
        @gold_window.dispose
        @status_window.dispose
      end
      #--------------------------------------------------------------------------
      # ● 프레임 갱신
      #--------------------------------------------------------------------------
      def update
        super
        update_menu_background
        @command_window.update
        @gold_window.update
        @status_window.update
        if @command_window.active
          update_command_selection
        elsif @status_window.active
          update_actor_selection
        end
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 윈도우의 작성
      #--------------------------------------------------------------------------
      def create_command_window
        s1 = Vocab::item
        s2 = Vocab::skill
        s3 = Vocab::status
        s4 = Vocab::save
        s5 = Vocab::game_end
        @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
        @command_window.index = @menu_index
        if $game_party.members.size == 0          # 파티 인원수가 0 명의 경우
          @command_window.draw_item(0, false)     # 아이템을 무효화
          @command_window.draw_item(1, false)     # 스킬을 무효화
          @command_window.draw_item(2, false)     # 스테이터스를 무효화
        end
        if $game_system.save_disabled             # 세이브 금지의 경우
          @command_window.draw_item(3, false)     # 세이브를 무효화
        end
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 선택의 갱신
      #--------------------------------------------------------------------------
      def update_command_selection
        if Input.trigger?(Input::B)
          Sound.play_cancel
          $scene = Scene_Map.new
        elsif Input.trigger?(Input::C)
          if $game_party.members.size == 0 and @command_window.index < 3
            Sound.play_buzzer
            return
          elsif $game_system.save_disabled and @command_window.index == 3
            Sound.play_buzzer
            return
          end
          Sound.play_decision
          case @command_window.index
          when 0      # 아이템
            $scene = Scene_Item.new
          when 1,2  # 스킬, 스테이터스
            start_actor_selection
          when 3      # 세이브
            $scene = Scene_File.new(true, false, false)
          when 4      # 게임 종료
            $scene = Scene_End.new
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 액터 선택의 개시
      #--------------------------------------------------------------------------
      def start_actor_selection
        @command_window.active = false
        @status_window.active = true
        if $game_party.last_actor_index < @status_window.item_max
          @status_window.index = $game_party.last_actor_index
        else
          @status_window.index = 0
        end
      end
      #--------------------------------------------------------------------------
      # ● 액터 선택의 종료
      #--------------------------------------------------------------------------
      def end_actor_selection
        @command_window.active = true
        @status_window.active = false
        @status_window.index = -1
      end
      #--------------------------------------------------------------------------
      # ● 액터 선택의 갱신
      #--------------------------------------------------------------------------
      def update_actor_selection
        if Input.trigger?(Input::B)
          Sound.play_cancel
          end_actor_selection
        elsif Input.trigger?(Input::C)
          $game_party.last_actor_index = @status_window.index
          Sound.play_decision
          case @command_window.index
          when 1  # 스킬
            $scene = Scene_Skill.new(@status_window.index)
          when 2  # 스테이터스
            $scene = Scene_Status.new(@status_window.index)
          end
        end
      end
    end

  • profile
    습작 2011.08.19 00:43
    #==============================================================================
    # ■ Scene_Status
    #------------------------------------------------------------------------------
    # 스테이터스 화면의 처리를 실시하는 클래스입니다.
    #==============================================================================

    class Scene_Status < Scene_Base
      #--------------------------------------------------------------------------
      # ● 오브젝트 초기화
      #     actor_index : 액터 인덱스
      #--------------------------------------------------------------------------
      def initialize(actor_index = 0)
        @actor_index = actor_index
      end
      #--------------------------------------------------------------------------
      # ● 개시 처리
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        @actor = $game_party.members[@actor_index]
        @status_window = Window_Status.new(@actor)
      end
      #--------------------------------------------------------------------------
      # ● 종료 처리
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_menu_background
        @status_window.dispose
      end
      #--------------------------------------------------------------------------
      # ● 원래의 화면으로 돌아온다
      #--------------------------------------------------------------------------
      def return_scene
        $scene = Scene_Menu.new(2)
      end
      #--------------------------------------------------------------------------
      # ● 다음 액터의 화면으로 전환
      #--------------------------------------------------------------------------
      def next_actor
        @actor_index += 1
        @actor_index %= $game_party.members.size
        $scene = Scene_Status.new(@actor_index)
      end
      #--------------------------------------------------------------------------
      # ● 이전 액터의 화면으로 전환
      #--------------------------------------------------------------------------
      def prev_actor
        @actor_index += $game_party.members.size - 1
        @actor_index %= $game_party.members.size
        $scene = Scene_Status.new(@actor_index)
      end
      #--------------------------------------------------------------------------
      # ● 프레임 갱신
      #--------------------------------------------------------------------------
      def update
        update_menu_background
        @status_window.update
        if Input.trigger?(Input::B)
          Sound.play_cancel
          return_scene
        elsif Input.trigger?(Input::R)
          Sound.play_cursor
          next_actor
        elsif Input.trigger?(Input::L)
          Sound.play_cursor
          prev_actor
        end
        super
      end
    end

  • profile
    습작 2011.08.19 00:44
    #==============================================================================
    # ■ Scene_File
    #------------------------------------------------------------------------------
    # 저장 파일 화면의 처리를 실시하는 클래스입니다.
    #==============================================================================

    class Scene_File < Scene_Base
      #--------------------------------------------------------------------------
      # ● 오브젝트 초기화
      #     saving     : 세이브 플래그 (false 라면 로드 화면)
      #     from_title : 타이틀의 「이어서 하기」로 불려 간 플래그
      #     from_event : 이벤트의 「세이브 화면의 호출」로 불려 간 플래그
      #--------------------------------------------------------------------------
      def initialize(saving, from_title, from_event)
        @saving = saving
        @from_title = from_title
        @from_event = from_event
      end
      #--------------------------------------------------------------------------
      # ● 개시 처리
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        @help_window = Window_Help.new
        create_savefile_windows
        if @saving
          @index = $game_temp.last_file_index
          @help_window.set_text(Vocab::SaveMessage)
        else
          @index = self.latest_file_index
          @help_window.set_text(Vocab::LoadMessage)
        end
        @savefile_windows[@index].selected = true
      end
      #--------------------------------------------------------------------------
      # ● 종료 처리
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_menu_background
        @help_window.dispose
        dispose_item_windows
      end
      #--------------------------------------------------------------------------
      # ● 원래의 화면에 돌아온다
      #--------------------------------------------------------------------------
      def return_scene
        if @from_title
          $scene = Scene_Title.new
        elsif @from_event
          $scene = Scene_Map.new
        else
          $scene = Scene_Menu.new(3)
        end
      end
      #--------------------------------------------------------------------------
      # ● 프레임 갱신
      #--------------------------------------------------------------------------
      def update
        super
        update_menu_background
        @help_window.update
        update_savefile_windows
        update_savefile_selection
      end
      #--------------------------------------------------------------------------
      # ● 세이브 파일 윈도우의 작성
      #--------------------------------------------------------------------------
      def create_savefile_windows
        @savefile_windows = []
        for i in 0..3
          @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
        end
        @item_max = 4
      end
      #--------------------------------------------------------------------------
      # ● 세이브 파일 윈도우의 해방
      #--------------------------------------------------------------------------
      def dispose_item_windows
        for window in @savefile_windows
          window.dispose
        end
      end
      #--------------------------------------------------------------------------
      # ● 세이브 파일 윈도우의 갱신
      #--------------------------------------------------------------------------
      def update_savefile_windows
        for window in @savefile_windows
          window.update
        end
      end
      #--------------------------------------------------------------------------
      # ● 세이브 파일 선택의 갱신
      #--------------------------------------------------------------------------
      def update_savefile_selection
        if Input.trigger?(Input::C)
          determine_savefile
        elsif Input.trigger?(Input::B)
          Sound.play_cancel
          return_scene
        else
          last_index = @index
          if Input.repeat?(Input::DOWN)
            cursor_down(Input.trigger?(Input::DOWN))
          end
          if Input.repeat?(Input::UP)
            cursor_up(Input.trigger?(Input::UP))
          end
          if @index != last_index
            Sound.play_cursor
            @savefile_windows[last_index].selected = false
            @savefile_windows[@index].selected = true
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 세이브 파일의 결정
      #--------------------------------------------------------------------------
      def determine_savefile
        if @saving
          Sound.play_save
          do_save
        else
          if @savefile_windows[@index].file_exist
            Sound.play_load
            do_load
          else
            Sound.play_buzzer
            return
          end
        end
        $game_temp.last_file_index = @index
      end
      #--------------------------------------------------------------------------
      # ● 커서를 아래에 이동
      #     wrap : rack-around 허가
      #--------------------------------------------------------------------------
      def cursor_down(wrap)
        if @index < @item_max - 1 or wrap
          @index = (@index + 1) % @item_max
        end
      end
      #--------------------------------------------------------------------------
      # ● 커서를 위에 이동
      #     wrap : rack-around 허가
      #--------------------------------------------------------------------------
      def cursor_up(wrap)
        if @index > 0 or wrap
          @index = (@index - 1 + @item_max) % @item_max
        end
      end
      #--------------------------------------------------------------------------
      # ● 파일명의 작성
      #     file_index : 세이브 파일의 인덱스 (03)
      #--------------------------------------------------------------------------
      def make_filename(file_index)
        return "Save#{file_index + 1}.rvdata"
      end
      #--------------------------------------------------------------------------
      # ● 타임 스탬프가 최신의 파일을 선택
      #--------------------------------------------------------------------------
      def latest_file_index
        index = 0
        latest_time = Time.at(0)
        for i in 0...@savefile_windows.size
          if @savefile_windows[i].time_stamp > latest_time
            latest_time = @savefile_windows[i].time_stamp
            index = i
          end
        end
        return index
      end
      #--------------------------------------------------------------------------
      # ● 세이브의 실행
      #--------------------------------------------------------------------------
      def do_save
        file = File.open(@savefile_windows[@index].filename, "wb")
        write_save_data(file)
        file.close
        return_scene
      end
      #--------------------------------------------------------------------------
      # ● 로드의 실행
      #--------------------------------------------------------------------------
      def do_load
        file = File.open(@savefile_windows[@index].filename, "rb")
        read_save_data(file)
        file.close
        $scene = Scene_Map.new
        RPG::BGM.fade(1500)
        Graphics.fadeout(60)
        Graphics.wait(40)
        @last_bgm.play
        @last_bgs.play
      end
      #--------------------------------------------------------------------------
      # ● 세이브 데이터의 기록
      #     file : 쓰기용 파일 오브젝트 (오픈이 끝난 상태)
      #--------------------------------------------------------------------------
      def write_save_data(file)
        characters = []
        for actor in $game_party.members
          characters.push([actor.character_name, actor.character_index])
        end
        $game_system.save_count += 1
        $game_system.version_id = $data_system.version_id
        @last_bgm = RPG::BGM::last
        @last_bgs = RPG::BGS::last
        Marshal.dump(characters,           file)
        Marshal.dump(Graphics.frame_count, file)
        Marshal.dump(@last_bgm,            file)
        Marshal.dump(@last_bgs,            file)
        Marshal.dump($game_system,         file)
        Marshal.dump($game_message,        file)
        Marshal.dump($game_switches,       file)
        Marshal.dump($game_variables,      file)
        Marshal.dump($game_self_switches,  file)
        Marshal.dump($game_actors,         file)
        Marshal.dump($game_party,          file)
        Marshal.dump($game_troop,          file)
        Marshal.dump($game_map,            file)
        Marshal.dump($game_player,         file)
      end
      #--------------------------------------------------------------------------
      # ● 세이브 데이터의 읽기
      #     file : 읽기용 파일 오브젝트 (오픈이 끝난 상태)
      #--------------------------------------------------------------------------
      def read_save_data(file)
        characters           = Marshal.load(file)
        Graphics.frame_count = Marshal.load(file)
        @last_bgm            = Marshal.load(file)
        @last_bgs            = Marshal.load(file)
        $game_system         = Marshal.load(file)
        $game_message        = Marshal.load(file)
        $game_switches       = Marshal.load(file)
        $game_variables      = Marshal.load(file)
        $game_self_switches  = Marshal.load(file)
        $game_actors         = Marshal.load(file)
        $game_party          = Marshal.load(file)
        $game_troop          = Marshal.load(file)
        $game_map            = Marshal.load(file)
        $game_player         = Marshal.load(file)
        if $game_system.version_id != $data_system.version_id
          $game_map.setup($game_map.map_id)
          $game_player.center($game_player.x, $game_player.y)
        end
      end
    end

  • profile
    습작 2011.08.19 00:45
    #==============================================================================
    # ■ Scene_End
    #------------------------------------------------------------------------------
    # 게임 종료 화면의 처리를 실시하는 클래스입니다.
    #==============================================================================

    class Scene_End < Scene_Base
      #--------------------------------------------------------------------------
      # ● 개시 처리
      #--------------------------------------------------------------------------
      def start
        super
        create_menu_background
        create_command_window
      end
      #--------------------------------------------------------------------------
      # ● 개시 후처리
      #--------------------------------------------------------------------------
      def post_start
        super
        open_command_window
      end
      #--------------------------------------------------------------------------
      # ● 종료 사전 처리
      #--------------------------------------------------------------------------
      def pre_terminate
        super
        close_command_window
      end
      #--------------------------------------------------------------------------
      # ● 종료 처리
      #--------------------------------------------------------------------------
      def terminate
        super
        dispose_command_window
        dispose_menu_background
      end
      #--------------------------------------------------------------------------
      # ● 원래의 화면에 돌아온다
      #--------------------------------------------------------------------------
      def return_scene
        $scene = Scene_Menu.new(4)
      end
      #--------------------------------------------------------------------------
      # ● 프레임 갱신
      #--------------------------------------------------------------------------
      def update
        super
        update_menu_background
        @command_window.update
        if Input.trigger?(Input::B)
          Sound.play_cancel
          return_scene
        elsif Input.trigger?(Input::C)
          case @command_window.index
          when 0  # 타이틀로 나감
            command_to_title
          when 1  # 프로그램 종료
            command_shutdown
          when 2  # 취소하기
            command_cancel
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 메뉴 화면계의 배경 갱신
      #--------------------------------------------------------------------------
      def update_menu_background
        super
        @menuback_sprite.tone.set(0, 0, 0, 128)
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 윈도우의 작성
      #--------------------------------------------------------------------------
      def create_command_window
        s1 = Vocab::to_title
        s2 = Vocab::shutdown
        s3 = Vocab::cancel
        @command_window = Window_Command.new(172, [s1, s2, s3])
        @command_window.x = (544 - @command_window.width) / 2
        @command_window.y = (416 - @command_window.height) / 2
        @command_window.openness = 0
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 윈도우의 해방
      #--------------------------------------------------------------------------
      def dispose_command_window
        @command_window.dispose
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 윈도우를 연다
      #--------------------------------------------------------------------------
      def open_command_window
        @command_window.open
        begin
          @command_window.update
          Graphics.update
        end until @command_window.openness == 255
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 윈도우를 닫는다
      #--------------------------------------------------------------------------
      def close_command_window
        @command_window.close
        begin
          @command_window.update
          Graphics.update
        end until @command_window.openness == 0
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 [타이틀로 나감] 선택시의 처리
      #--------------------------------------------------------------------------
      def command_to_title
        Sound.play_decision
        RPG::BGM.fade(800)
        RPG::BGS.fade(800)
        RPG::ME.fade(800)
        $scene = Scene_Title.new
        close_command_window
        Graphics.fadeout(60)
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 [프로그램 종료] 선택시의 처리
      #--------------------------------------------------------------------------
      def command_shutdown
        Sound.play_decision
        RPG::BGM.fade(800)
        RPG::BGS.fade(800)
        RPG::ME.fade(800)
        $scene = nil
      end
      #--------------------------------------------------------------------------
      # ● 커멘드 [취소하기] 선택시의 처리
      #--------------------------------------------------------------------------
      def command_cancel
        Sound.play_decision
        return_scene
      end
    end

  • profile
    습작 2011.08.19 00:46

    차례대로 메뉴, 상태, 세이브, 종료 씬입니다.

    메뉴에서 장비를 지우고, 나머지 씬들의 복귀 위치를 조절했습니다.

    그대로 긁어서 차례대로 추가해 주시면 됩니다.


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12387
RMXP 넷 플레이 서버켜는 방법 1 kjh5427 2011.08.20 1564
GM Game Maker - HP감소 시키는 방법 2 와라! 편의점 2011.08.20 2093
RM2k 번역 방법좀.. 3 GangSters 2011.08.20 1215
RMVX 이벤트 이동루트 질문 1 방황 2011.08.20 1551
RMXP 전투 불능 2 뿌붕 2011.08.19 1808
RMVX 파일이 열리지 않아 문의드립니다. 1 짱짱 2011.08.19 1326
RMVX 액알(Vampyr SBABS) 에서 몬스터 죽일때 죽인횟수/ 7 뿌잉브이 2011.08.19 1535
RMVX 통합맵칩이 도대채 뭔가요;; 1 elin 2011.08.19 2071
RMXP 전투 지고나서 쓰러지는 그래픽 변경이 잘 되지 않습니다. 2 file 구름의영혼 2011.08.19 1646
RMVX Vampyr SBABS9 관련 질문 2 grassmoon 2011.08.18 932
RMVX 세이브 크리스탈을 만들려고합니다 2 kallat 2011.08.18 1302
RMVX 파티클 엔진 스크립트 1 아담 2011.08.18 1716
RMVX 메뉴에서 장비를 없애는법 5 라유 2011.08.18 1022
RMVX 캐릭터의 옷을 갈아 입는 방법? 4 vx입문자? 2011.08.18 1921
RMVX 맵칩 크기 관련해서 질문입니다. 1 에야 2011.08.18 1606
RMXP RPG XP 암호화 1 외로운 총잡이 2011.08.17 2529
기타 게임 배포 방법 진구1123 2011.08.17 1239
RMXP 플래쉬파일 재생이 안돼요ㅠㅠㅠ file 호호홀 2011.08.17 1681
RMVX 총사용법 4 쌘모 2011.08.17 1479
RMVX 타이틀화면교체... 3 쌘모 2011.08.17 1519
Board Pagination Prev 1 ... 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 ... 516 Next
/ 516