设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1796|回复: 3
打印 上一主题 下一主题

地图循环与航海不兼容

 关闭 [复制链接]

Lv1.梦旅人

教皇

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-12-15
帖子
541
跳转到指定楼层
1
发表于 2007-12-24 01:50:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题
使用航海脚本时,到地图循环处船总是过不去

我曾经把航海脚本中
这一段
    # 坐标在地图以外的情况
    unless $game_map.valid?(new_x, new_y)
      # 不能通行
      return false
    end

改成
      # 任意通行
      return true

#(当时可能是晕了,)这样当然不行




这是航海的脚本
  1. =begin
  2. --------------------------------------------------------------------------
  3. 跨地图航海辅佐脚本 v1.1
  4. By 叶子
  5. Date 4-8-2006
  6. --------------------------------------------------------------------------
  7. 跨地图航海由一个脚本+一个事件完成

  8. 使用方法(请耐心阅读完全部说明!每一步都必不可少):

  9. -插入本脚本到Main之上

  10. -二选一:
  11. 一)插入航海脚本懒人插件到Main之上,或者
  12. 二)仔细观察插件脚本,找到:
  13.     #-----------插入船命令-----------(已插入)
  14.     setup_ship
  15.     #--------------------------------
  16.    和
  17.     #---------插入船刷新命令---------(已插入)
  18.     $game_player.shipping_update
  19.     #--------------------------------
  20. 插入到Game_Map中相同位置(出现冲突时采用此方法)

  21. -小船事件设置方法:
  22. 小船为范例工程工程里湖中的矿道车,可以改成其它船的行走图
  23. 第二页出现条件设置为航行中标志开关打开(默认50号开关),第三页为独立开关A打开

  24. -水中通行设置方法:
  25. 把所有水的图块的地形标志设置为1,把水中不可通行图块(例如水中礁石)的地形标志
  26. 设置为2或以上(反正要大于水的地形标志)

  27. 注意事项:

  28. -不明白小船实现原理的话最好不要改小船事件(除了注释说可以随便改的地方之外)
  29. -默认角色航行中的话,50号开关打开,这时可以利用并行公共事件判断角色遇敌等
  30. -航行中标志开关只能用于判断,不要在其它事件中打开或关闭,否则可能出错误

  31. =end

  32. SHIPPING_SWITCH = 50                # 默认50号开关为是否航行中标志开关

  33. #==============================================================================
  34. # ■ Game_Player
  35. #------------------------------------------------------------------------------
  36. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  37. # 本类的实例请参考 $game_player。
  38. #==============================================================================

  39. class Game_Player < Game_Character
  40.   TERRAIN_TAG = 1                     # 默认1号地形标志为水的地形标志
  41.   attr_accessor :x                    # x坐标
  42.   attr_accessor :y                    # y坐标
  43.   attr_accessor :shipping             # 航海中标志
  44.   attr_accessor :ship                 # 船信息
  45.   #--------------------------------------------------------------------------
  46.   # ● 航海更新
  47.   #--------------------------------------------------------------------------
  48.   def shipping_update
  49.     return if !@shipping
  50.     @old_x = @x
  51.     @old_y = @y
  52.     # 着陆判断初始化
  53.     @land = false
  54.     # 移动中、事件执行中、强制移动路线中、
  55.     # 信息窗口一个也不显示的时候
  56.     unless moving? or $game_system.map_interpreter.running? or
  57.            @move_route_forcing or $game_temp.message_window_showing
  58.       # 如果方向键被按下、主角就朝那个方向移动
  59.       case Input.dir4
  60.       when 2
  61.         ship_move_down
  62.       when 4
  63.         ship_move_left
  64.       when 6
  65.         ship_move_right
  66.       when 8
  67.         ship_move_up
  68.       end
  69.     end
  70.     # 着陆判断
  71.     if @land
  72.       end_shipping
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 开始航海
  77.   #--------------------------------------------------------------------------
  78.   def start_shipping(ship)
  79.     $game_player.shipping = true
  80.     need_setup = false
  81.     # 处女航的话,刷新地图
  82.     if @ship.nil?
  83.       need_setup = true
  84.     end
  85.     # 把船事件添加入资料中
  86.     @ship = ship
  87.     # 移动角色
  88.     @x = @ship.x
  89.     @y = @ship.y
  90.     # 记录位置
  91.     @ship.ship_position = [$game_map.map_id, @ship.x, @ship.y]
  92.     if need_setup
  93.       $game_map.setup_ship
  94.     end
  95.     $game_map.need_refresh = true
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 着陆
  99.   #--------------------------------------------------------------------------
  100.   def end_shipping
  101.     # 获取带头的角色
  102.     actor = $game_party.actors[0]
  103.     # 设置角色的文件名及对像
  104.     @character_name = actor.character_name
  105.     @character_hue = actor.character_hue
  106.     # 关闭标志
  107.     @shipping = false
  108.     $game_switches[SHIPPING_SWITCH] = false
  109.     # 关闭停止时动画
  110.     @step_anime = false
  111.     # 回复速度
  112.     @move_speed = 4
  113.     # 设置船位置
  114.     @ship.ship_position = [$game_map.map_id, @old_x, @old_y]
  115.     @ship.moveto(@ship.ship_position[1], @ship.ship_position[2])
  116.     # 刷新地图
  117.     $game_map.need_refresh = true
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 向下移动
  121.   #     turn_enabled : 本场地位置更改许可标志
  122.   #--------------------------------------------------------------------------
  123.   def ship_move_down(turn_enabled = true)
  124.     # 面向下
  125.     if turn_enabled
  126.       turn_down
  127.     end
  128.     # 可以通行的场合
  129.     if ship_passable?(@x, @y, 2)
  130.       # 面向下
  131.       turn_down
  132.       # 更新坐标
  133.       @y += 1
  134.       # 增加步数
  135.       increase_steps
  136.     # 不能通行的情况下
  137.     else
  138.       # 接触事件的启动判定
  139.       check_event_trigger_touch(@x, @y+1)
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 向左移动
  144.   #     turn_enabled : 本场地位置更改许可标志
  145.   #--------------------------------------------------------------------------
  146.   def ship_move_left(turn_enabled = true)
  147.     # 面向左
  148.     if turn_enabled
  149.       turn_left
  150.     end
  151.     # 可以通行的情况下
  152.     if ship_passable?(@x, @y, 4)
  153.       # 面向左
  154.       turn_left
  155.       # 更新坐标
  156.       @x -= 1
  157.       # 增加步数
  158.       increase_steps
  159.     # 不能通行的情况下
  160.     else
  161.       # 接触事件的启动判定
  162.       check_event_trigger_touch(@x-1, @y)
  163.     end
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 向右移动
  167.   #     turn_enabled : 本场地位置更改许可标志
  168.   #--------------------------------------------------------------------------
  169.   def ship_move_right(turn_enabled = true)
  170.     # 面向右
  171.     if turn_enabled
  172.       turn_right
  173.     end
  174.     # 可以通行的场合
  175.     if ship_passable?(@x, @y, 6)
  176.       # 面向右
  177.       turn_right
  178.       # 更新坐标
  179.       @x += 1
  180.       # 增加部数
  181.       increase_steps
  182.     # 不能通行的情况下
  183.     else
  184.       # 接触事件的启动判定
  185.       check_event_trigger_touch(@x+1, @y)
  186.     end
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 向上移动
  190.   #     turn_enabled : 本场地位置更改许可标志
  191.   #--------------------------------------------------------------------------
  192.   def ship_move_up(turn_enabled = true)
  193.     # 面向上
  194.     if turn_enabled
  195.       turn_up
  196.     end
  197.     # 可以通行的情况下
  198.     if ship_passable?(@x, @y, 8)
  199.       # 面向上
  200.       turn_up
  201.       # 更新坐标
  202.       @y -= 1
  203.       # 歩数増加
  204.       increase_steps
  205.     # 不能通行的情况下
  206.     else
  207.       # 接触事件的启动判定
  208.       check_event_trigger_touch(@x, @y-1)
  209.     end
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 可以通行判定
  213.   #     x : X 坐标
  214.   #     y : Y 坐标
  215.   #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  216.   #--------------------------------------------------------------------------
  217.   def ship_passable?(x, y, d)
  218.     # 求得新的坐标
  219.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  220.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  221.     # 坐标在地图以外的情况
  222.     unless $game_map.valid?(new_x, new_y)
  223.       # 不能通行
  224.       return false
  225.     end
  226.     # 穿透是 ON 的情况下
  227.     if @through
  228.       # 可以通行
  229.       return true
  230.     end
  231.     # 移动者的元件无法来到指定方向的情况下
  232.     unless $game_map.passable?(x, y, d, self)
  233.       # 通行不可
  234.       return false
  235.     end
  236.     # 从指定方向不能进入到移动处的元件的情况下
  237.     unless $game_map.passable?(new_x, new_y, 10 - d)
  238.       # 不能通行
  239.       return false
  240.     end
  241.     # 循环全部事件
  242.     for event in $game_map.events.values
  243.       # 事件坐标于移动目标坐标一致的情况下
  244.       if event.x == new_x and event.y == new_y
  245.         # 穿透为 ON
  246.         unless event.through
  247.           # 自己就是事件的情况下
  248.           if self != $game_player
  249.             # 不能通行
  250.             return false
  251.           end
  252.           # 自己是主角、对方的图形是角色的情况下
  253.           if event.character_name != ""
  254.             # 不能通行
  255.             return false
  256.           end
  257.         end
  258.       end
  259.     end
  260.     # 主角的坐标与移动目标坐标一致的情况下
  261.     if $game_player.x == new_x and $game_player.y == new_y
  262.       # 穿透为 ON
  263.       unless $game_player.through
  264.         # 自己的图形是角色的情况下
  265.         if @character_name != ""
  266.           # 不能通行
  267.           return false
  268.         end
  269.       end
  270.     end
  271.     # 地形标志判断通行
  272.     for i in [2, 1, 0]
  273.       tile_id = $game_map.data[new_x, new_y, i]
  274.       return false if tile_id == nil
  275.     end
  276.     if $game_map.terrain_tag(new_x, new_y) != TERRAIN_TAG
  277.       if passable?(new_x, new_y, 0)
  278.         @land = true
  279.         return true
  280.       end
  281.       return false
  282.     end
  283.     # 可以通行
  284.     return true
  285.   end
  286. end

  287. #==============================================================================
  288. # ■ Game_Map
  289. #------------------------------------------------------------------------------
  290. #  处理地图的类。包含卷动以及可以通行的判断功能。
  291. # 本类的实例请参考 $game_map 。
  292. #==============================================================================
