RPGXP 스크립트
2013.10.21 06:49

문과 상자를 쉽게 만들수 있는 스크립트

조회 수 2242 추천 수 0 댓글 18
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

#
# 이벤트 이름에 따라 상자 또는 문으로 작동할 수 있도록 합니다.
# 제작자 jinoh67 (nil)
#
# 비밀번호 형식 (xxxx부분) :
#  1714 -> 비밀번호는 1714이다.
#  012345 -> 비밀번호는 012345이다.
#  v32 -> 비밀번호는 32번 변수의 값이다.
#
# 상자 사용 방법 (이벤트 명령 사용 불가능) :
#  이벤트 이름을 다음과 같은 형식으로 지정해준다.
#
#   _CHEST12 -> 12번 아이템을 얻는다.
#   _CHEST12x4 -> 12번 아이템을 4개 얻는다.
#   _CHEST12_PWDxxxx -> 비밀번호를 입력하면 12번 아이템을 얻는다.
#   _CHEST12x4_PWDxxxx -> 비밀번호를 입력하면 12번 아이템을 4개 얻는다.
#   _CHESTPWDxxxx -> 플레이어를 낚는다.
#
# 문 사용 방법 (비밀번호가 맞을 시 이벤트 명령 실행) :
#   이벤트 이름을 다음과 같은 형식으로 지정해준다.
#   _DOORxxxx -> 비밀번호를 입력하면 이벤트 명령을 실행한다.
#


