질문과 답변

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 철권처럼 게이지바를 만들고 싶습니다 2 abang 2020.11.15 236
RMVX 첨부한 변수 이용 설명 부탁합니다. 8 file 뾰롱뾰롱 2011.02.22 693
RMVX 첫번째 문자의 표시와 두번째 문장의 표시를 다르게 하기.. 1 vxxxv 2013.08.17 853
RMVX 체력 수치로 조건분기 하는 법. 1 카프리강 2012.10.02 4852
RMVXA 체력 재생 시간단위로 바꾸기..? 5 q평e평rq평e평 2014.10.25 422
RMVX 체력 퍼센트에따라 이미지 바꾸는 방법좀 가르쳐주세요 2 sakuragi 2015.01.07 336
RMMV 체력, 레벨 바를 아예 없애버리고 싶은데.. 혹시 아시는분 있으신가요? 은빙 2016.05.30 120
RMVXA 체력바 표시 스크립트 수정 프크 2015.10.29 198
RMVXA 체력바를 만드려고합니다. 어떻게 만드는지 몰라서 질문드려요. 2 plo 2013.09.25 1021
이벤트 작성 RMVXA 체력에 따라 자신의 이동속도 감소 이벤트 만드는 법 1 슈필러 2019.02.18 123
RMVXA 체력을 사용하여 발동하는 스킬. 1 시로명운 2014.04.30 566
RMVX 체력을 소비하고 쓰는 스킬을 만들수는 없나요 껌손 2011.03.10 944
RMVX 체력의 표시를 하려는데 그림의 표시 번호 제한에서 막혔습니다..ㅠ 11 하얀악어 2014.01.03 843
RMMV 체력이 낮은 아군이 받는 공격을 대신 받아주는 스킬을 만들 수 있나요? PRS 2017.09.07 116
RMVXA 체력이 높아지면 숫자가 압축됩니다 2 file 비백 2015.06.24 161
RMVX 체력이 닳을경우 케릭터의 모습이 색조변경(빨강)으로 바뀌게 하고싶습니다. 41 하얀악어 2014.01.10 608
RMMV 체력이 일정 이하로 내려가면 자동으로 힐스킬을 쓰게하고싶은데 7 잠행인 2016.07.24 153
RMXP 체스판 퀸 8개 서로 공격못하게 배치하기 문제를 알만툴에 구현해보려고 합니다만... 2 file 종이맛쿠키 2016.11.17 255
RMVXA 체인, 혹은 협동 비슷한 스킬같은걸 넣고 싶은데요. 2 꼭해볼테다 2013.08.05 835
RMMV 체크박스가 안보이는 현상 해결방법 부탁드립니다. (윈도우10) 3 file 임프R 2015.10.27 261
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