XP 스크립트

skillshoop.png 

 

스크립트

 #===============================================================================
# Skill Shop
# Author: Game_guy
# Date: June 7th, 2009
# Version: 1.8
#===============================================================================
#
# Intro:
# What this script does is act as a shop but sells skills instead.
#
# Instructions:
# 1: First how do you want it setup? Theres two ways
#    1: -Any person can learn any skill
#    or
#    2: -Classes learn different skills then other classes
#
#    Go down to UseClasses and set it to false for 1: or true for 2:
 
# 2: Ok now that thats over lets move onto price. Go down to CONFIG PRICE and follow
#    the instructions there.
#  
# 3: Skip this step if you set UseClasses to false.
#    Go to CONFIG CLASS SKILLS and follow the instructions there.
#   
# 4: Ok so everythings setup now. Time to actually find out how to open the
#    skillshop right? You use this line
#    $scene = SkillShop.new([skill id's go here])
#    example
#    $scene = SkillShop.new([1, 2]) will make a shop with the skills
#    Heal and Great Heal
#
# 5: Ok the script now is able to make it where only skills are learnable at
#    certain levels. Go to CONFIG LEVEL and follow instructions there.
#===============================================================================
module GameGuy
  #==========================
  # BEGIN CONFIG
  #==========================
  UseClasses = true # if false anyone can learn any skill
                     # if true only classes can learn the defined skills
end
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
  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_SkillCommand < Window_Selectable
  def initialize
    super(0, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 2
    @column_max = 2
    @commands = ["Learn", "Exit"]
    refresh
    self.index = 0
  end
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def draw_item(index)
    x = 4 + index * 240
    self.contents.draw_text(x, 0, 128, 32, @commands[index])
  end
end
 
class Window_SkillBuy < Window_Selectable
  def initialize(shop_goods)
    super(0, 128, 368, 352)
    @skill_shop_goods = shop_goods
    self.active = false
    refresh
    self.index = 0
  end
  def skill
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@skill_shop_goods.size
      skill = $data_skills[@skill_shop_goods[i]]
      if skill != nil
        @data.push(skill)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    skill = @data[index]
    price = skill.price
    enabled = (price <= $game_party.gold)
    if enabled
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
    self.contents.draw_text(x + 240, y, 88, 32, price.to_s, 2)
  end
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  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
          self.contents.font.color = normal_color
          $text = "Can Learn"
        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
          self.contents.font.color = normal_color
          $text = "Can Learn"
        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
            @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
            @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

 

사용법

<기본 사용법>
이벤트 편집창에서 '스크립트'를 추가 하시고 다음 스크린샷과 같이 입력합니다.
use1.jpg
Tip. 전체 스킬을 목록에 나타나게 하시려면 다음과 같이 입력합니다.
skills = (1...$data_skills.size).to_a
$scene = SkillShop.new(skills)

<가격 수정/추가 방법>
스크립트 에디터에서 스킬샵 스크립트를 여시고 아래 지시대로 수정/추가 합니다.use_2.jpg


스크립트 출처 : http://www.hbgames.org/forums

Comment '16'
  • ?
    하얀모자 2009.08.25 07:48

    괜찮긴한데.. 내 껀 배틀이 아니라서..

  • ?
    해파리 2009.08.31 19:24

    흠.. 이해가 않되내

  • profile
    에단 2009.09.03 18:16
    신기하군요
  • ?
    G MAX 2009.09.04 12:26

    ㅇㅅㅇ;

  • ?
    Amaster 2009.10.10 11:47

    무지 좋을것같군요! 근데

    잘 이해가 안감 ;

  • ?
    만득이 2009.10.25 04:36

    좋은 스크립트 감사합니다..

    더욱더 발전하시길 바랍니다..

  • ?
    용호작무 2009.10.27 08:22

    헝헝 미국거로군...

  • ?
    rpg게임만들기왕 2009.10.31 19:20
    오우오우.. 근데 영어라... 고치려면 고칠수는잇지만 귀찮은..ㅇㅅㅇ
  • ?
    사과나무 2010.01.31 17:32

    영어네요 쩝 'ㅅ'

    어쨋든 해석해서 써야겠습니다

  • ?
    티파니 2010.02.01 11:27

    와좋네요..ㅋ

  • ?
    Gora 2010.02.28 04:00

    이거 돈말고 다른거로 사지는 못하나욤?

  • ?
    月光 2010.04.20 18:33

    감사합니다~

  • ?
    케니타인 2010.05.20 21:09

    고맙습니다

  • ?
    이승표 2010.07.25 13:32

  • ?
    아사야 2011.06.16 19:31

    흠... 액터마다 스킬 다르게 배우는거랑 스킬에 레벨제한 거는거까진 알았는데... 스킬샵에 원하는 스킬만 팔게 하는걸 못하겠네요 ㄷㄷ? 영어따위 ㅠㅠ

  • ?
    기라티나 2012.01.10 17:36

    감사합니다


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
961 전투 XAS Hero Edition v3.82 19 아방스 2010.12.27 4346
960 메뉴 기본메뉴 뜯어고친것. (스샷추가) 6 file 백호 2009.02.22 4313
959 기타 쓸만한스크립트61개포함 28 file 궭크이 2012.01.09 4296
958 키입력 한글입력기 6 백호 2009.02.22 4280
957 온라인 온라인스크립트 실행방법 13 file 백호 2009.02.22 4275
956 HUD 캐릭터 아래 SP,HP표시해주는 스크립트 33 file 김!제스! 2010.08.04 4269
955 액알입니다.정말 확신함 12 dkqkfsoatp 2007.12.13 4266
954 타이틀/게임오버 [펌]색다른 게임오버 스크립트 14 file 또라에몽 2010.05.09 4265
953 기타 XP 각종 스크립트입니다. 36 file 쿠도신이치 2009.04.26 4264
952 이동 및 탈것 아하! 그렇구나의 3D 신기술 체험 3 14 아하!잘봤어요. 2010.02.28 4258
951 기타 말풍선 스크립트. 62 file 『동그라미』♥ 2010.02.04 4254
950 전투 사이드뷰 전투(보행그래픽) 15 file 백호 2009.02.21 4243
» 스킬 스킬샵 스크립트 16 file 독도2005 2009.08.24 4217
948 메인화면에 별똥별 효과 6 file 아방스 2007.11.09 4217
947 기타 [게이지바]게이지바 스크립트 2.5 (실용적?) 17 file 코아 코스튬 2010.12.05 4216
946 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4205
945 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4204
944 미니맵 [헬악이님 제보] 단축키 미니맵 만들기!!| 13 file 아방스 2007.11.09 4191
943 HUD 맵 이름 표시와 미니맵을 같이하자 8 file 뮤리온。 2011.10.08 4190
942 전투 ATB시스템 입니다. [스샷 첨부] 17 백호 2009.02.22 4181
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52