질문과 답변

Extra Form


이 스크립트인데요 (백호님이 올려주신..)
7번 스킬을 배워야 8번 스킬 구매가 활성화되고
8번 스킬을 배워야 9번 스킬 구매가 활성화되고
이런 식으로 수정이 가능한지 부탁드리겠습니다 ㅎ..


Comment '4'
  • profile
    습작 2012.06.26 23:03

    0.

     

      단도직입적으로 해당 스크립트를 어떻게 수정해야 하는지 알려드리겠습니다.(코드를 보기 쉽게 설명은 파랑색으로 적습니다.)


    module RPG

      class Skill

        def price

          case id

          #==========================

          # CONFIG PRICE

          #==========================

          # use 

          # when skill_id then return price

          when 1 then return 50

          when 57 then return 75

          end

          return 10

        end

        def llevel

          case id

          #==========================

          # CONFIG LEVEL

          #==========================

          # use

          # when skill_id then return level

          when 57 then return 2

          end

          return 1

        end

        def precedence

          case id

          #==========================

          # 먼저 알고 있어야 하는 스킬 리스트

          #==========================

          # 사용법

          # when 배울 스킬 아이디 then return 미리 배워야 하는 스킬 아이디

          when 2 then return 1 # id 2번 스킬을 배우기 위해서는 id 1번 스킬을 알아야 합니다요. 고갱님.

          when 9 then return 8 # 고갱님 아직도 8번 안배우고 오셨는감요?

          end

          return nil

        end

      end

      class Class

        def learnskills

          case id

          #==========================

          # CONFIG CLASS SKILLS

          #==========================

          # use

          # when class_id then return [skill id's here]

          when 1 then return [57, 58, 59, 60]

          when 2 then return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 81]

          when 7 then return [69, 70, 71, 72, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80]

          when 8 then return [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56]

          end

          return []

        end

      #==========================

      # END CONFIG

      #==========================

      end

    end


      우선 먼저 배워야 하는 스킬 데이터 베이스를 추가해 봅시다. 붉은 색 문자 부분은 제가 추가한 스크립트 코드이며, 녹색 부분은 그 사용법을 안내하고 있는 주석내용입니다.(주석은 필요없다면 추가하지 않으셔도 되는 부분입니다.)


    class Window_SkillStatus2 < Window_Selectable

      def initialize

        super(368, 128, 272, 352)

        self.contents = Bitmap.new(width - 32, height - 32)

        refresh

        self.z = 200

        self.active = false

        self.index = -1

      end

      def refresh

        self.contents.clear

        @item_max = $game_party.actors.size

        for i in 0...$game_party.actors.size

          x = 64

          y = i * 80

          actor = $game_party.actors[i]

          classs = $data_classes[$game_actors[actor.id].class_id]

          draw_actor_graphic(actor, x - 40, y + 60)

          draw_actor_name(actor, x - 13, y + 10)

          if actor.skill_learn?($thing.id)

            self.contents.font.color = crisis_color

            $text = "Aquired"

          elsif GameGuy::UseClasses

            if classs.learnskills.include?($thing.id) && $thing.llevel <= actor.level

              if $thing.precedence == nil or actor.skill_learn?($thing.precedence)

                self.contents.font.color = normal_color

                $text = "Can Learn"

              else

                self.contents.font.color = disabled_color

                $text = "너님" + $data_skills[$thing.precedence].name + " 먼저 배워야 함요."

              end

            elsif classs.learnskills.include?($thing.id) && $thing.llevel > actor.level

              self.contents.font.color = disabled_color

              $text = "Can Learn At Level " + $thing.llevel.to_s

            else

              self.contents.font.color = disabled_color

              $text = "Can't Learn"

            end

          else

            if actor.level >= $thing.llevel

              if $thing.precedence == nil or actor.skill_learn?($thing.precedence)

                self.contents.font.color = normal_color

                $text = "Can Learn"

              else

                self.contents.font.color = disabled_color

                $text = "너님" + $data_skills[$thing.precedence].name + " 먼저 배워야 함요."

              end

            else

              self.contents.font.color = disabled_color

              $text = "Can Learn At Level " + $thing.llevel.to_s

            end

          end

          self.contents.draw_text(x - 13, y + 40, 200, 32, $text)

        end

      end

      def update_cursor_rect

        if @index < 0

          self.cursor_rect.empty

        else

          self.cursor_rect.set(0, @index * 80, self.width - 32, 80)

        end

      end

    end


      그리고 이번에는 상태창에서 나타낼 문구 부분을 수정해 봅시다. 마찬가지로 붉은 부분이 제가 추가로 삽입한 코드 입니다. 두군데나 수정해 줘야 하는 까닭은 이놈의 스크립트가 직업별 스킬 사용판정을 쓸경우와 안쓸경우로 나눠서 판정하기 때문입니다.


    class SkillShop

      def initialize(skills)

        @skills = skills

      end

      def main

        @command = Window_SkillCommand.new

        @help_window = Window_Help.new

        @skillbuy = Window_SkillBuy.new(@skills)

        @skillbuy.active = false

        @skillbuy.help_window = @help_window

        $thing = @skillbuy.skill

        @status = Window_SkillStatus2.new

        #@status.visible = false

        @gold = Window_Gold.new

        @gold.x = 480

        @gold.y = 64

        

        Graphics.transition

        loop do

          Graphics.update

          Input.update

          update

          if $scene != self

            break

          end

        end

        Graphics.freeze

        @gold.dispose

        @skillbuy.dispose

        @help_window.dispose

        @command.dispose

        @status.dispose

      end

      def update

        @gold.update

        @status.update

        @gold.refresh

        @command.update

        @skillbuy.update

        @help_window.update

        $thing = @skillbuy.skill

        @status.refresh

        if @command.active

          update_command

          return

        end

        

        if @status.active

          update_status

          return

        end

        

        if @skillbuy.active

          update_buy

          return

        end

      end

      

      def update_buy

        if Input.trigger?(Input::B)

          $game_system.se_play($data_system.cancel_se)

          @skillbuy.active = false

          @command.active = true

          return

        end

        if Input.trigger?(Input::C)

          $game_system.se_play($data_system.decision_se)

          @skillbuy.active = false

          @status.active = true

          @status.visible = true

          @status.index = 0 if @status.index == -1

        end

      end

      

      def update_command

        if Input.trigger?(Input::B)

          $game_system.se_play($data_system.cancel_se)

          $scene = Scene_Map.new

          return

        end

        if Input.trigger?(Input::C)

          $game_system.se_play($data_system.decision_se)

          case @command.index

          when 0

            @command.active = false

            @skillbuy.active = true

          when 1

            $game_system.se_play($data_system.cancel_se)

            $scene = Scene_Map.new

          end

          return

        end

      end

      

      def update_status

        if Input.trigger?(Input::B)

          @status.active = false

          @skillbuy.active = true

          return

        end

        if Input.trigger?(Input::C)

          price = @skillbuy.skill.price

          @actort = $game_party.actors[@status.index]

          enabled = (price <= $game_party.gold)

          

          if enabled

            if @actort.skill_learn?(@skillbuy.skill.id)

              $game_system.se_play($data_system.buzzer_se)

              return

            end

            if GameGuy::UseClasses

              if $data_classes[@actort.class_id].learnskills.include?(@skillbuy.skill.id) && @actort.level >= @skillbuy.skill.llevel && (@skillbuy.skill.precedence == nil or @actort.skill_learn?(@skillbuy.skill.precedence))

                @actort.learn_skill(@skillbuy.skill.id)

                $game_party.lose_gold(@skillbuy.skill.price)

                $game_system.se_play($data_system.decision_se)

                @skillbuy.active = true

                @status.active = false

                @status.refresh

                return

              else

                $game_system.se_play($data_system.buzzer_se)

                return

              end

            else

              if @actort.level >= @skillbuy.skill.llevel && (@skillbuy.skill.precedence == nil or @actort.skill_learn?(@skillbuy.skill.precedence))

                @actort.learn_skill(@skillbuy.skill.id)

                $game_party.lose_gold(@skillbuy.skill.price)

                $game_system.se_play($data_system.decision_se)

                @skillbuy.active = true

                @status.active = false

                @status.refresh

              else

                $game_system.se_play($data_system.buzzer_se)

                return

              end

              return

            end

            

          else

            $game_system.se_play($data_system.buzzer_se)

            return

          end

        end

      end

     

    end


      마지막으로 실제로 스킬 구입씬에서 너님은 안됨! 하고 부저소리를 울려줄 곳입니다. 마찬가지로 붉은 색이 제가 추가한 코드이므로 잘 적어줍시다.


      여기까지 완료하셨다면 해당 스크립트는 아직 때가 되지 않은 불민한 플레이어의 캐릭터들에게 가차없는 징벌을 내릴 것입니다. 그럼 완성된 게임으로 게임 자료실에서 뵙길 바랍니다. 좋은 게임 제작 활동하세요.^^


  • profile
    습작 2012.06.26 23:06

    1.


      덧붙여 질문의 제목을 [Skill Shop 스크립트 선행스킬 판정 추가] 정도로 수정해 주신다면 다른 질문자들께서 동일한 질문에 대해서 보다 쉽게 검색하고 찾을 수 있을거라 생각합니다.

     


  • profile
    습작 2012.06.26 23:14

    2.

     

      다시보니 잘 못 작성된 코드가 몇군데 있어서 수정했습니다. 0번 댓글에 그 내용이 업데이트 되었으니 확인하시고 다시 수정하시면 됩니다.



  • ?
    모모아이 2012.06.27 18:11
    제목 수정했구요 ㅠㅠ 감사합니다 ㅠ

