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

Project1

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

传送脚本与人物跟随脚本有冲突,求救

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-13
帖子
26
跳转到指定楼层
1
发表于 2008-8-18 06:46:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我使用的是 传送系统
http://rpg.blue/web/htm/news112.htm

还有人物跟随系统
http://rpg.blue/web/htm/news190.htm

应该说算是两个比较保险的系统了。我在游戏中使用传送命令后。提示

人物跟随发生了NoMethod Error

undefined method 'setup_actor_character_sprites 'for nil:NilClass

传送时,画面白光一闪,声音也出来了。然后就出了这个对话框。队伍一个人的时候也会发生这个问题

请问这是怎么回事?
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

天壤

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-7-18
帖子
1435
2
发表于 2008-8-18 07:36:21 | 只看该作者
話說LZ.....你想用100積分收買我幫你整合??
时隔多年。我还是觉得66才是我的家。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-13
帖子
26
3
 楼主| 发表于 2008-8-18 18:30:07 | 只看该作者
以下引用虚幻死神于2008-8-17 23:36:21的发言:

話說LZ.....你想用100積分收買我幫你整合??

{/pz} 是因为整合的问题么?我只是不明白为什么会出错。貌似没有能出错的可能啊
回复 支持 反对

使用道具 举报

Lv2.观梦者

龙骑

梦石
0
星屑
545
在线时间
10 小时
注册时间
2007-12-31
帖子
2030
4
发表于 2008-8-18 18:38:22 | 只看该作者
http://rpg.blue/viewthread.php?tid=63174
http://rpg.blue/htm/Topic_50080.htm