复制代码


循环的脚本太多个了
http://rpg.blue/viewthread.php?tid=69253&ntime=2007%2D12%2D23+17%3A50%3A29


这是当时的帖

各位帮忙看看可不可以修改一下航海的脚本

RA厚积而薄发

//and

game face

Lv1.梦旅人

教皇

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-12-15
帖子
541
2
 楼主| 发表于 2007-12-24 01:50:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题
使用航海脚本时,到地图循环处船总是过不去

我曾经把航海脚本中
这一段
    # 坐标在地图以外的情况
    unless $game_map.valid?(new_x, new_y)
      # 不能通行
      return false
    end

改成
      # 任意通行
      return true

#(当时可能是晕了,)这样当然不行




这是航海的脚本
  1. =begin
  2. --------------------------------------------------------------------------
  3. 跨地图航海辅佐脚本 v1.1
  4. By 叶子
  5. Date 4-8-2006
  6. --------------------------------------------------------------------------
  7. 跨地图航海由一个脚本+一个事件完成

  8. 使用方法(请耐心阅读完全部说明!每一步都必不可少):

  9. -插入本脚本到Main之上

  10. -二选一:
  11. 一)插入航海脚本懒人插件到Main之上,或者
  12. 二)仔细观察插件脚本,找到:
  13.     #-----------插入船命令-----------(已插入)
  14.     setup_ship
  15.     #--------------------------------
  16.    和
  17.     #---------插入船刷新命令---------(已插入)
  18.     $game_player.shipping_update
  19.     #--------------------------------
  20. 插入到Game_Map中相同位置(出现冲突时采用此方法)

  21. -小船事件设置方法:
  22. 小船为范例工程工程里湖中的矿道车,可以改成其它船的行走图
  23. 第二页出现条件设置为航行中标志开关打开(默认50号开关),第三页为独立开关A打开

  24. -水中通行设置方法:
  25. 把所有水的图块的地形标志设置为1,把水中不可通行图块(例如水中礁石)的地形标志
  26. 设置为2或以上(反正要大于水的地形标志)

  27. 注意事项:

  28. -不明白小船实现原理的话最好不要改小船事件(除了注释说可以随便改的地方之外)
  29. -默认角色航行中的话,50号开关打开,这时可以利用并行公共事件判断角色遇敌等
  30. -航行中标志开关只能用于判断,不要在其它事件中打开或关闭,否则可能出错误

  31. =end

  32. SHIPPING_SWITCH = 50                # 默认50号开关为是否航行中标志开关

  33. #==============================================================================
  34. # ■ Game_Player
  35. #------------------------------------------------------------------------------
  36. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  37. # 本类的实例请参考 $game_player。
  38. #==============================================================================

  39. class Game_Player < Game_Character
  40.   TERRAIN_TAG = 1                     # 默认1号地形标志为水的地形标志
  41.   attr_accessor :x                    # x坐标
  42.   attr_accessor :y                    # y坐标
  43.   attr_accessor :shipping             # 航海中标志
  44.   attr_accessor :ship                 # 船信息
  45.   #--------------------------------------------------------------------------
  46.   # ● 航海更新
  47.   #--------------------------------------------------------------------------
  48.   def shipping_update
  49.     return if !@shipping
  50.     @old_x = @x
  51.     @old_y = @y
  52.     # 着陆判断初始化
  53.     @land = false
  54.     # 移动中、事件执行中、强制移动路线中、
  55.     # 信息窗口一个也不显示的时候
  56.     unless moving? or $game_system.map_interpreter.running? or
  57.            @move_route_forcing or $game_temp.message_window_showing
  58.       # 如果方向键被按下、主角就朝那个方向移动
  59.       case Input.dir4
  60.       when 2
  61.         ship_move_down
  62.       when 4
  63.         ship_move_left
  64.       when 6
  65.         ship_move_right
  66.       when 8
  67.         ship_move_up
  68.       end
  69.     end
  70.     # 着陆判断
  71.     if @land
  72.       end_shipping
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 开始航海
  77.   #--------------------------------------------------------------------------
  78.   def start_shipping(ship)
  79.     $game_player.shipping = true
  80.     need_setup = false
  81.     # 处女航的话,刷新地图
  82.     if @ship.nil?
  83.       need_setup = true
  84.     end
  85.     # 把船事件添加入资料中
  86.     @ship = ship
  87.     # 移动角色
  88.     @x = @ship.x
  89.     @y = @ship.y
  90.     # 记录位置
  91.     @ship.ship_position = [$game_map.map_id, @ship.x, @ship.y]
  92.     if need_setup
  93.       $game_map.setup_ship
  94.     end
  95.     $game_map.need_refresh = true
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 着陆
  99.   #--------------------------------------------------------------------------
  100.   def end_shipping
  101.     # 获取带头的角色
  102.     actor = $game_party.actors[0]
  103.     # 设置角色的文件名及对像
  104.     @character_name = actor.character_name
  105.     @character_hue = actor.character_hue
  106.     # 关闭标志
  107.     @shipping = false
  108.     $game_switches[SHIPPING_SWITCH] = false
  109.     # 关闭停止时动画
  110.     @step_anime = false
  111.     # 回复速度
  112.     @move_speed = 4
  113.     # 设置船位置
  114.     @ship.ship_position = [$game_map.map_id, @old_x, @old_y]
  115.     @ship.moveto(@ship.ship_position[1], @ship.ship_position[2])
  116.     # 刷新地图
  117.     $game_map.need_refresh = true
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 向下移动
  121.   #     turn_enabled : 本场地位置更改许可标志
  122.   #--------------------------------------------------------------------------
  123.   def ship_move_down(turn_enabled = true)
  124.     # 面向下
  125.     if turn_enabled
  126.       turn_down
  127.     end
  128.     # 可以通行的场合
  129.     if ship_passable?(@x, @y, 2)
  130.       # 面向下
  131.       turn_down
  132.       # 更新坐标
  133.       @y += 1
  134.       # 增加步数
  135.       increase_steps
  136.     # 不能通行的情况下
  137.     else
  138.       # 接触事件的启动判定
  139.       check_event_trigger_touch(@x, @y+1)
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 向左移动
  144.   #     turn_enabled : 本场地位置更改许可标志
  145.   #--------------------------------------------------------------------------
  146.   def ship_move_left(turn_enabled = true)
  147.     # 面向左
  148.     if turn_enabled
  149.       turn_left
  150.     end
  151.     # 可以通行的情况下
  152.     if ship_passable?(@x, @y, 4)
  153.       # 面向左
  154.       turn_left
  155.       # 更新坐标
  156.       @x -= 1
  157.       # 增加步数
  158.       increase_steps
  159.     # 不能通行的情况下
  160.     else
  161.       # 接触事件的启动判定
  162.       check_event_trigger_touch(@x-1, @y)
  163.     end
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 向右移动
  167.   #     turn_enabled : 本场地位置更改许可标志
  168.   #--------------------------------------------------------------------------
  169.   def ship_move_right(turn_enabled = true)
  170.     # 面向右
  171.     if turn_enabled
  172.       turn_right
  173.     end
  174.     # 可以通行的场合
  175.     if ship_passable?(@x, @y, 6)
  176.       # 面向右
  177.       turn_right
  178.       # 更新坐标
  179.       @x += 1
  180.       # 增加部数
  181.       increase_steps
  182.     # 不能通行的情况下
  183.     else
  184.       # 接触事件的启动判定
  185.       check_event_trigger_touch(@x+1, @y)
  186.     end
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 向上移动
  190.   #     turn_enabled : 本场地位置更改许可标志
  191.   #--------------------------------------------------------------------------
  192.   def ship_move_up(turn_enabled = true)
  193.     # 面向上
  194.     if turn_enabled
  195.       turn_up
  196.     end
  197.     # 可以通行的情况下
  198.     if ship_passable?(@x, @y, 8)
  199.       # 面向上
  200.       turn_up
  201.       # 更新坐标
  202.       @y -= 1
  203.       # 歩数増加
  204.       increase_steps
  205.     # 不能通行的情况下
  206.     else
  207.       # 接触事件的启动判定
  208.       check_event_trigger_touch(@x, @y-1)
  209.     end
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 可以通行判定
  213.   #     x : X 坐标
  214.   #     y : Y 坐标
  215.   #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  216.   #--------------------------------------------------------------------------
  217.   def ship_passable?(x, y, d)
  218.     # 求得新的坐标
  219.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  220.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  221.     # 坐标在地图以外的情况
  222.     unless $game_map.valid?(new_x, new_y)
  223.       # 不能通行
  224.       return false
  225.     end
  226.     # 穿透是 ON 的情况下
  227.     if @through
  228.       # 可以通行
  229.       return true
  230.     end
  231.     # 移动者的元件无法来到指定方向的情况下
  232.     unless $game_map.passable?(x, y, d, self)
  233.       # 通行不可
  234.       return false
  235.     end
  236.     # 从指定方向不能进入到移动处的元件的情况下
  237.     unless $game_map.passable?(new_x, new_y, 10 - d)
  238.       # 不能通行
  239.       return false
  240.     end
  241.     # 循环全部事件
  242.     for event in $game_map.events.values
  243.       # 事件坐标于移动目标坐标一致的情况下
  244.       if event.x == new_x and event.y == new_y
  245.         # 穿透为 ON
  246.         unless event.through
  247.           # 自己就是事件的情况下
  248.           if self != $game_player
  249.             # 不能通行
  250.             return false
  251.           end
  252.           # 自己是主角、对方的图形是角色的情况下
  253.           if event.character_name != ""
  254.             # 不能通行
  255.             return false
  256.           end
  257.         end
  258.       end
  259.     end
  260.     # 主角的坐标与移动目标坐标一致的情况下
  261.     if $game_player.x == new_x and $game_player.y == new_y
  262.       # 穿透为 ON
  263.       unless $game_player.through
  264.         # 自己的图形是角色的情况下
  265.         if @character_name != ""
  266.           # 不能通行
  267.           return false
  268.         end
  269.       end
  270.     end
  271.     # 地形标志判断通行
  272.     for i in [2, 1, 0]
  273.       tile_id = $game_map.data[new_x, new_y, i]
  274.       return false if tile_id == nil
  275.     end
  276.     if $game_map.terrain_tag(new_x, new_y) != TERRAIN_TAG
  277.       if passable?(new_x, new_y, 0)
  278.         @land = true
  279.         return true
  280.       end
  281.       return false
  282.     end
  283.     # 可以通行
  284.     return true
  285.   end
  286. end

  287. #==============================================================================
  288. # ■ Game_Map
  289. #------------------------------------------------------------------------------
  290. #  处理地图的类。包含卷动以及可以通行的判断功能。
  291. # 本类的实例请参考 $game_map 。
  292. #==============================================================================
复制代码


循环的脚本太多个了
http://rpg.blue/viewthread.php?tid=69253&ntime=2007%2D12%2D23+17%3A50%3A29


这是当时的帖

各位帮忙看看可不可以修改一下航海的脚本

RA厚积而薄发

//and

game face

Lv1.梦旅人

教皇

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-12-15
帖子
541
3
 楼主| 发表于 2007-12-24 06:31:12 | 只看该作者
也可以[判断“当角色坐标在地图外时”显示“YOU ARE LOSE”然后回到定点(出生点)]
RA厚积而薄发

//and

game face
回复 支持 反对

使用道具 举报

Lv1.梦旅人

教皇

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-12-15
帖子
541
4
 楼主| 发表于 2007-12-27 02:21:32 | 只看该作者
诸位!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2026-6-20 15:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表