Project1
标题:
战斗特技栏错乱...
[打印本页]
作者:
zhli667
时间:
2009-6-8 21:05
标题:
战斗特技栏错乱...
战斗特技栏中的特技是按着一排4个技能排列的,而刷新的图标却是按一排2个技能排列的.
帮助窗口、技能使用都没问题。只是图标有问题。
相关脚本
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
#==============================================================================
class Window_Skill_New < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 390)
self.z = 1000
self.opacity = 100
self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
@actor = actor
@column_max = 4
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取特技
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
[email protected]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32,row_max * 52) #row_max * 32
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 4 * (self.width / 2)
y = index / 4 * 52
rect = Rect.new(x, y, self.width / @column_max - 32, 32+52)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x-5, y + 4, bitmap, Rect.new(0, 0, 40, 40), opacity)
self.contents.font.size = 18
self.contents.draw_text(x + 25, y, 200, 32, skill.name, 0)
self.contents.draw_text(x + 72, y, 42, 32+41, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
#--------------------------------------------------------------------------
# ● 获取 1 页可以显示的行数
#--------------------------------------------------------------------------
def page_row_max
# 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
return (self.height - 32) / 52
end
#--------------------------------------------------------------------------
# ● 获取 1 页可以显示的项目数
#--------------------------------------------------------------------------
def page_item_max
# 将行数 page_row_max 乘上列数 @column_max
return page_row_max * @column_max
end
def top_row
# 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
return self.oy / 52
end
#--------------------------------------------------------------------------
# ● 设置开头行
# row : 显示开头的行
#--------------------------------------------------------------------------
def top_row=(row)
# row 未满 0 的场合更正为 0
if row < 0
row = 0
end
# row 超过 row_max - 1 的情况下更正为 row_max - 1
if row > row_max - 1
row = row_max - 1
end
# row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
self.oy = row * 52
end
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = self.width / @column_max - 32
# 计算光标坐标
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 52 - self.oy
# 更新国标矩形
self.cursor_rect.set(x, y, cursor_width, 52)
end
#-----------------------
def update
super
# 可以移动光标的情况下
if self.active and @item_max > 0 and @index >= 0
# 方向键下被按下的情况下
# R 键被按下的情况下
if Input.repeat?(Input::R)
# 显示的最后行在数据中最后行上方的情况下
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# 光标向后移动一页
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# L 键被按下的情况下
if Input.repeat?(Input::L)
# 显示的开头行在位置 0 之后的情况下
if self.top_row > 0
# 光标向前移动一页
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
end
复制代码
#==============================================================================
# ■ Scene_Battle (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始角色命令回合
#--------------------------------------------------------------------------
def start_phase3
# 转移到回合 3
@phase = 3
# 设置觉得为非选择状态
@actor_index = -1
@active_battler = nil
# 输入下一个角色的命令
phase3_next_actor
end
#--------------------------------------------------------------------------
# ● 转到输入下一个角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最后的角色的情况
if @actor_index == $game_party.actors.size-1
# 开始主回合
start_phase4
return
end
# 推进角色索引
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 转向前一个角色的命令输入
#--------------------------------------------------------------------------
def phase3_prior_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初的角色的情况下
if @actor_index == 0
# 开始同伴指令回合
start_phase2
return
end
# 返回角色索引
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
$game_party.gain_weapon(@active_battler.current_action.item_id[1], 1) if @active_battler.current_action.item_id[0] == false
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 设置角色指令窗口
#--------------------------------------------------------------------------
def phase3_setup_command_window
#......................................................................
@status_window.in_atk(@actor_index)
Audio.se_play("Audio/SE/点击")#, se.volume, se.pitch)
#......................................................................
# 同伴指令窗口无效化
@party_command_window.active = false
@party_command_window.visible = false
# 角色指令窗口无效化
@actor_command_window.active = true
@actor_command_window.visible = true
# 设置角色指令窗口的位置
@actor_command_window.x = @actor_index * 160
# 设置索引为 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合)
#--------------------------------------------------------------------------
def update_phase3
# 敌人光标有效的情况下
if @enemy_arrow != nil
update_phase3_enemy_select
# 角色光标有效的情况下
elsif @actor_arrow != nil
update_phase3_actor_select
# 特技窗口有效的情况下
elsif @skill_window != nil
update_phase3_skill_select
# 物品窗口有效的情况下
elsif @item_window != nil
update_phase3_item_select
#........................................................................
# 杂项窗口有效的情况下
elsif @bmenu != nil and @bmenu.active
update_phase3_bmenu
# 投掷窗口有效的情况下
elsif @item_throw_window != nil
update_phase3_throw_select
elsif @battler_status != nil
update_phase3_battler_status
#........................................................................
# 角色指令窗口有效的情况下
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 转向前一个角色的指令输入
end_atk(@active_battler.index)
phase3_prior_actor
return
end
# 按下 C 键的情况下
#......................................................................
if Input.trigger?(Input::C) or @mousetrigger == 1
@mousetrigger = 0
#......................................................................
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0 # 攻击
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# 开始选择敌人
start_enemy_select
when 1 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 1
# 开始选择特技
start_skill_select
when 2 # 防御
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 转向下一位角色的指令输入
end_atk(@active_battler.index)
phase3_next_actor
when 3 # 杂项菜单
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 2
# 开始选择物品
start_item_select
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择特技)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# 设置特技窗口为可视状态
@skill_window.windowskin = RPG::Cache.windowskin("skin2")
@skill_window.visible = true
@actor_command_window.active = false
@actor_command_window.visible = false
#mayi
# 刷新特技窗口
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 结束特技选择
end_skill_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技选择窗口现在选择的特技的数据
@skill = @skill_window.skill
# 无法使用的情况下
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.skill_id = @skill.id
# 设置特技窗口为不可见状态
@skill_window.visible = false
# 效果范围是敌单体的情况下
if @skill.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @skill.scope == 3 or @skill.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 选择特技结束
end_skill_select
# 转到下一位角色的指令输入
end_atk(@active_battler.index)
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择物品)
#--------------------------------------------------------------------------
def update_phase3_item_select
# 设置物品窗口为可视状态
@item_window.windowskin = RPG::Cache.windowskin("skin2")
@item_window.visible = true
@actor_command_window.active = false
@actor_command_window.visible = false
#mayi
#........................................................................
# 刷新物品窗口
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择物品结束
end_item_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的物品资料
@item = @item_window.item
# 无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.item_id = @item.id
# 设置物品窗口为不可见状态
@item_window.visible = false
#........................................................................
#........................................................................
# 效果范围是敌单体的情况下
if @item.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @item.scope == 3 or @item.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
@item_select_end = 1
# 物品选择结束
end_item_select
# 转到下一位角色的指令输入
end_atk(@active_battler.index)
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面画面 (角色命令回合 : 选择敌人)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# 刷新敌人箭头
@enemy_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
#......................................................................
$game_party.gain_weapon(@item_throw_window.item.id, 1) if @item_throw_window != nil and @item_throw_window.item.is_a?(RPG::Weapon)
#......................................................................
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择敌人结束
end_enemy_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @enemy_arrow.index
# 选择敌人结束
end_enemy_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
#......................................................................
@item_select_end = 1
#......................................................................
# 结束物品选择
end_item_select
end
#......................................................................
if @item_throw_window != nil
@throw_select_end = 1
# 结束投掷选择
end_throw_select
end
#......................................................................
# 转到下一位角色的指令输入
end_atk(@active_battler.index)
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (角色指令回合 : 选择角色)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# 刷新角色箭头
@actor_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择角色结束
end_actor_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @actor_arrow.index
# 选择角色结束
end_actor_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
@item_select_end = 1
# 结束物品选择
end_item_select
end
#......................................................................
if @item_throw_window != nil
@throw_select_end = 1
# 结束投掷选择
end_throw_select
end
#......................................................................
# 转到下一位角色的指令输入
end_atk(@active_battler.index)
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 开始选择敌人
#--------------------------------------------------------------------------
def start_enemy_select
# 生成敌人箭头
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
# 关联帮助窗口
@enemy_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
#........................................................................
#@actor_command_window.visible = false
#........................................................................
end
#--------------------------------------------------------------------------
# ● 结束选择敌人
#--------------------------------------------------------------------------
def end_enemy_select
# 释放敌人箭头
@enemy_arrow.dispose
@enemy_arrow = nil
# 指令为 [战斗] 的情况下
if @actor_command_window.index == 0
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
# 隐藏帮助窗口
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● 开始选择角色
#--------------------------------------------------------------------------
def start_actor_select
# 生成角色箭头
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
# 关联帮助窗口
@actor_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
#........................................................................
#@actor_command_window.visible = false
#........................................................................
end
#--------------------------------------------------------------------------
# ● 结束选择角色
#--------------------------------------------------------------------------
def end_actor_select
# 释放角色箭头
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# ● 开始选择特技
#--------------------------------------------------------------------------
def start_skill_select
# 生成特技窗口
@skill_window = Window_Skill_New.new(@active_battler)
@skill_window.windowskin = RPG::Cache.windowskin("skin2")
@skill_window.z = 9999
@skill_window.x = 0
@skill_window.y = 64
@skill_window.height = 188
# 关联帮助窗口
@skill_window.help_window = @help_window
# 无效化角色指令窗口
$fff = 0
@actor_command_window.active = false
@actor_command_window.visible = false
# @actor_command_window.update
end
#--------------------------------------------------------------------------
# ● 选择特技结束
#--------------------------------------------------------------------------
def end_skill_select
# 释放特技窗口
@skill_window.dispose
@skill_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 开始选择物品
#--------------------------------------------------------------------------
def start_item_select
# 生成物品窗口
#print "开始选择物品"
# $xuanzewupin = true
@item_window = Window_Item_New.new
@item_window.windowskin = RPG::Cache.windowskin("../system/battle/windowskins/palskin")
# 关联帮助窗口
@item_window.help_window = @help_window
# 无效化角色指令窗口
$fff = 0
@actor_command_window.active = false
@actor_command_window.visible = false
# @actor_command_window.update
end
#--------------------------------------------------------------------------
# ● 结束选择物品
#--------------------------------------------------------------------------
def end_item_select
# 释放物品窗口
@item_window.dispose
@item_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# @help_window1.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
复制代码
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
zhli667
时间:
2009-6-9 04:11
谁帮帮忙吖{/dk}{/dk}{/dk}
作者:
enghao_lim
时间:
2009-6-9 04:29
本想把这帖当作我主号回归解决的第一帖,可惜,两个脚本追加太多定义,放在默认脚本里马上出错,根本看不到问题在哪。可以的话楼主请放出工程。
作者:
zhli667
时间:
2009-6-9 04:36
这是工程
ftp://zh99998.vicp.net/others/Scripts.rar
不过那两个脚本还是按上面的脚本
{/wx}
作者:
enghao_lim
时间:
2009-6-9 04:57
以下引用
zhli667于2009-6-8 20:36:51
的发言:
这是工程
ftp://zh99998.vicp.net/others/Scripts.rar
不过那两个脚本还是按上面的脚本
我这里ftp 300kb要下个几小时。--b
作者:
3535
时间:
2009-6-9 08:35
x = 4 + index % 4 * (128 + 32)
y = index / 4 * 32 [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1