Project1
标题:
RPG Maker VX 怪物血量脚本(插入后第73行发生NoMethodError求解)
[打印本页]
作者:
d411345108
时间:
2013-8-23 02:35
标题:
RPG Maker VX 怪物血量脚本(插入后第73行发生NoMethodError求解)
(RPG Maker VX)可以进入战斗,战斗画面结束之后,就出来弹框,求高人解答。(游戏中有其他脚本,可能是冲突引起的,找了好几个血量脚本插入都不行。唯一这个还可以进入战斗画面)
33.png
(403.13 KB, 下载次数: 28)
下载附件
保存到相册
求解
2013-8-23 02:33 上传
脚本如下:
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
# enemy : 角色
# x : 描绘目标 X 坐标
# y : 描绘目标 Y 坐标
# width : 宽
#--------------------------------------------------------------------------
def draw_enemy_hp(enemy, x, y, width = 65)
draw_actor_hp_gauge(enemy, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(enemy)
xr = x + width
self.contents.draw_text(xr - 40, y, 40, WLH, enemy.hp, 2)
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视、活动块状态自动变化。
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 常量
#--------------------------------------------------------------------------
WHITEN = 1 # 白色闪烁 (开始行动)
BLINK = 2 # 闪烁 (伤害)
APPEAR = 3 # 出现 (出现、复活)
DISAPPEAR = 4 # 消失 (逃走)
COLLAPSE = 5 # 崩溃 (不能战斗)
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# ● 初始化对象
# viewport : 视区
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler
= battler
@battler_visible = false
@effect_type = 0 # 效果种类
@effect_duration = 0 # 效果剩余时间
if @battler.is_a?(Game_Enemy)
width = 65 + 32
height = 24 + 32
x = @battler.screen_x - width/2
y = @battler.screen_y - height/2
@enemy_hp_window = Window_Base.new(x, y, width, height)
@enemy_hp_window.opacity = 0
@enemy_hp_window.contents = Bitmap.new(width - 32, height - 32)
@enemy_hp_window.draw_enemy_hp(@battler, 0, 0, 65)
@old_hp = -1
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
@enemy_hp_window.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
else
@use_sprite = @battler.use_sprite?
if @use_sprite
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
update_battler_bitmap
end
setup_new_effect
update_effect
if @enemy_hp_window != nil and @old_hp != @battler.hp
@enemy_hp_window.contents.clear
@enemy_hp_window.draw_enemy_hp(@battler, 0, 0, 65)
@old_hp = @battler.hp
end
end
end
end
作者:
怪蜀黍
时间:
2013-8-24 09:45
找到
@enemy_hp_window.dispose
复制代码
改成
@enemy_hp_window.dispose unless @enemy_hp_window.nil?
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1