XP 스크립트

#==============================================================================
# Cheats Input Script - v1.2 - by BudsieBuds
#------------------------------------------------------------------------------
#  NOTE: Start editing at line 68 and stop editing at '# STOP EDITING \'.
#==============================================================================


#==============================================================================
# ** Scene_Cheats
#------------------------------------------------------------------------------
#  by BudsieBuds
#==============================================================================

class Scene_Cheats
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make windows
    @edit_window = Window_CheatsEdit.new
    @input_window = Window_CheatsInput.new
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @edit_window.dispose
    @input_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @edit_window.update
    @input_window.update
    # If B button was pressed
    if Input.repeat?(Input::B)
      # If cursor position is at 0
      if @edit_window.index == 0
        return
      end
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Delete text
      @edit_window.back
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If cursor position is at [OK]
      if @input_window.character == nil
        @cheat_word = @edit_window.cheat.downcase

=begin
# START EDITING //

===============================================================================

  The cheat that you have to input:
    elsif @cheat_word == "Put the cheat you want to use here."

-------------------------------------------------------------------------------

  For item(s):
    $game_party.gain_item(Item ID, How many)

  For gold:
    $game_party.gain_gold(How many)

  For weapon(s):
    $game_party.gain_weapon(Weapon ID, How many)

  For armor(s):
    $game_party.gain_armor(Armor ID, How many)

  For skill(s):
    $game_party.actors[Actor ID].learn_skill(Skill ID)

  For adding (an) actor(s):
    $game_party.add_actor(id)

-------------------------------------------------------------------------------

  This is the verification sound
    $game_system.se_play($data_system.decision_se)

-------------------------------------------------------------------------------

    Your cheat can have a maximum of 17 letters.
    The first cheat has to start with 'if'.
    The cheates coming after that have to start with 'elsif'.

===============================================================================
=end

  if @cheat_word == "iamrich"
    $game_party.gain_gold(500)
    $game_system.se_play($data_system.decision_se)

  elsif @cheat_word == "iamarealfighter"
    $game_party.gain_weapon(1, 1)
    $game_party.gain_armor(21, 1)
    $game_system.se_play($data_system.decision_se)

  elsif @cheat_word == "iloveitems"
    for i in 1...$data_items.size
      $game_party.gain_item(i, 10)
      $game_system.se_play($data_system.decision_se)
    end

  elsif @cheat_word == "somehelpplease"
    $game_party.add_actor(2)
    $game_system.se_play($data_system.decision_se)

# STOP EDITING \

          else
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
          end
        # Switch to map screen
        $scene = Scene_Map.new
        return
      end
      # If text character is empty
      if @input_window.character == ""
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Add text character
      @edit_window.add(@input_window.character)
      return
    end
  end
end


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  by BudsieBuds
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Graphic
  #    icon  : icon
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_icon_graphic(icon, x, y)
    bitmap = RPG::Cache.icon(icon)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end


#==============================================================================
# ** Window_CheatsEdit
#------------------------------------------------------------------------------
#  by BudsieBuds
#==============================================================================