List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12392
스크립트 사용 RMXP UMS 스크립트 오류 해결좀요 ㅠㅠ 오예쓰 2019.04.05 99
RMXP TV오브젝트를 만드는데 모르겠어서 질문 드립니다 4 홍짱 2011.09.07 1526
RMXP TRPG 방식으로 구현 가능한가요? siraisi 2011.01.04 481
RMXP TITLE화면. 정지방법 1 3pc_SYcW 2011.03.02 788
RMXP TCG게임을 만드려면 1 리버 2010.12.12 997
RMXP SRPG 형식을 만드려고 합니다! 1 밀티슈 2017.02.26 230
RMXP SRPG 컨버터 XP 스크립트 스킬 오류에 관해서. 3 file 현문 2013.01.14 803
RMXP SRPG 제작 시스템 "GubiD's Tactical Battle System"질문이요! 2 file Blur 2014.01.26 925
RMXP SP를 모두 소모하면 HP를 달게 할 수 있을까요? 6 file 마늘호랑이 2013.06.08 793
RMXP Skill Shop 스크립트 선행스킬 판정 추가 방법 4 모모아이 2012.06.26 997
RMXP Shun 님의 마우스 스크립트 file 이랏챠 2013.09.29 1214
RMXP se반복하는 스크립트는 없을까요? 2 CJYG* 2012.03.26 2134
RMXP SE가 재생 도중에 갑자기 끊기고 게임 렉이 심합니다. 1 CJYG* 2011.12.28 2313
RMXP self.contents 선언 관련 1 Irr 2014.06.13 823
RMXP Scene_Tilte 스크립트 의 Window_Command 오류입니다. 2 말짱꽝이지롱 2012.08.22 1258
RMXP Scene 전에꺼 자동으로 찾아서 돌려주는... 5 코아 코스튬 2010.10.21 621
RMXP SBS5.5 오류메시지 "erro no Script o SDK Part II, em 305 na linha 'Argumenterror' wrong number of arguments(2 for 0) 2 file 성히버섯 2011.01.28 809
RMXP SBABS 파티원 멤버 삭제가 안되네요. (데모업로드) file 쿠쿠 2013.02.03 964
RMXP rtp파일 적용하는 법을 알고 싶습니다! 참고로 rmxp입니다 2 식물이심 2014.09.09 522
RMXP RTP에 대해 1 네메닷 2011.03.22 1400
Board Pagination Prev 1 ... 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 ... 90 Next
/ 90