VX 스크립트

예를 들면 이런겁니다.

스킬의 설명에 "찌질!"을 100번 적어놓으면 전부 표시를 못하는 것이 기존의 VX였죠?

하지만 이제 걱정 끄읕!

스킬의 설명을 아무리 길게 적어도, 문장을 스크롤 해서 보여주기 때문에, 아주 편리하죠!

MP3에 보면 노래 이름이 앞으로 당겨지면서 계속 반복해서 나타나는 거랑 비슷한 겁니다. Advanced Help Configuration Module에서

스크롤 타입을 정할 수 있습니다.

어쨋든! 유용하게 쓰시길 바라고,

아래부터 복사..

#==============================================================================
# ** Advanced Help
#------------------------------------------------------------------------------
#  © Dargor, 2008-2009
#  17/02/09
#  Version 1.3
#------------------------------------------------------------------------------
#  VERSION HISTORY:
#   - 1.0 (02/11/08), Initial release
#   - 1.1 (03/11/08), Now compatible with the Takentai CBS
#   - 1.2 (17/02/09), Text can now scroll vertically using Scroll Mode 2
#   - 1.3 (17/02/09), Now works with text alignment
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   - Place this script above Main
#   - Edit the constants in the Advanced Help module and enjoy!
#------------------------------------------------------------------------------
#  Notes
#   This script handles the following message codes.
#   - Color      : C[n]
#   - Variable   : V[n]
#   - Actor Name : N[n]
#   - New Line   : L
#==============================================================================
 
#==============================================================================
# ** Advanced Help Configuration Module
#==============================================================================
 
module Advanced_Help
  # The delay (in frames) before the text starts to scroll
  Scroll_Wait = 120
  # Scroll Mode
  # 0 : Scrolls to left and loops
  # 1 : Scrolls to left and goes back to its origin.
  # 2 : Scrolls down and goes back to its origin when using 2+ lines.
  Scroll_Mode = 0
  # Letter by letter
  Letter_By_Letter = true
