| 赞 | 0 |
| VIP | 0 |
| 好人卡 | 0 |
| 积分 | 1 |
| 经验 | 4034 |
| 最后登录 | 2013-12-23 |
| 在线时间 | 13 小时 |
Lv1.梦旅人 教皇
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 13 小时
- 注册时间
- 2007-12-15
- 帖子
- 541
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
如题
使用航海脚本时,到地图循环处船总是过不去
我曾经把航海脚本中
这一段
# 坐标在地图以外的情况
unless $game_map.valid?(new_x, new_y)
# 不能通行
return false
end
改成
# 任意通行
return true
#(当时可能是晕了,)这样当然不行
这是航海的脚本- =begin
- --------------------------------------------------------------------------
- 跨地图航海辅佐脚本 v1.1
- By 叶子
- Date 4-8-2006
- --------------------------------------------------------------------------
- 跨地图航海由一个脚本+一个事件完成
-
- 使用方法(请耐心阅读完全部说明!每一步都必不可少):
-
- -插入本脚本到Main之上
-
- -二选一:
- 一)插入航海脚本懒人插件到Main之上,或者
- 二)仔细观察插件脚本,找到:
- #-----------插入船命令-----------(已插入)
- setup_ship
- #--------------------------------
- 和
- #---------插入船刷新命令---------(已插入)
- $game_player.shipping_update
- #--------------------------------
- 插入到Game_Map中相同位置(出现冲突时采用此方法)
-
- -小船事件设置方法:
- 小船为范例工程工程里湖中的矿道车,可以改成其它船的行走图
- 第二页出现条件设置为航行中标志开关打开(默认50号开关),第三页为独立开关A打开
-
- -水中通行设置方法:
- 把所有水的图块的地形标志设置为1,把水中不可通行图块(例如水中礁石)的地形标志
- 设置为2或以上(反正要大于水的地形标志)
-
- 注意事项:
-
- -不明白小船实现原理的话最好不要改小船事件(除了注释说可以随便改的地方之外)
- -默认角色航行中的话,50号开关打开,这时可以利用并行公共事件判断角色遇敌等
- -航行中标志开关只能用于判断,不要在其它事件中打开或关闭,否则可能出错误
-
- =end
- SHIPPING_SWITCH = 50 # 默认50号开关为是否航行中标志开关
- #==============================================================================
- # ■ Game_Player
- #------------------------------------------------------------------------------
- # 处理主角的类。事件启动的判定、以及地图的滚动等功能。
- # 本类的实例请参考 $game_player。
- #==============================================================================
- class Game_Player < Game_Character
- TERRAIN_TAG = 1 # 默认1号地形标志为水的地形标志
- attr_accessor :x # x坐标
- attr_accessor :y # y坐标
- attr_accessor :shipping # 航海中标志
- attr_accessor :ship # 船信息
- #--------------------------------------------------------------------------
- # ● 航海更新
- #--------------------------------------------------------------------------
- def shipping_update
- return if !@shipping
- @old_x = @x
- @old_y = @y
- # 着陆判断初始化
- @land = false
- # 移动中、事件执行中、强制移动路线中、
- # 信息窗口一个也不显示的时候
- unless moving? or $game_system.map_interpreter.running? or
- @move_route_forcing or $game_temp.message_window_showing
- # 如果方向键被按下、主角就朝那个方向移动
- case Input.dir4
- when 2
- ship_move_down
- when 4
- ship_move_left
- when 6
- ship_move_right
- when 8
- ship_move_up
- end
- end
- # 着陆判断
- if @land
- end_shipping
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始航海
- #--------------------------------------------------------------------------
- def start_shipping(ship)
- $game_player.shipping = true
- need_setup = false
- # 处女航的话,刷新地图
- if @ship.nil?
- need_setup = true
- end
- # 把船事件添加入资料中
- @ship = ship
- # 移动角色
- @x = @ship.x
- @y = @ship.y
- # 记录位置
- @ship.ship_position = [$game_map.map_id, @ship.x, @ship.y]
- if need_setup
- $game_map.setup_ship
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● 着陆
- #--------------------------------------------------------------------------
- def end_shipping
- # 获取带头的角色
- actor = $game_party.actors[0]
- # 设置角色的文件名及对像
- @character_name = actor.character_name
- @character_hue = actor.character_hue
- # 关闭标志
- @shipping = false
- $game_switches[SHIPPING_SWITCH] = false
- # 关闭停止时动画
- @step_anime = false
- # 回复速度
- @move_speed = 4
- # 设置船位置
- @ship.ship_position = [$game_map.map_id, @old_x, @old_y]
- @ship.moveto(@ship.ship_position[1], @ship.ship_position[2])
- # 刷新地图
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● 向下移动
- # turn_enabled : 本场地位置更改许可标志
- #--------------------------------------------------------------------------
- def ship_move_down(turn_enabled = true)
- # 面向下
- if turn_enabled
- turn_down
- end
- # 可以通行的场合
- if ship_passable?(@x, @y, 2)
- # 面向下
- turn_down
- # 更新坐标
- @y += 1
- # 增加步数
- increase_steps
- # 不能通行的情况下
- else
- # 接触事件的启动判定
- check_event_trigger_touch(@x, @y+1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 向左移动
- # turn_enabled : 本场地位置更改许可标志
- #--------------------------------------------------------------------------
- def ship_move_left(turn_enabled = true)
- # 面向左
- if turn_enabled
- turn_left
- end
- # 可以通行的情况下
- if ship_passable?(@x, @y, 4)
- # 面向左
- turn_left
- # 更新坐标
- @x -= 1
- # 增加步数
- increase_steps
- # 不能通行的情况下
- else
- # 接触事件的启动判定
- check_event_trigger_touch(@x-1, @y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 向右移动
- # turn_enabled : 本场地位置更改许可标志
- #--------------------------------------------------------------------------
- def ship_move_right(turn_enabled = true)
- # 面向右
- if turn_enabled
- turn_right
- end
- # 可以通行的场合
- if ship_passable?(@x, @y, 6)
- # 面向右
- turn_right
- # 更新坐标
- @x += 1
- # 增加部数
- increase_steps
- # 不能通行的情况下
- else
- # 接触事件的启动判定
- check_event_trigger_touch(@x+1, @y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 向上移动
- # turn_enabled : 本场地位置更改许可标志
- #--------------------------------------------------------------------------
- def ship_move_up(turn_enabled = true)
- # 面向上
- if turn_enabled
- turn_up
- end
- # 可以通行的情况下
- if ship_passable?(@x, @y, 8)
- # 面向上
- turn_up
- # 更新坐标
- @y -= 1
- # 歩数増加
- increase_steps
- # 不能通行的情况下
- else
- # 接触事件的启动判定
- check_event_trigger_touch(@x, @y-1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 可以通行判定
- # x : X 坐标
- # y : Y 坐标
- # d : 方向 (0,2,4,6,8) ※ 0 = 全方向不能通行的情况判定 (跳跃用)
- #--------------------------------------------------------------------------
- def ship_passable?(x, y, d)
- # 求得新的坐标
- new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
- new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
- # 坐标在地图以外的情况
- unless $game_map.valid?(new_x, new_y)
- # 不能通行
- return false
- end
- # 穿透是 ON 的情况下
- if @through
- # 可以通行
- return true
- end
- # 移动者的元件无法来到指定方向的情况下
- unless $game_map.passable?(x, y, d, self)
- # 通行不可
- return false
- end
- # 从指定方向不能进入到移动处的元件的情况下
- unless $game_map.passable?(new_x, new_y, 10 - d)
- # 不能通行
- return false
- end
- # 循环全部事件
- for event in $game_map.events.values
- # 事件坐标于移动目标坐标一致的情况下
- if event.x == new_x and event.y == new_y
- # 穿透为 ON
- unless event.through
- # 自己就是事件的情况下
- if self != $game_player
- # 不能通行
- return false
- end
- # 自己是主角、对方的图形是角色的情况下
- if event.character_name != ""
- # 不能通行
- return false
- end
- end
- end
- end
- # 主角的坐标与移动目标坐标一致的情况下
- if $game_player.x == new_x and $game_player.y == new_y
- # 穿透为 ON
- unless $game_player.through
- # 自己的图形是角色的情况下
- if @character_name != ""
- # 不能通行
- return false
- end
- end
- end
- # 地形标志判断通行
- for i in [2, 1, 0]
- tile_id = $game_map.data[new_x, new_y, i]
- return false if tile_id == nil
- end
- if $game_map.terrain_tag(new_x, new_y) != TERRAIN_TAG
- if passable?(new_x, new_y, 0)
- @land = true
- return true
- end
- return false
- end
- # 可以通行
- return true
- end
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 处理地图的类。包含卷动以及可以通行的判断功能。
- # 本类的实例请参考 $game_map 。
- #==============================================================================
复制代码
循环的脚本太多个了
http://rpg.blue/viewthread.php?tid=69253&ntime=2007%2D12%2D23+17%3A50%3A29
这是当时的帖
各位帮忙看看可不可以修改一下航海的脚本
|
|