class Window_CheatsEdit < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader  :cheat                    # cheat
  attr_reader  :index                    # cursor position
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 128)
    self.contents = Bitmap.new(width - 32, height - 32)
    @max_char = 17
    @index = 0
    @cheat = ""
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Add Character
  #    character : text character to be added
  #--------------------------------------------------------------------------
  def add(character)
    if @index < @max_char and character != ""
      @cheat += character
      @index += 1
      refresh
      update_cursor_rect
    end
  end
  #--------------------------------------------------------------------------
  # * Delete Character
  #--------------------------------------------------------------------------
  def back
    if @index > 0
      # Delete 1 text character
      name_array = @cheat.split(//)
      @cheat = ""
      for i in 0...name_array.size-1
        @cheat += name_array[i]
      end
      @index -= 1
      refresh
      update_cursor_rect
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Draw cheat
    name_array = @cheat.split(//)
    for i in 0...@max_char
      c = name_array[i]
      if c == nil
        c = "_"
      end
      x = (i + 1) * 32
      self.contents.draw_text(x, 32, 28, 32, c, 1)
    end
    # Draw graphic
    draw_icon_graphic("cheat", 16, 60)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    x = (@index + 1) * 32
    self.cursor_rect.set(x, 32, 28, 32)
  end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
  def update
    super
    update_cursor_rect
  end
end


#==============================================================================
# ** Window_CheatsInput
#------------------------------------------------------------------------------
#  by BudsieBuds
#==============================================================================

class Window_CheatsInput < Window_Base
  CHARACTER_TABLE =
  [
    "A","B","C","D","E",
    "F","G","H","I","J",
    "K","L","M","N","O",
    "P","Q","R","S","T",
    "U","V","W","X","Y",
    "Z"," "," "," "," ",
    "+","-","*","/","!",
    "1","2","3","4","5",
    "" ,"" ,"" ,"" ,"" ,
    "a","b","c","d","e",
    "f","g","h","i","j",
    "k","l","m","n","o",
    "p","q","r","s","t",
    "u","v","w","x","y",
    "z"," "," "," "," ",
    "#","$","%","&","@",
    "6","7","8","9","0",
    "" ,"" ,"" ,"" ,"" ,
  ]
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 128, 640, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    @index = 0
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Text Character Acquisition
  #--------------------------------------------------------------------------
  def character
    return CHARACTER_TABLE[@index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...90
      x = 140 + i / 5 / 9 * 180 + i % 5 * 32
      y = i / 5 % 9 * 32
      self.contents.draw_text(x, y, 32, 32, CHARACTER_TABLE[i], 1)
    end
    self.contents.draw_text(428, 9 * 32, 48, 32, "OK", 1)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor is positioned on [OK]
    if @index >= 90
      self.cursor_rect.set(428, 9 * 32, 48, 32)
    # If cursor is positioned on anything other than [OK]
    else
      x = 140 + @index / 5 / 9 * 180 + @index % 5 * 32
      y = @index / 5 % 9 * 32
      self.cursor_rect.set(x, y, 32, 32)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If cursor is positioned on [OK]
    if @index >= 90
      # Cursor down
      if Input.trigger?(Input::DOWN)
        $game_system.se_play($data_system.cursor_se)
        @index -= 90
      end
      # Cursor up
      if Input.repeat?(Input::UP)
        $game_system.se_play($data_system.cursor_se)
        @index -= 90 - 40
      end
    # If cursor is positioned on anything other than [OK]
    else
      # If right directional button is pushed
      if Input.repeat?(Input::RIGHT)
        # If directional button pressed down is not a repeat, or
        # cursor is not positioned on the right edge
        if Input.trigger?(Input::RIGHT) or
          @index / 45 < 3 or @index % 5 < 4
          # Move cursor to right
          $game_system.se_play($data_system.cursor_se)
          if @index % 5 < 4
            @index += 1
          else
            @index += 45 - 4
          end
          if @index >= 90
            @index -= 90
          end
        end
      end
      # If left directional button is pushed
      if Input.repeat?(Input::LEFT)
        # If directional button pressed down is not a repeat, or
        # cursor is not positioned on the left edge
        if Input.trigger?(Input::LEFT) or
          @index / 45 > 0 or @index % 5 > 0
          # Move cursor to left
          $game_system.se_play($data_system.cursor_se)
          if @index % 5 > 0
            @index -= 1
          else
            @index -= 45 - 4
          end
          if @index < 0
            @index += 90
          end
        end
      end
      # If down directional button is pushed
      if Input.repeat?(Input::DOWN)
        # Move cursor down
        $game_system.se_play($data_system.cursor_se)
        if @index % 45 < 40
          @index += 5
        else
          @index += 90 - 40
        end
      end
      # If up directional button is pushed
      if Input.repeat?(Input::UP)
        # If directional button pressed down is not a repeat, or
        # cursor is not positioned on the upper edge
        if Input.trigger?(Input::UP) or @index % 45 >= 5
          # Move cursor up
          $game_system.se_play($data_system.cursor_se)
          if @index % 45 >= 5
            @index -= 5
          else
            @index += 90
          end
        end
      end
      # If L or R button was pressed
      if Input.repeat?(Input::L) or Input.repeat?(Input::R)
        # Move capital / small
        $game_system.se_play($data_system.cursor_se)
        if @index < 45
          @index += 45
        else
          @index -= 45
        end
      end
    end
    update_cursor_rect
  end
end
=======================================================================
첨부 그림은 icons파일에 넣어주시고
불러오는 방법은 $scene = Scene_Cheats.new

그리고 치트를 사용했을시 보상은
elsif @cheat_word == "iamarealfighter"
    $game_party.gain_weapon(1, 1)
    $game_party.gain_armor(21, 1)
    $game_system.se_play($data_system.decision_se)
이걸 건들어주시면 되고
만약 더 추가를 원하면
if와 elsif를 사용하시면 됩니다

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
941 퀘스트 퀘스트 시스템 # 번역 24 빗자루씨 2010.02.09 4035
940 퀘스트 퀘스트 다이어리 15 백호 2009.02.21 4406
939 전투 쿼터뷰 전투 스크립트 3 file 백호 2009.02.21 2869
938 메뉴 콤보 스크립트 백호 2009.02.22 1399
937 타이틀/게임오버 코아 코스튬씨의 타이틀 랜덤출력 1.5를 SDK2용으로 편집한 것(수정). file Alkaid 2010.09.29 1753
936 이름입력 케릭터 위에 또는 NPC 위에 이름 뛰우기 [헬악이님 제공] 49 file 아방스 2007.11.09 6405
935 전투 캐릭터고르기스크립트? ps인간 2009.01.23 3263
934 전투 캐릭터가 착용한 무기에 따라 배틀러 무기도 바꿔주는 스크립트 6 file 백호 2009.02.21 2518
933 이동 및 탈것 캐릭터 이동 프레임? 증가 스크립트 9 백호 2009.02.21 2969
932 HUD 캐릭터 아래 SP,HP표시해주는 스크립트 33 file 김!제스! 2010.08.04 4269
931 기타 캐릭터 소개 화면 22 file 독도2005 2008.10.05 4098
930 기타 카운트 3초 1 file 백호 2009.02.22 1295
» 기타 치트키 시스템 3 백호 2009.02.22 1594
928 전투 추적 공격 스크립트 백호 2009.02.21 1459
927 온라인 최신중의 최신 2010년 4월 작 넷플레이 3.0!!! 6 김똘식 2010.09.18 3320
926 이동 및 탈것 최단경로 찾아가기 - (마우스 사용) 18 file 허걱 2009.02.02 3351
925 온라인 채팅 가능 온라인 스크립트 배포 107 file 아방스 2009.01.03 10680
924 창꼬 스크립트! 금고 입니당 ^^ 8 WMN 2008.03.17 1595
923 기타 창고 시스템 8 백호 2009.02.22 1762
922 기타 창고 스크립트 5 긔염둥이♥ 2012.06.18 1723
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