class Game_Event
  def str2num (str, offset = 0, var = nil, bdg = nil, final = nil)
    i = offset
    if final == nil
      final = str.size
    end
    val = 0
    while i < final && '0'[0] <= str[i] && str[i] <= '9'[0]
      val = val * 10 + (str[i] - '0'[0])
      i += 1
    end
    if var != nil && bdg != nil
      eval "#{var} = " + i.to_s, bdg
    end
    return val
  end
  
  def self.setup2
    waitCmd = RPG::MoveCommand.new(15, [2])
    stopCmd = RPG::MoveCommand.new(0, [])
    k = RPG::MoveRoute.new
    k.repeat = false
    k.skippable = false
    k.list = []
    for i in 16..19 do
      k.list.push (RPG::MoveCommand.new(i))
      k.list.push (waitCmd)
    end
    k.list.push (stopCmd)
    @@openChestMoveRoute = k
    k = RPG::MoveRoute.new
    k.repeat = false
    k.skippable = false
    k.list = []
    for i in 0..3 do
      k.list.push (RPG::MoveCommand.new(19 - i))
      if i < 3
        k.list.push (waitCmd)
      end
    end
    k.list.push (stopCmd)
    @@closeChestMoveRoute = k
    k = RPG::MoveRoute.new
    k.repeat = false
    k.skippable = false
    k.list = [RPG::MoveCommand.new(16), stopCmd]
    @@initalChestMoveRoute = k
    @@chest_array = [];
  end

  self.setup2
  
  def scan_pwd (str, offset, var = nil, bdg = nil)
    @pwd_len = 4
    @pwd_type = 0
    @pwd = nil
    if str[offset] == 'v'[0]
      @pwd_type = 1
      @pwd = str2num (str, offset + 1, var, bdg)
    else
      @pwd_type = 2
      k = nil
      @pwd = str2num (str, offset, :k, binding)
      if var != nil && bdg != nil
        eval "#{var} = " + k.to_s, bdg
      end
      @pwd_len = k - offset
      if @pwd_len <= 0
        @pwd_type = 0
        @pwd = nil
        @pwd_len = 0
      end
    end
  end
  
  alias :refresh_old :refresh

  def refresh # call this method at last in refresh method
    refresh_old
    cn = @event.name
    if cn.index ('_CHEST') == 0
      # get chest number
      @chest_id = @@chest_array.index (self)
      if @chest_id == nil
        @chest_id = @@chest_array.push (self).size - 1
      end
      @chest_id += $chest_start
      
      # scan
      i = 0
      @chest_item = str2num (cn, 6, :i, binding)
      if @chest_item <= 0 || $data_items.size <= @chest_item
        @chest_item = nil
      else
        @item_name = $data_items[@chest_item].name
        k = cn.index('x', i)
        if k != nil
          @chest_quantity = str2num (cn, k + 1, :i, binding)
        else
          @chest_quantity = 1
        end
      end
      i = cn.index('_PW', i) # _CHEST_PW
      @pwd_len = 4
      if i == nil
        @pwd_type = 0 # No password
        @pwd = nil
      else
        scan_pwd (cn, i + 3, :i, binding)
      end
      
      # setup
      @walk_anime = false
      @direction_fix = false
      
      # generate
      @list = [
        RPG::EventCommand.new(209, 0, [0, @@initalChestMoveRoute]),
        RPG::EventCommand.new(111, 0, [2, 0, 0]),
          RPG::EventCommand.new(209, 1, [0, @@openChestMoveRoute]),
          RPG::EventCommand.new(250, 1, [RPG::AudioFile.new("044-Chest01")]),
          RPG::EventCommand.new(210, 1, []),
          RPG::EventCommand.new(101, 1, ["상자가 비었다."]),
          RPG::EventCommand.new(209, 1, [0, @@closeChestMoveRoute]),
          RPG::EventCommand.new(250, 1, [RPG::AudioFile.new("024-Door01")]),
        RPG::EventCommand.new(411, 0, [])
        ];
      ind = 1
      if @pwd_type > 0
        @list.push (RPG::EventCommand.new(101, ind, ["비밀번호가 걸려있다."]))
        @list.push (RPG::EventCommand.new(122, ind, [$tmp_id, $tmp_id, 0, 0, 0]))
        @list.push (RPG::EventCommand.new(103, ind, [$tmp_id, @pwd_len]))
        if @pwd_type == 2
          @list.push (RPG::EventCommand.new(111, ind, [1, $tmp_id, 0, @pwd, 0]))
        else
          @list.push (RPG::EventCommand.new(111, ind, [1, $tmp_id, 1, @pwd, 0]))
        end
        ind += 1
      end
      @list.push(RPG::EventCommand.new(209, ind, [0, @@openChestMoveRoute]))
      @list.push(RPG::EventCommand.new(250, ind,
        [RPG::AudioFile.new("044-Chest01")]))
      @list.push(RPG::EventCommand.new(210, ind, []))
      @list.push(RPG::EventCommand.new(123, ind, [0, 0]))
      if @chest_item == nil
        @list.push(RPG::EventCommand.new(101, ind,
          [(@pwd_type > 0 ? "비밀번호까지 걸렸는데 " : "") + "상자가 비었다."]))
      else
        @list.push(RPG::EventCommand.new(126, ind,
          [@chest_item, 0, 0, @chest_quantity]))
        @list.push(RPG::EventCommand.new(101, ind,
          [@item_name + "을 " + @chest_quantity.to_s + "개 얻었다."]))
      end
      @list.push(RPG::EventCommand.new(209, ind, [0, @@closeChestMoveRoute]))
      @list.push(RPG::EventCommand.new(250, ind,
        [RPG::AudioFile.new("024-Door01")]))
      if @pwd_type > 0
        @list.push (RPG::EventCommand.new(411, ind - 1, []))
        @list.push (RPG::EventCommand.new(101, ind, ["비밀번호가 틀린 듯하다."]))
      end
      for i in 0..(ind-1)
        @list.push (RPG::EventCommand.new(0, i, []))
      end
      # @page.list = @list
    elsif cn.index ("_DOOR") == 0
      # get door number
      list_bkup = @list
      scan_pwd (cn, 5)
      if @pwd_type == 0
        return
      end
      @list = [
        RPG::EventCommand.new(111, 0, [2, 0, 1]),
          RPG::EventCommand.new(101, 1, ["비밀번호가 걸려있다."]),
          RPG::EventCommand.new(122, 1, [$tmp_id, $tmp_id, 0, 0, 0]),
          RPG::EventCommand.new(103, 1, [$tmp_id, @pwd_len]),
          RPG::EventCommand.new(111, 1, [1, $tmp_id, 0, @pwd, 5]),
            RPG::EventCommand.new(101, 2, ["비밀번호가 틀린 듯하다."]),
            RPG::EventCommand.new(115, 2, []),
          RPG::EventCommand.new(123, 1, [0, 0]),
        RPG::EventCommand.new(0, 0, [])
      ]
      if (@pwd_type == 1)
        @list[4] = RPG::EventCommand.new(111, 1, [1, $tmp_id, 1, @pwd, 5])
      end
      @list.concat(list_bkup)
    end
  end
end

