질문과 답변

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 12391
스크립트 사용 RMVXA 외국 게임에 적용된 스크립트를 복사하는데 오류가 생깁니다. 3 file 592 2020.10.08 138
스크립트 사용 RMMV 패럴랙스 맵핑에서 그림이 캐릭터 위로 표시되는 오류 아방스여 2020.02.28 138
이벤트 작성 RMMV 그림표시 없애는 법 1 퐁핑퐁 2019.07.06 138
RMVX 걷는 소리를 적용하는 도중에 오류가 떴습니다 2 냥찌 2017.07.07 138
RMMV 맵상에서의 기본 보행속도 변경이 궁금합니다. 흰자 2017.03.12 138
RMMV 일본MV 게임 그냥 다운,사용시 언어 버그 생기나요? 1 Cuz_Hoon 2017.07.23 138
RMVX 그림의 표시 이겸 2016.08.22 138
RMVXA RPG VX ACE 라이트 버전을 사용하시는 분 계신가요? 1 hyunseo1987 2016.02.16 138
RMVXA parallex타일이뭔가요? 1 rc 2015.10.09 138
RMVXA 스크립트가 실행된 것을 인식하는 방법 1 흰강아지 2015.01.23 138
RMVXA 설정해놓은 것과 다른 그래픽이 나옵니다. 2 file 에이스 2015.01.15 138
기타 RMMZ 현실 시간에 맞춘 이벤트에 관하여 2 레기우스州 2021.02.22 138
RMVXA 대쉬 기능 사용 시 적의 이동속도가 빠르게 변하는 법 2 707 2018.08.19 138
RMVXA protection error 103이라는 에러가 떠요 file Mixnuts 2015.05.11 138
기타 이게 원래이런건가요? 3 file 국허 2015.05.23 138
플러그인 추천 RMMV 캐릭터 별로 능력치 성장을 다르게 할 수 있는 플러그인이 있나요? 1 PPPL 2020.05.27 138
기타 RPG MAKER fksmxm 라는 툴을 소개 받았는데 , 이 게임툴은 자바스크립트만 지원하나요 ?? 1 유아린 2016.12.31 138
RMVXA VXA 환경변수 취득 관련 질문을 하고 싶어요! 2 file 안모리 2018.04.30 138
RMVXA 문자입력 한글화 질문 입니당 4 file 파랑빛 2016.07.15 138
RMVXA 메세지 창을 띄워 놓은 채로 조작 가능하게 2 2016.07.12 138
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