Project1
标题:
这个错误是什么引起的?
[打印本页]
作者:
颠倒的彩虹
时间:
2007-6-9 21:52
标题:
这个错误是什么引起的?
切入战斗中
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视。
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler # 战斗者
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 显示端口
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
#★★★★★★★★★★★★
@nx = 0
@xbit = 0
#★★★★★★★★★★★★
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 文件名和色相与当前情况有差异的情况下
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
@battler_hue = @battler.battler_hue
# 获取、设置位图
@battler_name = @battler.battler_name
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.is_a?(Game_Enemy)
if @battler.hidden
self.opacity = 0
end
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if
@nx += 2
@nx %= @battler.battler_frame * 10
@xbit = @nx / 10 * self.bitmap.width / 16
if @battler.damage == nil and @battler.dead?
self.src_rect.set(0, 0, self.bitmap.width / 16, self.bitmap.height)
else
self.src_rect.set(@xbit, 0, self.bitmap.width / 16, self.bitmap.height)
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
# 动画 ID 与当前的情况有差异的情况下
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 应该被显示的角色的情况下
# if @battler.is_a?(Game_Actor) and @battler_visible
# 不是主状态的时候稍稍降低点透明度
# if $game_temp.battle_main_phase
# self.opacity += 3 if self.opacity < 255
# else
# self.opacity -= 3 if self.opacity > 207
# end
# end
# 明灭
if @battler.blink
blink_on
else
blink_off
end
# 不可见的情况下
unless @battler_visible
# 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
if @battler.is_a?(Game_Enemy)
appear
else
@battler.battler_name = @battler.battler_name.split(/★/)[0]
end
@battler_visible = true
end
end
# 可见的情况下
if @battler_visible
# 逃跑
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白色闪烁
if @battler.white_flash
whiten
@battler.white_flash = false
end
# 动画
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if @battler.damage == nil and @battler.dead?#
@battler.battler_name = @battler.battler_name.split(/★/)[0]
@battler.battler_name = @battler.battler_name + "★2"
end
# @battler_visible = false
# end
end
# 设置活动块的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
复制代码
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
颠倒的彩虹
时间:
2007-6-9 21:52
标题:
这个错误是什么引起的?
切入战斗中
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视。
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler # 战斗者
#--------------------------------------------------------------------------
# ● 初始化对像
# viewport : 显示端口
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
#★★★★★★★★★★★★
@nx = 0
@xbit = 0
#★★★★★★★★★★★★
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 文件名和色相与当前情况有差异的情况下
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
@battler_hue = @battler.battler_hue
# 获取、设置位图
@battler_name = @battler.battler_name
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.is_a?(Game_Enemy)
if @battler.hidden
self.opacity = 0
end
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if
@nx += 2
@nx %= @battler.battler_frame * 10
@xbit = @nx / 10 * self.bitmap.width / 16
if @battler.damage == nil and @battler.dead?
self.src_rect.set(0, 0, self.bitmap.width / 16, self.bitmap.height)
else
self.src_rect.set(@xbit, 0, self.bitmap.width / 16, self.bitmap.height)
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
# 动画 ID 与当前的情况有差异的情况下
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 应该被显示的角色的情况下
# if @battler.is_a?(Game_Actor) and @battler_visible
# 不是主状态的时候稍稍降低点透明度
# if $game_temp.battle_main_phase
# self.opacity += 3 if self.opacity < 255
# else
# self.opacity -= 3 if self.opacity > 207
# end
# end
# 明灭
if @battler.blink
blink_on
else
blink_off
end
# 不可见的情况下
unless @battler_visible
# 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
if @battler.is_a?(Game_Enemy)
appear
else
@battler.battler_name = @battler.battler_name.split(/★/)[0]
end
@battler_visible = true
end
end
# 可见的情况下
if @battler_visible
# 逃跑
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白色闪烁
if @battler.white_flash
whiten
@battler.white_flash = false
end
# 动画
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if @battler.damage == nil and @battler.dead?#
@battler.battler_name = @battler.battler_name.split(/★/)[0]
@battler.battler_name = @battler.battler_name + "★2"
end
# @battler_visible = false
# end
end
# 设置活动块的坐标
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
复制代码
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
美兽
时间:
2007-6-9 21:53
不能将“nil”转成“字符串”。
作者:
颠倒的彩虹
时间:
2007-6-9 21:57
那为什么以前不出错…自从神思帮我修改了BUG后我今天才发现,他没有动这个脚本的.
作者:
美兽
时间:
2007-6-11 20:46
原本的错误是什么???
涉及到战斗者的增减了吗?
作者:
颠倒的彩虹
时间:
2007-6-14 06:33
没有,让他处理的BUG,没有涉及战斗.他现在好象忙着考试呢,好久没见了
作者:
紫嫣
时间:
2007-6-14 06:40
提示:
作者被禁止或删除 内容自动屏蔽
作者:
美兽
时间:
2007-6-15 01:40
以下引用
颠倒的彩虹于2007-6-13 22:33:09
的发言:
没有,让他处理的BUG,没有涉及战斗.他现在好象忙着考试呢,好久没见了
你可以试试用未处理过的版本测试下是否有BUG,
作者:
颠倒的彩虹
时间:
2007-6-15 23:15
没有。
作者:
fasheng1234
时间:
2007-6-15 23:22
提示:
作者被禁止或删除 内容自动屏蔽
作者:
泪鱼
时间:
2007-6-15 23:28
提示:
作者被禁止或删除 内容自动屏蔽
作者:
亿万星辰
时间:
2007-6-16 01:56
第53行貌似是
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
错误所在貌似是 @battler_name
但 @battler_name 是通过这里来的
@battler_name = @battler.battler_name
现在这个值为nil...说明..........
作者:
颠倒的彩虹
时间:
2007-6-16 17:40
orz我做新角色没有把战斗中那些挨打什么的给做了。。。就是XXX★...以为不挨打用不到。牢烦诸位。。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1