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 RPGMV 플러그인 Kaus Ultimate Overlay v1.03 (강력레이아웃추가! 빛/포그/파노라마/맵) 2 file 파란별빛 2015.11.08 2025 0
227 RPGMV 플러그인 게임시작하면 바로 뉴게임으로 가는 플러그인! 1 willmv 2015.11.07 925 0
226 RPGMV 플러그인 FPS 표기 플러그인! (화면에 FPS값을 표기해준다!) 1 file willmv 2015.11.07 748 0
225 RPGMV 플러그인 퀘스트 시스템 플러그인! Gameus' Quest System 1 file willmv 2015.11.07 1572 0
224 RPGMV 플러그인 HUD (HP, MP, EXP, LEVEL 표시) 화면에 표시해주는 플러그인! 4 file willmv 2015.11.07 1368 2
223 RPGMV 플러그인 모바일 패드 플러그인입니다! MBS - Mobile DirPad & Action Button 6 willmv 2015.11.07 2005 3
222 RPGMV 플러그인 이벤트(엑스트라) 좌표 콘트롤 플러그인(Move Route Extras - Version 1.1) 1 plam 2015.11.07 859 0
221 RPGMV 플러그인 오렌지 - 타임 시스템 플러그인(Time system). (게임 시간시스템 관련) 4 plam 2015.11.07 946 1
220 RPGMV 플러그인 점프 액션 플러그인. 3 file plam 2015.11.07 1217 0
219 RPGMV 플러그인 타이틀 스크린 스킵 file 공원소년 2015.11.03 1017 0
218 RPGMV 플러그인 크리티컬 데미지 배수 설정 3 file 백난화백 2015.11.01 873 0
217 RPGMV 플러그인 데이터 베이스 이스케이프 처리 플러그인 1 file 백난화백 2015.11.01 706 0
216 RPGMV 플러그인 Iavra Generic Popup (일정시간 팝업을 띄우는 플러그인) 1 파란별빛 2015.10.30 823 0
215 RPGMV 플러그인 Mouse System Ex 마우스 입력 시스템 파란별빛 2015.10.30 859 0
214 RPGMV 플러그인 Bind Pictures To Map (이미지 결합 플러그인) 3 file 이녕 2015.10.30 1049 0
213 RPGMV 플러그인 EnemyBook v1.1 - SkottyTV Update(몬스터북 플러그인) plam 2015.10.27 1006 0
212 RPGMV 플러그인 날씨효과를 전투중에도 사용하는 플러그인입니다. 3 plam 2015.10.27 839 0
211 RPGMV 플러그인 MKMV_SaveManager (심플 세이브 & 세이브 슬롯 확장) 2 file 최빛빛 2015.10.27 913 1
210 RPGMV 플러그인 현실 시간 변수 대입 플러그인 2 file 최빛빛 2015.10.26 603 1
209 RPGMV 플러그인 [JS] 세이브 갯수를 20개에서 변경하기. 천무 2015.10.26 508 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(김원배) | 사신지(김병국)