?
  • ?
    두부 2013.10.26 05:26
    vx va는 간단하게 작성하기에서 있는데

    xp는 집적 만들어야하니 불편한점이 있었는데...

    감사합니다!
  • ?
    2013.10.26 05:57
    수정했습니다
  • ?
    exam 2013.11.10 00:34
    잘 보고갑니다
  • ?
    XP데이 2013.11.17 02:53
    exam님은 nil님을호출을받자
    누구인줄몰랐습니다.
  • ?
    2013.11.10 04:40
    nil님이 exam님을 호출하였습니다.
  • ?
    exam 2013.11.10 04:38

    전 킹카보단
    잉여킹차가 더 좋을것 같네요 ㅋㅋ
  • ?
    2013.11.10 04:36
    잉여킹카는 어때요?
  • ?
    exam 2013.11.10 04:25
    전 잉여빵보단 잉여킹을 더 좋아합니다 ㅋㅋ
  • ?
    2013.11.10 04:23
    잉여빵은요??

    아 맞다 농구할때 드립을 왜 하죠???
  • ?
    exam 2013.11.10 04:23
    ㅋㅋ
    그래서 제가 잉여맨을 좋아합니다
    (죄송 드립임)
  • ?
    2013.11.10 04:21
    이런 잉여스러운 스크립트에 댓글을 달아 주시다니!!! ㄱㅅ
  • ?
    exam 2013.11.10 04:38
    한국어를 사용합시다
  • ?
    exam 2013.11.10 04:41
    네 모바일 ㅠㅠ
  • ?
    2013.11.10 04:39
    윗부분에 한국어를 주석으로 사용했습니다 :)
    허허 댓글 올린 현재 모바일이시군요 채팅방에 없는거보니
  • ?
    exam 2013.11.10 04:42
    근데 저 스크립트요
    수정해서 붙여넣기 해야되나요
    아니면 그냥 붙여넣기 하면되나요?
  • ?
    2013.11.10 05:18
  • ?
    exam 2013.11.10 05:02

    쓰신 글에서 더 추가안 해도 되죠?
  • ?
    2013.11.10 05:01
    새로 스크립트 만들어서 붙여넣기하세요

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
228 RPGXP 스크립트 횡스크롤 점프 [버튼허용스위치추가] 3  운 2014.06.01 1626 0
227 RPGXP 스크립트 말풍선 메세지 스크립트 2 천둥번들 2014.02.24 1853 0
226 RPGXP 스크립트 스텟찍기스크립트 12 천둥번들 2014.02.22 1761 3
225 RPGXP 스크립트 달리기스크립트 4 천둥번들 2014.02.22 2306 2
224 RPGXP 스크립트 8방향 이동스크립트 5 천둥번들 2014.02.22 1723 6
223 RPGXP 스크립트 AraLab_MultiStartingPoint (다중 출발점 스크립트, 캐릭터 선택 스크립트) ver.0.2beta 3  운 2014.01.21 1973 1
222 RPGXP 스크립트 3D스크립트!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 6 공박사 2014.01.18 2805 2
221 RPGVX Ace 스크립트 Rpg Vx Ace 에서 이벤트 이름 팝업 3 빙냥이 2014.01.17 1895 0
220 RPGXP 스크립트 타이틀 로고 띄우기 + 로고 SE 가능(예제있음) 6 데노제 2013.12.13 2391 3
219 RPGXP 스크립트 메세지에 얼굴, 이름등 다양한 기능 넣기 UMS 스크립트 1 데노제 2013.12.10 1616 0
218 RPGXP 스크립트 모션 스크립트 3  운 2013.12.06 2053 0
217 RPGXP 스크립트 아이템 조합 스크립트 7  운 2013.12.06 2712 0
216 RPGXP 스크립트 이름조합스크립트 16 Scissor 2013.10.27 2764 0
» RPGXP 스크립트 문과 상자를 쉽게 만들수 있는 스크립트 18 2013.10.21 2242 0
214 RPGXP 스크립트 메뉴에 퀘스트 있는거 2  운 2013.10.12 1957 2
213 RPGXP 스크립트 퀘스트 스크립트 21  운 2013.10.12 3100 2
212 RPGXP 스크립트 로고를 띄우는 스크립트 14 XEONSOFT블로그 2013.10.07 1677 0
211 RPGXP 스크립트 맵이름 표시 스크립트 18  운 2013.10.05 2244 0
210 RPGXP 스크립트 요청하신 게이지바 스크립트 입니다. 8 소년영남 2013.10.04 1919 1
209 RPGXP 스크립트 파이널 판타지 7 스타일 메뉴 6 2013.10.01 2024 0
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)