赞 | 0 |
VIP | 10 |
好人卡 | 0 |
积分 | 0 |
经验 | 2874 |
最后登录 | 2012-1-7 |
在线时间 | 80 小时 |
Lv1.梦旅人 Mist
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 80 小时
- 注册时间
- 2010-9-16
- 帖子
- 283
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 嵐。 于 2010-9-20 09:56 编辑
当同时使用这2个脚本的时候发现,技能物品显示窗口会被技能栏盖过。请教下前辈们 ,有什么办法可以修正下这个问题呢?
●原效果图片:
●问题图片:(红圈处)
●技能消耗物品脚本地址:http://rpg.blue/thread-141775-1-1.html
●增强开发包脚本:●Skill Need Item脚本:- #===============================================================================
- # ■ FSL 技能消耗物品
- # FSL Skill Need Item
- #-------------------------------------------------------------------------------
- # 设定一些值,当拥有制定物品的制定个数及以上时才可发动特技。发动特技会
- # 消耗掉这些物品。
- #
- # 在技能的“注释”中如下书写(请确保使用的是西文半角而不是全角):
- # <need_item 物品id,对应数量 物品id,对应数量 …… >
- # <need_item 1,1 2,2 3,3>
- #
- #-------------------------------------------------------------------------------
- # 更新作者: DeathKing 六祈
- # 许可协议: FSL -NOS ADK
- # 项目分类: VX \ 数据工程
- # 衍生关系:
- # 项目版本: 1.5.0726
- # 建立日期: 2010年05月29日
- # 最后更新: 2010年07月26日
- # 引用网址:
- #-------------------------------------------------------------------------------
- # - 1.5.0726 (By DeathKing)
- # * 修正了按下PageDown和PageUp后无法切换角色的小BUG;
- #
- # - 1.4.0725 (By 六祈)
- # * 修正了Game_Actor.skill_can_use?方法的错误;
- # * 修正了Window_SNItem.skill_can_use?方法的错误;
- # * 添加了对技能是否可使用的重新判定;
- #
- # - 1.3.0719 (By DeathKing)
- # * ADK的升级,可兼容沉影不器的读取装备注释脚本;
- #
- # - 1.2.0714 (By DeathKing)
- # * 修改了消耗物品的算法;
- #
- # - 1.1.0607 (By DeathKing)
- # * 改变了设置方法;
- #
- # - 1.0.0529 (By DeathKing)
- # * 初始版本完成;
- #
- #===============================================================================
- #-------------------------------------------------------------------------------
- # ▼ 登记FSL
- #-------------------------------------------------------------------------------
- $fscript = {} if $fscript == nil
- $fscript["SkillNeedItem"] = "1.5.0726"
- #-------------------------------------------------------------------------------
- # ▼ 通用配置模块
- #-------------------------------------------------------------------------------
- module FSL
- module Conf
- module SNItem
-
- # 改进后的技能消耗物品可以对物品是否足够做出判断了,不过我我们依然
- # 不能让他很清楚的现实在物品提示中
-
- # (用于提示所需物品数量的)窗口的相关配置,一般不修改
- WINDOW_X = 272 # X 544 / 2
- WINDOW_Y = 112 # Y 56 * 2
- WINDOW_W = 274 # 宽
- WINDOW_H = 640 # 高
- BACK_OPACITY = 200 # 透明度,255为不透明
-
-
- TEXT_NEED = "需要:" # “需要:”一词的字符
- TEXT_NEED_X = WINDOW_X - 104 # “需要:”字符的 X 坐标
- TEXT_ITEM_NUM_X = WINDOW_X - 52 # 物品数量的 X 坐标
-
- end
- end
- end
- #==============================================================================
- # ■ Window_SNItem
- #------------------------------------------------------------------------------
- # 需要的物品的窗口。
- #==============================================================================
- class Window_SNItem < Window_Base
-
- include FSL::Conf::SNItem
-
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- # width : 窗口宽度
- # height : 窗口高度
- #--------------------------------------------------------------------------
- def initialize(x=WINDOW_X, y=WINDOW_Y, width=WINDOW_W, height=WINDOW_H)
- super(x, y, width, height)
- self.back_opacity = BACK_OPACITY
- self.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 判定技能可否使用(需要的物品是否满足)
- # skill : 技能
- #--------------------------------------------------------------------------
- #在Game_Actor#skill_can_use?方法中调用时可传递self.index给第二个参数
- def self.skill_can_use?(skill,actor_id)
- # 如果传递过来的skill为空
- return false if skill == nil
- # 读取need_item项的参数
- need_item = skill.read_notes["need_item"]
- # need_item参数为空的话返回true
- return true if need_item == nil
- # 重新生成参数列表
- need_item_clone = []
- need_item.each do |e|
- need_item_clone << [ e.split(",")[0].to_i , e.split(",")[1].to_i ]
- end
- need_item = need_item_clone
- # 产生一个队伍物品的哈希克隆(item_id => number)
- party_items = Hash.new{0}
- $game_party.items.each do |it|
- party_items[it.id] = $game_party.item_number(it)
- end
- # 如果是第一个行动的角色或者不在战斗中则跳过
- unless actor_id == 0 or $game_temp.in_battle == false
- # 计算到前一个角色技能消耗为止的剩余物品数量哈希
- 0.upto(actor_id-1) do |ai|
- action = $game_party.members[ai].action
- next if action.kind != 1
- temp_cost = $data_skills[action.skill_id].read_notes["need_item"]
- next if temp_cost == nil
- temp_cost = temp_cost.collect{|e|[e.split(",")[0].to_i,e.split(",")[1].to_i]}
- temp_cost.each do |e|
- party_items[e[0]] -= e[1]
- end
- end
- end
- # 判定剩余物品是否足够使用技能
- need_item.each do |e|
- return false if (party_items[e[0]] < e[1])
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 刷新窗口
- # skill : 技能
- # index : 技能在技能窗口的索引,用来判定本
- # 窗口应该显示在左边还是右边
- #--------------------------------------------------------------------------
- def refresh( skill, index = 0)
- # 清除之前产生的位图
- self.contents.clear
- # 如果skill为空就返回false
- return false if skill == nil
- # 先让需要窗口不可见
- self.visible = false
- # 读取参数
- need_item = skill.read_notes["need_item"]
- # 如果参数不是个数组就将需要窗口隐藏并返回false
- return false unless need_item.is_a? Array
- # 重新生成参数列表
- need_item_clone = []
- need_item.each do |e|
- need_item_clone << [ e.split(",")[0].to_i , e.split(",")[1].to_i ]
- end
- need_item = need_item_clone
- # 如果参数列表为空就返回
- return false unless need_item.size >= 1
- # 判定索引以决定窗口位置
- self.x = index % 2 == 0 ? WINDOW_X : 0
- # 改变窗口大小
- self.height = need_item.size * 24 + 32
- # 将窗口置为可见
- self.visible = true
- create_contents
- # 遍历参数列表
- need_item.each_index do |i|
- # 生成物品id
- item_id = need_item[i][0]
- # 生成物品数量
- item_num = need_item[i][1]
- # 生成物品
- item = $data_items[item_id]
- # 判定物品是否足够
- enabled = $game_party.item_number(item) >= item_num ? true : false
- # 绘制文字
- draw_item_name(item, 0, WLH * i, enabled)
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(TEXT_NEED_X, WLH * i, 96, WLH, TEXT_NEED) #
- self.contents.draw_text(TEXT_ITEM_NUM_X, WLH * i, 32, WLH, item_num) #
- end # need_item.each_index
- end
- #--------------------------------------------------------------------------
- # ● 执行对物品消耗
- # skill : 技能
- #--------------------------------------------------------------------------
- def self.exec_cost( skill )
- # 传递错误就直接返回false
- return false if skill == nil
- # 读取need_item项的参数
- need_item = skill.read_notes["need_item"]
- # 如果参数不是个数组就将需要窗口隐藏并返回false
- return true unless need_item.is_a? Array
- need_item.each do |e|
- id = e.split(",")[0].to_i
- num = e.split(",")[1].to_i
- $game_party.gain_item($data_items[id], -num)
- end
- end
-
- end # Window_SNItem
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
- # Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor
-
- alias snitem_skill_can_use? skill_can_use?
-
- #--------------------------------------------------------------------------
- # ● 可用技能判断
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return false unless Window_SNItem.skill_can_use?(skill, self.index)
- snitem_skill_can_use?(skill)
- end
- end
- #==============================================================================
- # ■ Scene_Skill
- #------------------------------------------------------------------------------
- # 处理特技画面的类。
- #==============================================================================
- class Scene_Skill < Scene_Base
- alias snitem_initialize initialize
- alias snitem_terminate terminate
- alias snitem_update update
- alias snitem_use_skill_nontarget use_skill_nontarget
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色位置
- #--------------------------------------------------------------------------
- def initialize( actor_index = 0, equip_index = 0 )
- snitem_initialize( actor_index, equip_index )
- @snitem_window = Window_SNItem.new
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- snitem_terminate
- @snitem_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- snitem_update
- @snitem_window.refresh( @skill_window.skill, @skill_window.index )
- end
-
- #--------------------------------------------------------------------------
- # ● 非同伴目标使用物品
- #--------------------------------------------------------------------------
- def use_skill_nontarget
- # 执行对物品的消耗
- Window_SNItem.exec_cost(@skill)
- # 调用原方法
- snitem_use_skill_nontarget
- end
-
- end # Scene_Skill
- #==============================================================================
- # ■ Scene_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的类。
- #=============================================================================
- class Scene_Battle < Scene_Base
-
- include FSL::Conf::SNItem
-
- alias snitem_update_skill_selection update_skill_selection
- alias snitem_start_skill_selection start_skill_selection
- alias snitem_end_skill_selection end_skill_selection
- alias snitem_execute_action_skill execute_action_skill
-
- #--------------------------------------------------------------------------
- # ● 开始技能选择
- #--------------------------------------------------------------------------
- def start_skill_selection
- snitem_start_skill_selection
- # 创建需要道具窗口,并把y坐标上移
- @snitem_window = Window_SNItem.new(270,56)
- end
- #--------------------------------------------------------------------------
- # ● 结束技能选择
- #--------------------------------------------------------------------------
- def end_skill_selection
- if @skill_window != nil
- @snitem_window.dispose
- @snitem_window = nil
- end
- snitem_end_skill_selection
- end
- #--------------------------------------------------------------------------
- # ● 更新技能选择
- #--------------------------------------------------------------------------
- def update_skill_selection
- # 刷新技能
- @snitem_window.refresh( @skill_window.skill, @skill_window.index )
- # 调用原方法内容
- snitem_update_skill_selection
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动:使用技能
- #--------------------------------------------------------------------------
- def execute_action_skill
- # 执行原内容
- snitem_execute_action_skill
- # 生成skill
- skill = @active_battler.action.skill
- Window_SNItem.exec_cost( skill )
- end
-
- end # Scene_Battle
复制代码 ●地图作为战斗背景脚本:- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的活动块的类。本类在 Scene_Battle 类
- # 的内部使用。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- create_viewports
- create_battleback
- create_battlefloor
- create_enemies
- create_actors
- create_pictures
- create_timer
- update
- end
- #--------------------------------------------------------------------------
- # ● 生成视口
- #--------------------------------------------------------------------------
- def create_viewports
- @viewport1 = Viewport.new(0, 0, 544, 416)
- @viewport2 = Viewport.new(0, 0, 544, 416)
- @viewport3 = Viewport.new(0, 0, 544, 416)
- @viewport2.z = 50
- @viewport3.z = 100
- end
- #--------------------------------------------------------------------------
- # ● 生成战斗背景位图
- #--------------------------------------------------------------------------
- def create_battleback
- # source = $game_temp.background_bitmap
- # bitmap = Bitmap.new(640, 480)
- # bitmap.stretch_blt(bitmap.rect, source, source.rect)
- # bitmap.radial_blur(90, 12)
- # @battleback_sprite = Sprite.new(@viewport1)
- # @battleback_sprite.bitmap = bitmap
- # @battleback_sprite.ox = 320
- # @battleback_sprite.oy = 240
- # @battleback_sprite.x = 272
- # @battleback_sprite.y = 176
- # @battleback_sprite.wave_amp = 8
- # @battleback_sprite.wave_length = 240
- # @battleback_sprite.wave_speed = 120
- end
- #--------------------------------------------------------------------------
- # ● 生成战斗场所活动块
- #--------------------------------------------------------------------------
- def create_battlefloor
- @battlefloor_sprite = Sprite.new(@viewport1)
- @battlefloor_sprite.bitmap = Cache.system("BattleFloor")
- @battlefloor_sprite.x = 0
- @battlefloor_sprite.y = 192
- @battlefloor_sprite.z = 1
- @battlefloor_sprite.opacity = 128
- end
- #--------------------------------------------------------------------------
- # ● 生成敌人活动块
- #--------------------------------------------------------------------------
- def create_enemies
- @enemy_sprites = []
- for enemy in $game_troop.members.reverse
- @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成角色活动块
- # 默认不显示角色图形,不过,为了方便、己方生成与敌人同样的精灵。
- #--------------------------------------------------------------------------
- def create_actors
- @actor_sprites = []
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- end
- #--------------------------------------------------------------------------
- # ● 生成图片活动块
- #--------------------------------------------------------------------------
- def create_pictures
- @picture_sprites = []
- for i in 1..20
- @picture_sprites.push(Sprite_Picture.new(@viewport2,
- $game_troop.screen.pictures[i]))
- end
- end
- #-------------------------------------------------------------------------- #--------------------------------------------------------------------------
- # ● 生成计时器活动块
- #--------------------------------------------------------------------------
- def create_timer
- @timer_sprite = Sprite_Timer.new(@viewport2)
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- dispose_battleback_bitmap
- dispose_battleback
- dispose_battlefloor
- dispose_enemies
- dispose_actors
- dispose_pictures
- dispose_timer
- dispose_viewports
- end
- #--------------------------------------------------------------------------
- # ● 战斗背景位图释放
- #--------------------------------------------------------------------------
- def dispose_battleback_bitmap
- #@battleback_sprite.bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● 战斗背景活动块释放
- #--------------------------------------------------------------------------
- def dispose_battleback
- #@battleback_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 战斗场所活动块释放
- #--------------------------------------------------------------------------
- def dispose_battlefloor
- @battlefloor_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 敌人活动块释放
- #--------------------------------------------------------------------------
- def dispose_enemies
- for sprite in @enemy_sprites
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 角色活动块释放
- #--------------------------------------------------------------------------
- def dispose_actors
- for sprite in @actor_sprites
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 图片活动块释放
- #--------------------------------------------------------------------------
- def dispose_pictures
- for sprite in @picture_sprites
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 计时器活动块释放
- #--------------------------------------------------------------------------
- def dispose_timer
- @timer_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 视口释放
- #--------------------------------------------------------------------------
- def dispose_viewports
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- update_battleback
- update_battlefloor
- update_enemies
- update_actors
- update_pictures
- update_timer
- update_viewports
- end
- #--------------------------------------------------------------------------
- # ● 刷新战斗背景活动块
- #--------------------------------------------------------------------------
- def update_battleback
- # @battleback_sprite.update
- end
- #--------------------------------------------------------------------------
- # ● 刷新战斗场所活动块
- #--------------------------------------------------------------------------
- def update_battlefloor
- @battlefloor_sprite.update
- end
- #--------------------------------------------------------------------------
- # ● 刷新敌人活动块
- #--------------------------------------------------------------------------
- def update_enemies
- for sprite in @enemy_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新角色活动块
- #--------------------------------------------------------------------------
- def update_actors
- @actor_sprites[0].battler = $game_party.members[0]
- @actor_sprites[1].battler = $game_party.members[1]
- @actor_sprites[2].battler = $game_party.members[2]
- @actor_sprites[3].battler = $game_party.members[3]
- for sprite in @actor_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新图片活动块
- #--------------------------------------------------------------------------
- def update_pictures
- for sprite in @picture_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新计时器活动块
- #--------------------------------------------------------------------------
- def update_timer
- @timer_sprite.update
- end
- #--------------------------------------------------------------------------
- # ● 刷新视口
- #--------------------------------------------------------------------------
- def update_viewports
- @viewport1.tone = $game_troop.screen.tone
- @viewport1.ox = $game_troop.screen.shake
- @viewport2.color = $game_troop.screen.flash_color
- @viewport3.color.set(0, 0, 0, 255 - $game_troop.screen.brightness)
- @viewport1.update
- @viewport2.update
- @viewport3.update
- end
- #--------------------------------------------------------------------------
- # ● 动画显示中判定
- #--------------------------------------------------------------------------
- def animation?
- for sprite in @enemy_sprites + @actor_sprites
- return true if sprite.animation?
- end
- return false
- end
- end
复制代码- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- $game_temp.in_battle = true
- @spriteset = Spriteset_Battle.new
- @message_window = Window_BattleMessage.new
- @action_battlers = []
- create_info_viewport
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- dispose_info_viewport
- @message_window.dispose
- @spriteset.dispose
- unless $scene.is_a?(Scene_Gameover)
- $scene = nil if $BTEST
- end
- end
- end
复制代码 |
|