end
 
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================
 
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias dargor_vx_help_scroll_update update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 544, WLH + 32)
    @scroll_wait = 0
    @scroll_mode = Advanced_Help::Scroll_Mode
    @temp_wait = 0
    @text = ''
    @new_text = ''
    @last_text = ''
    @contents_x = 0
    @line_y = 0
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : character string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align=0)
    @last_text = @text
    if text != @text or align != @align
      self.ox = 0
      self.oy = 0
      self.contents.clear
      @scroll_wait = Advanced_Help::Scroll_Wait
      @text = text
      @new_text = text.dup
      @temp_text = @new_text.dup
      @align = align
      @max_line_y = 0
      @contents_x = 0
      if align == 1
        @contents_x = ((self.width - get_contents_width) / 2) - 16
      elsif align == 2
        @contents_x = (self.width - get_contents_width) - 32
      end
      if @scroll_mode == 2
        ch = (get_contents_height + 1) * WLH
        self.contents = Bitmap.new(self.width - 32, ch)
      else
        cw = [contents.text_size(text).width + 16, 32].max
        self.contents = Bitmap.new(cw, WLH)
      end
      convert_special_characters
    end
  end
  #--------------------------------------------------------------------------
  # * Get the number of lines in the text
  #--------------------------------------------------------------------------
  def get_contents_height
    @temp_text.gsub!(/L/)              { @max_line_y += 1 }
    return @max_line_y
  end
  #--------------------------------------------------------------------------
  # * Get the width of the text
  #--------------------------------------------------------------------------
  def get_contents_width
    @temp_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @temp_text.gsub!(/N[([0-9]+)]/i) { $game_actors[$1.to_i].name }
    @temp_text.gsub!(/C[([0-9]+)]/i) { "" }
    @temp_text.gsub!(/L/)              { "" }
    return self.contents.text_size(@temp_text).width
  end
  #--------------------------------------------------------------------------
  # * Convert Special Characters
  #--------------------------------------------------------------------------
  def convert_special_characters
    @new_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @new_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @new_text.gsub!(/N[([0-9]+)]/i) { $game_actors[$1.to_i].name }
    @new_text.gsub!(/C[([0-9]+)]/i) { "x01[#{$1}]" }
    @new_text.gsub!(/G/)              { "x02" }
    @new_text.gsub!(/./)             { "x03" }
    @new_text.gsub!(/|/)             { "x04" }
    @new_text.gsub!(/!/)              { "x05" }
    @new_text.gsub!(/>/)              { "x06" }
    @new_text.gsub!(/</)              { "x07" }
    @new_text.gsub!(/^/)             { "x08" }
    @new_text.gsub!(/L/)              { "x09" }
    @new_text.gsub!(/\/)             { "" }
  end
  #--------------------------------------------------------------------------
  # * Update Message
  #--------------------------------------------------------------------------
  def update_message
    # Draw text letter by letter
    if Advanced_Help::Letter_By_Letter
      loop do
        c = @new_text.slice!(/./m)            # Get next text character
        case c
        when nil                          # There is no text that must be drawn
          break
        when "x01"                       # C[n]  (text character color change)
          @new_text.sub!(/[([0-9]+)]/, "")
          contents.font.color = text_color($1.to_i)
          next
        when "x09"
          @contents_x = 0
          @line_y += 1
        else                              # Normal text character
          contents.draw_text(@contents_x, @line_y * WLH, 40, WLH, c)
          c_width = contents.text_size(c).width
          @contents_x += c_width
        end
        break
      end
    # Draw the whole text
    else 
      while (c = @new_text.slice!(/./m)) != nil
        case c
        when nil                          # There is no text that must be drawn
          break
        when "x01"                       # C[n]  (text character color change)
          @new_text.sub!(/[([0-9]+)]/, "")
          contents.font.color = text_color($1.to_i)
          next
        when "x09"
          @contents_x = 0
          @line_y += 1
        else                              # Normal text character
          contents.draw_text(@contents_x, @line_y * WLH, 40, WLH, c)
          c_width = contents.text_size(c).width
          @contents_x += c_width
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Draw text
    update_message
    # The usual
    dargor_vx_help_scroll_update
    # Scroll text
    @scroll_wait -= 1
    if @temp_wait > 0
      @temp_wait -= 1
      @temp_wait = -1 if @temp_wait == 0
      return
    else
      if self.oy != 0 && @temp_wait == -1
        self.oy -= 1 if Graphics.frame_count % 2 == 0
        if self.oy % WLH == 0
          @temp_wait = Advanced_Help::Scroll_Wait
          return
        end
        @temp_wait = 0 if self.oy == 0
        return
      end
    end
    if @scroll_mode != 2
      if self.contents.width > self.width && @scroll_wait < 0
        self.ox += 1
        @scroll_wait = Advanced_Help::Scroll_Wait if self.ox == 0
      end
    else
      if self.contents.height + 32 > self.height && @scroll_wait < 0
        self.oy += 1 if Graphics.frame_count % 2 == 0
        if self.oy % WLH == 0
          if self.oy > self.contents.height - WLH
            @temp_wait = Advanced_Help::Scroll_Wait
          else
            @scroll_wait = Advanced_Help::Scroll_Wait
          end
          return
        end
        #@scroll_wait = Advanced_Help::Scroll_Wait if self.oy == 0
      end
    end
    case @scroll_mode
    when 0
      if self.ox > self.contents.width
        self.ox = (-self.contents.width + 64)
      end
    when 1
      if self.ox > self.contents.width + 64
        self.ox = 0
        @scroll_wait = Advanced_Help::Scroll_Wait
      end
    when 2
      if self.oy > self.contents.height - WLH
        @temp_wait = Advanced_Help::Scroll_Wait
        @scroll_wait = Advanced_Help::Scroll_Wait
      end
    end
  end
end
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_advanced_help_battle_update_basic update_basic
  #--------------------------------------------------------------------------
  # * Basic Update Processing
  #     main : Call from main update method
  #--------------------------------------------------------------------------
  def update_basic(main = false)
    dargor_vx_advanced_help_battle_update_basic(main)
    @help_window.update unless @help_window.nil?
  end
end

