질문과 답변

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 12393
RMMV 내 컴에 DLC 이거 있던데 이거 사용해도 되나요? 3 file 해킹당한해커 2018.09.14 150
RMMV 이거 무기,장비, 삭제하는 방법 있나요??? file 해킹당한해커 2018.09.16 77
기타 비영리 목적 취향 게임 배포 심의에 관해 4 라카에 2018.09.16 524
RMMV 이미지 불러서 맵에 고정시키는 플러그인 없나요??? 2 해킹당한해커 2018.09.16 138
RMMV 스프라이트 객체에서 이벤트 객체를 참조하는 식별자 위치 관련. 5 A구몽 2018.09.16 97
사이트 이용 알만툴 혹은 자바스크립트 기초 '유료' 강의 사이트를 찾습니다! 파란소리 2018.09.17 134
RMMV 게임도중에 몇번 죽었는지 알려주는 플러그인 없나요??? 1 해킹당한해커 2018.09.18 102
RMVXA 캐릭터 선택하게 하는법 3 Jmyu 2018.09.18 119
RMMV 적의 공격력이 ? 이하일 때 발동하는 기술 1 리팝이 2018.09.18 87
RMVXA 캐릭터칩 규격을 변경할수는 없나요? 1 태떡 2018.09.19 165
RMMV 스크립트로 원하는 문자&숫자&변수 출력 방법 질문드립니다. 비형 2018.09.19 317
RMXP 이동 경로 설정에서요 4 file 오늘밤어때 2018.09.19 125
기타 자바스크립트 상태표시줄 소스가 무엇으로 바뀌었는지 알고싶습니다. 2 file 위크로스 2018.09.20 64
RMMV 파티원수를 4명으로 제한하고 싶습니다. 1 초코엘프 2018.09.22 172
RMMV 미니맵 플러그인을 사용하는데, 키 한 개로 끄고 켜고 싶습니다. file 파란소리 2018.09.22 143
RMXP 오프닝 apple0923 2018.09.23 108
RMVXA 저해상도 게임 화면의 확대 방법에 대해서 질문 드립니다. :) LSW.indie 2018.09.23 194
RMXP 윈도우 메세지 박스 스크립트 오류 file 오예쓰 2018.09.25 244
RMMV RPG MAKER MV 로고 없에는 방법있나요? 2 file 대나무빵 2018.09.25 998
RMMV MV 메뉴의 체력과 마나 그리고 돈을 변수로 지정하고싶습니다. 1 야미만두 2018.09.26 251
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