XP 스크립트

Maplinks script by Wachunga@rmxp.net  (이 @이 e-mail주소를 가리키는 것이 아니란 것을 염두에 두시길)

  스크립트를 이용해서 맵의 가장자리로 갔을 때 다음 맵으로 워프하게 하는 것입니다.(맵의 가장자리를 이벤트로 도배하는 것보다 효율적이다?)


=begin

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

  Maplinks - version 0.95 (2005-11-10)

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

  by Wachunga


 This script simplifies linking maps together: a single event sets up an

 entire edge of the map as a teleport to another map. Players trying to

 leave that edge of the current map are automatically teleported.


 (This can also be achieved with many copies of teleport events along the edges

 of a map or with a parallel-process event that sets variables and uses them to

 teleport, but these methods are not optimal -- causing lag and/or inconvenience

 for the mapper.)


 To link a map with another on a specific edge (north, east, south or west),

 create an event with <maplink> included in its name on the appropriate edge of

 the map. (To avoid confusion, maplink events on corners of the map are

 not valid.) Then, add a teleport ("Transfer Player") command to the event

 to specify the destination map and other details (e.g. player direction,

 fading on/off). If the destination is an east or west edge, then the Y

 coordinate is calculated based on the player's Y coordinate when

 teleporting; likewise, the X coordinate is calculated automatically when

 the destination is a north or south edge.

 

 Note: unlike normal teleport events, maplinks are activated when the player

 tries to leave the screen instead of when stepping on the last tile. This

 behaviour could be changed, but I feel that it's more natural this way:

 it leaves the whole map open for actual exploration, instead of "wasting"

 the outer tiles of a map.


=end


#-------------------------------------------------------------------------------


class Game_Event < Game_Character

  alias ml_ge_init initialize

  def initialize(map_id, event)

    ml_ge_init(map_id, event)

    if @event.name.upcase.include?('<MAPLINK>')

      dir = nil

      if @event.y == $game_map.height-1

        dir = 2 unless @event.x == 0 or @event.x == $game_map.width-1

      elsif @event.x == 0

        dir = 4 unless @event.y == 0 or @event.y == $game_map.height-1

      elsif @event.x == $game_map.width-1

        dir = 6 unless @event.y == 0 or @event.y == $game_map.height-1

      elsif @event.y == 0

        dir = 8 unless @event.x == 0 or @event.x == $game_map.width-1

      end

      if dir != nil

        @list.each { |command|

          if command.code == 201

            # make sure new location isn't be specified by variables

            if command.parameters[0] == 0

              $game_map.maplinks[dir] = Maplink.new(command.parameters)

              break

            end

          end

        }

      end

    end

  end

end


#-------------------------------------------------------------------------------


class Game_Map

  attr_accessor :maplinks

 

  alias ml_gm_setup setup

  def setup(map_id)

    @maplinks = {}

    ml_gm_setup(map_id)

  end

 

  def width(map_id = @map_id)

    if map_id == @map_id

      return @map.width

    else

      return load_data(sprintf("Data/Map%03d.rxdata", map_id)).width     

    end

  end 


  def height(map_id = @map_id)

    if map_id == @map_id

      return @map.height

    else

      return load_data(sprintf("Data/Map%03d.rxdata", map_id)).height

    end

  end   

 

end


#-------------------------------------------------------------------------------


class Maplink

 

  def initialize(parameters)

    @param = parameters

  end


  def activate

    width = $game_map.width(@param[1])

    height = $game_map.height(@param[1])

    # modify x (p[2]) or y (p[3]) coordinates appropriately

    if @param[2] == 0 or @param[2] == width-1

      @param[3] = $game_player.y

    elsif @param[3] == 0 or @param[3] == height-1

      @param[2] = $game_player.x

    end

    # set up a dummy interpreter just for teleport

    interpreter = Interpreter.new

    interpreter.parameters = @param

    interpreter.index = 0

    interpreter.command_201

  end

 

end


#-------------------------------------------------------------------------------


class Game_Player


  alias ml_cett check_event_trigger_touch

  def check_event_trigger_touch(x, y)

    check_maplinks(x,y)

    ml_cett(x,y)

  end

 

  def check_maplinks(x,y)

    if $game_map.valid?(x, y) then return end

    dir = nil

    if y == $game_map.height then dir = 2

    elsif x == -1 then dir = 4

    elsif x == $game_map.width then dir = 6

    elsif y == -1 then dir = 8

    end

    if dir != nil

      if $game_map.maplinks[dir] != nil

        $game_map.maplinks[dir].activate

      end

    end

  end


end


#-------------------------------------------------------------------------------


class Interpreter

  attr_accessor :parameters

  attr_accessor :index

end

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
42 이동 및 탈것 8방향움직임과 8방향 캐릭터칩 호환 2 file 백호 2009.02.21 2274
41 이동 및 탈것 World Map & Teleporter by SephirothSpawn 2 file 백호 2009.02.22 1156
» 이동 및 탈것 Maplinks - 맵연결을 쉽게 하기 1 백호 2009.02.22 1541
39 이동 및 탈것 3D 캐릭 스크립트 7 백호 2009.02.22 3443
38 이동 및 탈것 Memorize Location R2 by dubealex file 백호 2009.02.22 846
37 이동 및 탈것 Advanced Player Movement by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 801
36 이동 및 탈것 플레이어 텔레포트 시키기 1 백호 2009.02.22 1375
35 이동 및 탈것 마나 소비 텔레포트 2 백호 2009.02.22 1155
34 이동 및 탈것 [통합] 텔레포트 통합 수정편 1 백호 2009.02.22 1143
33 이동 및 탈것 SG_Wait for Move Completion Fix by sandgolem (SDK호환) 백호 2009.02.22 860
32 이동 및 탈것 자동으로 장애물을 피해가는 스크립트 13 file 백호 2009.02.22 1929
31 이동 및 탈것 新(?)대쉬기능 스크립트.. 3 백호 2009.02.22 1626
30 이동 및 탈것 대쉬 밑에 꺼 MP가 깍기는거 1 백호 2009.02.22 1467
29 이동 및 탈것 하이 대쉬 시스템 ver.1.0 15 백호 2009.02.22 2365
28 이동 및 탈것 비공정 스크립트 5 file 백호 2009.02.22 1506
27 이동 및 탈것 밑에 KIN 님의 MP 없어지는 대쉬, 제가 손좀 봤음 1 백호 2009.02.22 1244
26 이동 및 탈것 금금님 요청 대쉬 1 백호 2009.02.22 1383
25 이동 및 탈것 그림자 스크립트 13 file 백호 2009.02.22 3540
24 이동 및 탈것 KGC_Teleport file 백호 2009.02.22 1153
23 이동 및 탈것 KGC_SetAttackElement (공격속성설정) file 백호 2009.02.22 1407
Board Pagination Prev 1 2 3 4 Next
/ 4