Project1
标题:
传送脚本与人物跟随脚本有冲突,求救
[打印本页]
作者:
口水怪
时间:
2008-8-18 06:46
标题:
传送脚本与人物跟随脚本有冲突,求救
我使用的是 传送系统
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
传送时,画面白光一闪,声音也出来了。然后就出了这个对话框。队伍一个人的时候也会发生这个问题
请问这是怎么回事? [LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
虚幻死神
时间:
2008-8-18 07:36
話說LZ.....你想用100積分收買我幫你整合??
作者:
口水怪
时间:
2008-8-18 18:30
以下引用
虚幻死神于2008-8-17 23:36:21
的发言:
話說LZ.....你想用100積分收買我幫你整合??
{/pz} 是因为整合的问题么?我只是不明白为什么会出错。貌似没有能出错的可能啊
作者:
劍之飛龍☆
时间:
2008-8-18 18:38
http://rpg.blue/viewthread.php?tid=63174
http://rpg.blue/htm/Topic_50080.htm
套个公共事件吧
作者:
卓越大白痴
时间:
2008-8-18 19:37
我现在用这个和人物跟随 没有冲突
#==============================================================================
# 传送点系统(仿暗黑) by 沉影不器
#------------------------------------------------------------------------------
# 功能: 仿暗黑制作的传送点,在传送点确定键即激活传送点,各个已激活的传送点之间可
# 相互传送.指向当前所在地图的选项不传送;要求金钱的地图,钱不够不传送.
# 为节省位置,折成两列显示
#------------------------------------------------------------------------------
# 使用说明: ① 复制脚本插入到main之间
# ② 传送点的事件脚本中写 $scene = Scene_Way_points.new(@event_id)
# (无能范例中,传送点事件添加美化用的独立开关)
# ③ 在RM地图设置里给每张有传送点的地图取个名称
# ④ 要求金钱的地图,在名称后添加",金钱数"(不包括引号),详见范例
#==============================================================================
module WP
# 脚本参数设定:
WP_WIDTH = 180 # 自定义每列地图选项的宽度(共两列)
WP_ANIMATION = 101 # 自定义传送时显示的动画id
WP_ICON = "038-Item07" # 自定义地图选项的图标名称
# 您也可以为每个地图设置单独图标
SELF_ICON = false # 开关打开后将描绘Icons文件夹下与地图名相同的图标
end
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :commands # 传送点选项
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
alias way_points_ini initialize
def initialize
@commands = []
way_points_ini
end
end
#==============================================================================
# ■ Window_WP_Help
#==============================================================================
class Window_WP_Help < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
x = 320 - WP::WP_WIDTH
y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 + 96 : 176)
super(x, y, WP::WP_WIDTH*2, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
end
#--------------------------------------------------------------------------
# ● 设置文本
# text1 : 地图名
# text2 : 金钱数
#--------------------------------------------------------------------------
def set_text(text1, text2)
if text1 != @text1 or text2 != @text2
@text1 = text1
@text2 = text2
# 再描绘文本
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, self.width - 40, 32, text1 + "传送点")
self.contents.font.color = normal_color
if text2 == 0
text2 = "免费传送"
else
text2 = "花费" + text2.to_s + $data_system.words.gold
end
self.contents.draw_text(4, 32, self.width - 40, 32, text2, 2)
end
self.visible = true
end
end
#==============================================================================
# ■ Window_Way_Points
#==============================================================================
class Window_Way_Points < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
# map_id : 当前事件 id
#--------------------------------------------------------------------------
def initialize(event_id)
#@event_id = event_id
@column_max = 2
mapinfo = load_data("Data/MapInfos.rxdata")
id = $game_map.map_id
map_name = mapinfo[id].name.split(/,/)[0]
cost = mapinfo[id].name.split(/,/)[1] == nil ? 0 : mapinfo[id].name.split(/,/)[1].to_i
$game_system.commands = setup(id, map_name, cost, event_id)
x = 320 - WP::WP_WIDTH
y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 : 80)
super(x, y, WP::WP_WIDTH*2, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32+32 : 192)
@item_max = $game_system.commands.size
@column_max = 2
self.contents = Bitmap.new(WP::WP_WIDTH*2 - 32, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32 : 160)
self.opacity = 160
refresh
# 光标停留在当前地图选项
self.index = now_index(id)
end
#--------------------------------------------------------------------------
# ● 选项设定
# map_id : 地图编号
# map_name : 地图名称
# cost : 花费
# map_id : 当前事件 id
#--------------------------------------------------------------------------
def setup(map_id, map_name, cost ,event_id)
map_commands = $game_system.commands
if !map_commands.include?([map_id, map_name, cost ,event_id])
map_commands.push([map_id, map_name, cost ,event_id])
end
return map_commands
end
#--------------------------------------------------------------------------
# ● 是否能传送
# index : 选项编号
#--------------------------------------------------------------------------
def transportable?(index)
if $game_system.commands.empty?
return false
end
map_id = $game_system.commands[index][0]
cost = $game_system.commands[index][2]
if map_id!= $game_map.map_id and cost <= $game_party.gold
return true
else
return false
end
end
#--------------------------------------------------------------------------
# ● 获取地图 id
#--------------------------------------------------------------------------
def item
return $game_system.commands[self.index][0]
end
#--------------------------------------------------------------------------
# ● 获取当前地图 index
# map_id : 地图编号
#--------------------------------------------------------------------------
def now_index(map_id)
now_index = 0
for i in 0...$game_system.commands.size
if $game_system.commands[i][0] == map_id
now_index = i
break
end
end
return now_index
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $game_system.commands.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
if transportable?(index)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * WP::WP_WIDTH
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
# 显示图标
if WP::SELF_ICON
bitmap = RPG::Cache.icon($game_system.commands[index][1])
else
bitmap = RPG::Cache.icon(WP::WP_ICON)
end
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, WP::WP_WIDTH-36, 32, $game_system.commands[index][1])
end
#--------------------------------------------------------------------------
# ● 刷新帮助
#--------------------------------------------------------------------------
def update_help
# 地图名称
text1 = $game_system.commands[self.index][1]
# 花费
text2 = $game_system.commands[self.index][2]
@help_window.set_text(text1, text2)
end
end
#==============================================================================
# ■ Scene_Way_points
#==============================================================================
class Scene_Way_points
#--------------------------------------------------------------------------
# ● 初始化对像
# map_id : 当前事件 id
#--------------------------------------------------------------------------
def initialize(event_id)
@event_id = event_id
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@map_sprite = Spriteset_Map.new
@way_points_window = Window_Way_Points.new(@event_id)
@help_window = Window_WP_Help.new
@way_points_window.help_window = @help_window
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@way_points_window.dispose
@map_sprite.dispose
Graphics.update
end
#--------------------------------------------------------------------------
# ● 取得传送点坐标
# map_id : 地图编号
#--------------------------------------------------------------------------
def way_point_xy(map_id)
new_map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
index = @way_points_window.index
i = $game_system.commands[index][3].to_i
return [new_map.events[i].x,new_map.events[i].y]
end
#--------------------------------------------------------------------------
# ● 传送
# map_id : 地图编号
#--------------------------------------------------------------------------
def trans(map_id)
event_xy = way_point_xy(map_id)
if event_xy != nil
# 移动
$game_temp.player_transferring = true
$game_temp.player_new_map_id = map_id
$game_temp.player_new_x = event_xy[0]
$game_temp.player_new_y = event_xy[1]
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@way_points_window.update
# 按下取消键的情况下
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
return
end
# 按下确定键的情况下
if Input.trigger?(Input::C)
index = @way_points_window.index
# 排除无法传送的情况
if !@way_points_window.transportable?(index)
$game_system.se_play($data_system.buzzer_se)
else
# $game_system.se_play($data_system.decision_se)
# 传送
map_id = @way_points_window.item
trans(map_id)
# 扣钱
$game_party.gain_gold(-$game_system.commands[index][2])
# 动画 <------ Iselia雪 的方法
$game_player.animation_id = WP::WP_ANIMATION
$data_animations[WP::WP_ANIMATION].frame_max.times do
Graphics.update
@map_sprite.update
end
$scene = Scene_Map.new
return
end
end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
卓越大白痴
时间:
2008-8-18 19:37
这个效果也比较好
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1