이상! 루시페르였습니다!
Comment '13'
  • ?
    Zero_Som 2009.06.06 18:04
    허걱 길어지는거군요!
  • profile
    레이♡ 2009.06.07 17:00

    꽤 유용할지도.....

    문장이 안보여서 불편하다면 ㅋㅋ;;

  • ?
    백년술사 2009.06.09 22:53

    설명을 많이 할수있는건가요?

    어쨌든 좋을듯..(씨익)
  • ?
    Berylll 2009.10.18 15:12
    잘쓰겟습니다 ㅎㅎ.
  • ?
    1000℃ 복숭아 2009.10.19 15:48

    잘 쓰겠습니다~

     

  • ?
    뉴공 2009.11.05 13:38

    그 사이드뷰 배틀스트립트와 같이쓰면

    전투 도중 화면 상단에 기술이나 방어를 사용할때 나오는 문장이 출력되지 않습니다.

    여러모로 시도해보니 스크롤 타입을 '2'로 했을 경우에만 정상적으로 출력되더군요.

    참고하시길.

  • ?
    뉴공 2009.11.05 13:38
    아, 그리고 정말 좋은 스크립트네요 ㅎㅎ
  • ?
    뉴공 2009.11.05 13:43

    아, 확인해보니 스크롤타입이 '2' 일 경우에는 문장이 제대로 출력되지 않는군요.....;;

    결국은 사이드뷰 배틀스크립트와는 같이 못쓴다는 말이죠.

  • ?
    키레이 2010.11.21 21:17

    그래도 아이템 설명 쓰는 곳 자체에 글자수 제한이 있으니 뭐,

    그래도 감사히 받겠습니다!

  • ?
    이클립스 2010.12.16 00:23

    감사합니다!! 정말 좋군요!!

    안그래도 글자 잘리는 것 때문에 고민하고 있었는데...

    덕분에 해결이 되네요..^^

  • ?
    구제가능 2011.07.24 18:09

    난 왜 안될까

  • profile
    개촙포에버 2011.07.28 16:51

    어..스크립트가 뭔가 이상한데요?붙여넣었더니 아랫부분이 분홍색으로 변했네요.

  • ?
    크런키맛아듀크림 2011.10.30 21:57

    이거 에러..


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
637 ((대박!)) 게임상의 모든 글자에 효과 주기.. 33 미카엘 2008.08.20 5582
636 (?스크립트) 스크립트 읽어서 그래픽 넣으세요.(영어 잘하는 사람만 권장...) 2 Man... 2008.10.27 1444
635 메뉴 (모그메뉴 풀세트팩 SEL Style.) 유니크급 자료 147 file 할렘 2009.02.07 9558
634 상점 (수정)크리쳐 샵, 'SW_CreatureShop' by Siot Warrior 15 file 시옷전사 2010.09.03 3675
633 액터 (수정)크리쳐 합체, 'SW_CreatureMix' by SiotWarrior 22 file 시옷전사 2010.09.07 2972
632 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
631 기타 (좀 이상한 or 쓸모없을 듯 한)화면상에 몬스터와 만나려면 몇걸음 남았는지 표시하는 스크립트! 2 루시페르 2009.06.06 2318
630 기타 078656577er님의 스크립트를 개조한, 사격용 스크립트 1 file 타코 2012.03.16 2519
629 기타 2 Players Engine 11 레이니케 2008.03.28 2294
628 2 Players Engine 2인용하기 15 file RPGbooster 2008.10.08 3999
627 전투 2003식 사이드뷰 적들도 가까이와서 공격함 ㅇㅇ 51 배군 2008.05.02 6750
626 이동 및 탈것 2D 횡스크롤 스크립트 56 file 사람이라면? 2010.08.15 7570
625 이동 및 탈것 3D 던젼 스크립트 38 아방스 2010.12.06 5772
624 그래픽 3D그래픽 파티클엔진 45 file RPGbooster 2008.10.08 10130
623 파티 5인 파티 프로젝트 V1.1 4 file 지나가는떡꼬치 2012.06.30 2988
622 이동 및 탈것 8 방향 이동스크립트 + 스프라이트 효과 12 file 레오 2009.02.06 7557
621 기타 <중수이상>RPG VX의 대표적 참조값 6 까까까 2009.05.31 3236
620 영상 ??(Avi play ver beta 0.8) 4 Man... 2008.10.28 1575
619 ??(다 영어)여기서 부터 드레그만 빼고 Man... 2008.10.27 1078
618 ??? 1 Man... 2008.10.27 1020
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32