套个公共事件吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2007-8-10
帖子
284
5
发表于 2008-8-18 19:37:01 | 只看该作者
我现在用这个和人物跟随 没有冲突
  1. #==============================================================================
  2. # 传送点系统(仿暗黑) by 沉影不器
  3. #------------------------------------------------------------------------------
  4. # 功能: 仿暗黑制作的传送点,在传送点确定键即激活传送点,各个已激活的传送点之间可
  5. #       相互传送.指向当前所在地图的选项不传送;要求金钱的地图,钱不够不传送.
  6. #       为节省位置,折成两列显示
  7. #------------------------------------------------------------------------------
  8. # 使用说明: ① 复制脚本插入到main之间
  9. #           ② 传送点的事件脚本中写 $scene = Scene_Way_points.new(@event_id)
  10. #              (无能范例中,传送点事件添加美化用的独立开关)
  11. #           ③ 在RM地图设置里给每张有传送点的地图取个名称
  12. #           ④ 要求金钱的地图,在名称后添加",金钱数"(不包括引号),详见范例
  13. #==============================================================================
  14. module WP
  15. # 脚本参数设定:
  16.   WP_WIDTH = 180             # 自定义每列地图选项的宽度(共两列)
  17.   WP_ANIMATION = 101         # 自定义传送时显示的动画id
  18.   WP_ICON = "038-Item07"     # 自定义地图选项的图标名称
  19.                              # 您也可以为每个地图设置单独图标
  20.   SELF_ICON = false          # 开关打开后将描绘Icons文件夹下与地图名相同的图标
  21. end
  22. #==============================================================================

  23. class Game_System
  24.   #--------------------------------------------------------------------------
  25.   # ● 定义实例变量
  26.   #--------------------------------------------------------------------------
  27.   attr_accessor :commands    # 传送点选项
  28.   #--------------------------------------------------------------------------
  29.   # ● 初始化对像
  30.   #--------------------------------------------------------------------------
  31.   alias way_points_ini initialize
  32.   def initialize
  33.     @commands = []
  34.     way_points_ini
  35.   end
  36. end
  37. #==============================================================================
  38. # ■ Window_WP_Help
  39. #==============================================================================
  40. class Window_WP_Help < Window_Base
  41.   #--------------------------------------------------------------------------
  42.   # ● 初始化对像
  43.   #--------------------------------------------------------------------------
  44.   def initialize
  45.     x = 320 - WP::WP_WIDTH
  46.     y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 + 96 : 176)
  47.     super(x, y, WP::WP_WIDTH*2, 96)
  48.     self.contents = Bitmap.new(width - 32, height - 32)
  49.     self.opacity  = 160
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 设置文本
  53.   #     text1  : 地图名
  54.   #     text2  : 金钱数
  55.   #--------------------------------------------------------------------------
  56.   def set_text(text1, text2)
  57.     if text1 != @text1 or text2 != @text2
  58.       @text1 = text1
  59.       @text2 = text2
  60.       # 再描绘文本
  61.       self.contents.clear
  62.       self.contents.font.color = system_color
  63.       self.contents.draw_text(4, 0, self.width - 40, 32, text1 + "传送点")
  64.       self.contents.font.color = normal_color
  65.       if text2 == 0
  66.         text2 = "免费传送"
  67.       else
  68.         text2 = "花费" + text2.to_s + $data_system.words.gold
  69.       end
  70.       self.contents.draw_text(4, 32, self.width - 40, 32, text2, 2)
  71.     end
  72.     self.visible = true
  73.   end
  74. end

  75. #==============================================================================
  76. # ■ Window_Way_Points
  77. #==============================================================================
  78. class Window_Way_Points < Window_Selectable
  79.   #--------------------------------------------------------------------------
  80.   # ● 初始化
  81.   #     map_id : 当前事件 id
  82.   #--------------------------------------------------------------------------
  83.   def initialize(event_id)
  84.     #@event_id = event_id
  85.     @column_max = 2
  86.     mapinfo = load_data("Data/MapInfos.rxdata")
  87.     id = $game_map.map_id
  88.     map_name = mapinfo[id].name.split(/,/)[0]
  89.     cost = mapinfo[id].name.split(/,/)[1] == nil ? 0 : mapinfo[id].name.split(/,/)[1].to_i
  90.     $game_system.commands = setup(id, map_name, cost, event_id)
  91.     x = 320 - WP::WP_WIDTH
  92.     y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 : 80)
  93.     super(x, y, WP::WP_WIDTH*2, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32+32 : 192)
  94.     @item_max = $game_system.commands.size
  95.     @column_max = 2
  96.     self.contents = Bitmap.new(WP::WP_WIDTH*2 - 32, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32 : 160)
  97.     self.opacity  = 160
  98.     refresh
  99.     # 光标停留在当前地图选项
  100.     self.index = now_index(id)
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 选项设定
  104.   #     map_id   : 地图编号
  105.   #     map_name : 地图名称
  106.   #     cost     : 花费
  107.   #     map_id : 当前事件 id
  108.   #--------------------------------------------------------------------------
  109.   def setup(map_id, map_name, cost ,event_id)
  110.     map_commands = $game_system.commands
  111.     if !map_commands.include?([map_id, map_name, cost ,event_id])
  112.       map_commands.push([map_id, map_name, cost ,event_id])
  113.     end
  114.     return map_commands
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 是否能传送
  118.   #     index     : 选项编号
  119.   #--------------------------------------------------------------------------
  120.   def transportable?(index)
  121.     if $game_system.commands.empty?
  122.       return false
  123.     end
  124.     map_id = $game_system.commands[index][0]
  125.     cost = $game_system.commands[index][2]
  126.     if map_id!= $game_map.map_id and cost <= $game_party.gold
  127.       return true
  128.     else
  129.       return false
  130.     end
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 获取地图 id
  134.   #--------------------------------------------------------------------------
  135.   def item
  136.     return $game_system.commands[self.index][0]
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 获取当前地图 index
  140.   #     map_id    : 地图编号
  141.   #--------------------------------------------------------------------------
  142.   def now_index(map_id)
  143.     now_index = 0
  144.     for i in 0...$game_system.commands.size
  145.       if $game_system.commands[i][0] == map_id
  146.         now_index = i
  147.         break
  148.       end
  149.     end
  150.     return now_index
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 刷新
  154.   #--------------------------------------------------------------------------
  155.   def refresh
  156.     if self.contents != nil
  157.       self.contents.dispose
  158.       self.contents = nil
  159.     end
  160.     @item_max = $game_system.commands.size
  161.     if @item_max > 0
  162.       self.contents = Bitmap.new(width - 32, row_max * 32)
  163.       for i in 0...@item_max
  164.         draw_item(i)
  165.       end
  166.     end
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 描绘项目
  170.   #     index : 项目编号
  171.   #--------------------------------------------------------------------------
  172.   def draw_item(index)
  173.     if transportable?(index)
  174.       self.contents.font.color = normal_color
  175.     else
  176.       self.contents.font.color = disabled_color
  177.     end
  178.     x = 4 + index % 2 * WP::WP_WIDTH
  179.     y = index / 2 * 32
  180.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  181.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  182.     # 显示图标
  183.     if WP::SELF_ICON
  184.       bitmap = RPG::Cache.icon($game_system.commands[index][1])
  185.     else
  186.       bitmap = RPG::Cache.icon(WP::WP_ICON)
  187.     end
  188.     opacity = self.contents.font.color == normal_color ? 255 : 128
  189.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  190.     self.contents.draw_text(x + 28, y, WP::WP_WIDTH-36, 32, $game_system.commands[index][1])
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 刷新帮助
  194.   #--------------------------------------------------------------------------
  195.   def update_help
  196.     # 地图名称
  197.     text1 = $game_system.commands[self.index][1]
  198.     # 花费
  199.     text2 = $game_system.commands[self.index][2]
  200.     @help_window.set_text(text1, text2)
  201.   end
  202. end

  203. #==============================================================================
  204. # ■ Scene_Way_points
  205. #==============================================================================
  206. class Scene_Way_points
  207.   #--------------------------------------------------------------------------
  208.   # ● 初始化对像
  209.   #     map_id : 当前事件 id
  210.   #--------------------------------------------------------------------------
  211.   def initialize(event_id)
  212.     @event_id = event_id
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 主处理
  216.   #--------------------------------------------------------------------------
  217.   def main
  218.     @map_sprite = Spriteset_Map.new
  219.     @way_points_window = Window_Way_Points.new(@event_id)
  220.     @help_window = Window_WP_Help.new
  221.     @way_points_window.help_window = @help_window
  222.     Graphics.transition
  223.     loop do
  224.       Graphics.update
  225.       Input.update
  226.       update
  227.       if $scene != self
  228.         break
  229.       end
  230.     end
  231.     Graphics.freeze
  232.     @help_window.dispose
  233.     @way_points_window.dispose
  234.     @map_sprite.dispose
  235.     Graphics.update
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 取得传送点坐标
  239.   #     map_id : 地图编号
  240.   #--------------------------------------------------------------------------
  241.   def way_point_xy(map_id)
  242.     new_map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
  243.     index = @way_points_window.index
  244.     i = $game_system.commands[index][3].to_i
  245.     return [new_map.events[i].x,new_map.events[i].y]
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● 传送
  249.   #     map_id : 地图编号
  250.   #--------------------------------------------------------------------------
  251.   def trans(map_id)
  252.     event_xy = way_point_xy(map_id)
  253.     if event_xy != nil
  254.       # 移动
  255.       $game_temp.player_transferring = true
  256.       $game_temp.player_new_map_id = map_id
  257.       $game_temp.player_new_x = event_xy[0]
  258.       $game_temp.player_new_y = event_xy[1]
  259.     end
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 刷新画面
  263.   #--------------------------------------------------------------------------
  264.   def update
  265.     # 刷新窗口
  266.     @help_window.update
  267.     @way_points_window.update
  268.     # 按下取消键的情况下
  269.     if Input.trigger?(Input::B)
  270.       $game_system.se_play($data_system.decision_se)
  271.       $scene = Scene_Map.new
  272.       return
  273.     end
  274.     # 按下确定键的情况下
  275.     if Input.trigger?(Input::C)
  276.       index = @way_points_window.index
  277.       # 排除无法传送的情况
  278.       if !@way_points_window.transportable?(index)
  279.         $game_system.se_play($data_system.buzzer_se)
  280.       else
  281.         # $game_system.se_play($data_system.decision_se)
  282.         # 传送
  283.         map_id = @way_points_window.item
  284.         trans(map_id)
  285.         # 扣钱
  286.         $game_party.gain_gold(-$game_system.commands[index][2])
  287.         # 动画 <------ Iselia雪 的方法
  288.         $game_player.animation_id = WP::WP_ANIMATION
  289.         $data_animations[WP::WP_ANIMATION].frame_max.times do
  290.           Graphics.update
  291.           @map_sprite.update
  292.         end
  293.         $scene = Scene_Map.new
  294.         return
  295.       end
  296.     end
  297.   end
  298. end
复制代码

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2007-8-10
帖子
284
6
发表于 2008-8-18 19:37:38 | 只看该作者
这个效果也比较好
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-26 09:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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