XP 스크립트

RPG Advocate의 커스텀 윈도우 튜토리얼 - http://www.phylomortis.com/resource/script/tut002.html
이벤트에서 스크립트를 사용하는 대신 아이템을 얻으면 자동으로 윈도우가 뜨게 수정 -
http://www.rmxp.net/forums/index.php?showtopic=10874&hl=
(내용을 보려면 로그인 필요)

  아래 스크립트는 위의 링크에 있는 내용을 한데 모은 것입니다:

class Window_ItemGet < Window_Base #아이템 입수시 표시되는 윈도우
  #------------------------------
  attr_accessor :type
  attr_accessor :id
  #--------------------------------------------------------------------------
  # Initialize the Object.
  #--------------------------------------------------------------------------
  def initialize(type, id)
    super(220, 180, 220, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    self.contents.font.name = ["Arial","돋움"]
    self.contents.font.size = 18
    @type = type
    @id = id
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh.
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 180, 32, "입수:")
    if @type == 1
      self.draw_item_name($data_items[@id], 4, 32)
    end
    if @type == 2
      self.draw_item_name($data_weapons[@id], 4, 32)
    end
    if @type == 3
      self.draw_item_name($data_armors[@id], 4, 32)
    end
    if @type == 4
      @type = 4
    end
  end
  #--------------------------------------------------------------------------
  # Frame Update.
  #--------------------------------------------------------------------------
  def update
    super
    end
  end


class Interpreter
  #--------------------------------------------------------------------------
  # * Change Items
  #--------------------------------------------------------------------------
  def command_126
    # Get value to operate
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    # Increase / decrease items
    $game_party.gain_item(@parameters[0], value)
    # Continue
    $scene.item_acquired[0] = 1 #아이템 입수시 입수 메세지창 표시
    $scene.item_acquired[1] = (@parameters[0])
    $game_system.se_play(-SE-name-) #추가 끝.  (-SE-name에는 원하는 SE파일명을 넣음)
    return true
  end
  #--------------------------------------------------------------------------
  # * Change Weapons
  #--------------------------------------------------------------------------
  def command_127
    # Get value to operate
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    # Increase / decrease weapons
    $game_party.gain_weapon(@parameters[0], value)
    # Continue
    $scene.item_acquired[0] = 2 #아이템 입수시 입수 메세지창 표시
    $scene.item_acquired[1] = (@parameters[0])
    $game_system.se_play(-SE-name-) #추가 끝.  (-SE-name에는 원하는 SE파일명을 넣음)
    return true
  end
  #--------------------------------------------------------------------------
  # * Change Armor
  #--------------------------------------------------------------------------
  def command_128
    # Get value to operate
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    # Increase / decrease armor
    $game_party.gain_armor(@parameters[0], value)
    # Continue
    $scene.item_acquired[0] = 3 #아이템 입수시 입수 메세지창 표시
    $scene.item_acquired[1] = (@parameters[0])
    $game_system.se_play(-SE-name-) #추가 끝.  (-SE-name에는 원하는 SE파일명을 넣음)
    return true
  end
end


class Scene_Map
  # ---------------------
  attr_accessor :item_acquired #추가 -아이템 입수시 입수 메세지창 표시
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    #추가 -아이템 입수시 입수 메세지창 표시
    @acquire_window = Window_ItemGet.new(1, 0) #
    @acquire_window.visible = false #
    @itemdelay = -1 #
    @item_acquired = [0, 0] # 추가 끝
    # Transition run
    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 sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    @acquire_window.dispose #추가 -아이템 입수시 입수 메세지창 표시
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    #추가 -아이템 입수시 입수 메세지창 표시
    if @itemdelay > 0
      @itemdelay -= 1 # 2
    end
    if @itemdelay == 0 # 3
      @itemdelay = -1
      @acquire_window.visible = false
      @item_acquired[0] = 0
      @item_acquired[1] = 0
    end #추가 끝
    # Update message window
    @message_window.update
    #추가 -아이템 입수시 입수 메세지창 표시
    if @item_acquired[0] != 0 &&
      @item_acquired[1] != 0 && @itemdelay < 0 # 1
      @acquire_window.type = @item_acquired[0]
      @acquire_window.id = @item_acquired[1]
      @acquire_window.refresh
      @acquire_window.visible = true
      @itemdelay = 125
    end #추가 끝
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
            $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
            $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '4'
  • ?
    [A]중딩 2009.12.31 20:17

    에러가뜨네요; 59,73,87에러요..

    득된돈과 경치도 메세지로떴으면...

  • ?
    카비 2010.01.01 18:49

    음..

    이름을써넣어도 에러는 여전하네요.

  • ?
    똥꾸빵구 2010.01.03 20:47

    이거 그냥 ABS쓰는게 날 것 같네요.........

  • ?
    지존!! 2010.07.21 17:46

    뭔지는 몰겠는데


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
661 전투 SBABS게이지바 file 백호 2009.02.21 2284
» 아이템 아이템을 얻으면 자동으로 아이템 입수 메세지윈도우 띄우기 4 백호 2009.02.22 2279
659 영상 avi 동영상 실행 스크립트 9 백호 2009.02.21 2277
658 이동 및 탈것 8방향움직임과 8방향 캐릭터칩 호환 2 file 백호 2009.02.21 2273
657 [헬악이] 스크립트 사용법 !!!(꼭 읽으세요!!) 3 아방스 2007.11.09 2264
656 메시지 WhiteFlute 멀티메시지 스크립트 (XP/VX/VXA) 4 Alkaid 2013.02.05 2263
655 기타 탤레포트 스크립트 3 앞잡이 2011.12.10 2260
654 키입력 新전체키 스크립트(그에 따른 그림도 실려있음) 6 file 백호 2009.02.21 2255
653 타이틀/게임오버 타이틀 화면 커스터마이즈 1.11 by パラ犬 3 Alkaid 2010.09.29 2247
652 기타 [신기술 체험] 마우스 클릭 드래그 드롭 7 file 백호 2009.02.22 2246
651 메뉴 메뉴 화면 변경 스크립트 file 백호 2009.02.21 2236
650 [수정]스토리스크랩트 {예제 첨부} 10 file WMN 2008.03.17 2230
649 레벨 9999 스크립트 23 WMN 2008.03.17 2218
648 상점 여관 시스템 5 file 백호 2009.02.22 2209
647 그래픽 Meagan's Particles 1.1 by DerVVulfman 3 Alkaid 2011.11.01 2205
646 저장 멀티넷스크립트 -> 아이피 세이브,로드 스크립트 9 file 백호 2009.02.22 2204
645 타이틀/게임오버 타이틀 랜덤 출력 기능 1.5 5 file 코아 코스튬 2010.09.29 2203
644 기타 한계 돌파스크립트 8 G MAX 2009.09.03 2203
643 메뉴 새로운 메뉴 시스템 을 한글화 및 약간 개조 3 file 백호 2009.02.21 2203
642 메시지 txt 메세징 스크립트 4 에돌이 2011.07.12 2198
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ... 52 Next
/ 52