赞 | 0 |
VIP | 0 |
好人卡 | 14 |
积分 | 1 |
经验 | 11195 |
最后登录 | 2017-6-7 |
在线时间 | 543 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 543 小时
- 注册时间
- 2009-7-13
- 帖子
- 63
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 nanaka 于 2011-9-1 12:02 编辑
原贴在这里
http://rpg.blue/thread-89885-1-1.html
前段时间做游戏刚好用到了,结果发现这个脚本有很多不足的地方,用自己半吊子的水平改了一下。
另外为了美观用了一箭烂大的图片数字脚本
http://rpg.blue/thread-174115-1-1.html
比原版增加的功能有:
可以设定敌人射程
可以添加物品的掉落
可以自定义基础攻击间隔和技能攻击间隔
可以自定义玩家和敌人的闪避(目前敌人的闪避是统一的,有空再改)
可以用开关控制HP槽和MP槽的显示(这个应该算bug修改?)
可以使用回复技能(这个貌似也应该算bug修改)
一些比较没用的功能:
美观化了攻击无效、miss、critical、以及伤害的显示
普通攻击和技能攻击的伤害值波动
伤害数字的可以同时显示多个(原来一个单位只能同时存在一个伤害数字)
Critical标志可以同时显示多个 (原来同上)
删掉了原版里动画缩小的功能,那个功能会影响平时在地图上的动画播放,感觉很不好。
如果战斗动画过大的话,请自己改小了再用吧……
测试不是太完全,如果有BUG请联系我。
另外还有什么想法也可以告诉我,我尽力实现。
第一次发脚本,希望能帮诸位作出更好的游戏。
补图……
代码如下- #===================================
- # Vlad ABS
- #===================================
- #--------------------------------------------------------------
- # Credits to Vlad
- #--------------------------------------------------------------
- # 創造一個敵人(事件),在事件中加上這些註釋:
- # Enemy ID - 在數據庫中敵人的ID
- # Die X - X為 1 / 2 ( 1:死後删除敵人 2:不死之身 )
- # Follow - 設定是否跟隨敵人
- # Range - 设定敌人射程
- # Drop - 掉落物品ID
- # Drop_Rate 掉率
- # 暂时只支持掉落一件物品
- #--------------------------------------------------------------
- # 自定義項目
- #--------------------------------------------------------------
- #-------------------------------------------------------------
- # ARPG系统开关控制编号
- # 打开时显示血槽,关闭时去掉血槽
- Switch_Number = 95
- #--------------------------------------------------------------
- # 武器攻撃鍵, 不要改變 [正常對應鍵: A]
- Attack_Button = Input::X
- #--------------------------------------------------------------
- # 技能攻撃鍵, 不要改變 [正常對應鍵: S] <--也是技能畫面的技能記憶鍵
- Skill_Button = {Input::Y => 0}
- #--------------------------------------------------------------
- # 升級動畫ID (對應數據庫) :
- LevelUp_Ani = 40
- #---------------------------------------------------------------
- # 技能冷却间隔
- Skill_Wait_Ataque = 60
- # 主角攻击距离
- Attack_Range = 3
- # 主角攻击暴击率
- Player_Critical_Rate = 20
- # 敌人攻击暴击率
- Enemy_Critical_Rate = 5
- # 玩家自身闪避率
- Player_Evade_Rate = 15
- # 敌人自身闪避率
- Enemy_Evade_Rate = 5
- # 攻击伤害波动率
- Attack_Damage_Wave = 10
- # 玩家伤害倍率
- Player_Damage_Rate = 4
- # 敌人伤害倍率
- Enemy_Damage_Rate = 4
- #--------------------------------------------------------------
- # 攻击间隔的计算公式是 (基础攻击间隔 - 敏捷) / 60 单位;秒
- #---------------------------------------------------------------
- # 玩家基础攻击间隔
- Player_Base_Attack_Speed = 60
- # 敌人基础攻击间隔
- Enemy_Base_Attack_speed = 100
- #--------------------------------------------------------------
- #设定敌人的攻击动画
- #例如:Enemy_atk_ani[1] = 10
- #即ID为1的敌人使用ID为10的攻击动画
- Enemy_atk_ani = {}
- #--------------------------------------------------------------
- #--------------------------------------------------------------
- # Game Character
- #--------------------------------------------------------------
- class Game_Character
- attr_accessor :hp
- attr_accessor :mp
- attr_accessor :damage
- attr_accessor :critical
- attr_accessor :wait_ataque
- attr_accessor :skill_wait_ataque
- attr_accessor :die
- attr_accessor :drop_item
- attr_accessor :drop_flag
- attr_accessor :drop_rate
- alias vlad_abs_gchar_initialize initialize
- def initialize
- @hp = 0
- @mp = 0
- @die = 0
- $skill_for_use = 0
- @wait_ataque = 0
- @skill_wait_ataque = 0
- @range = 0
- @drop_item = 0
- @damage = nil
- @critical = false
- @death_flag = false
- vlad_abs_gchar_initialize
- end
- #------------------------------------------------------------------------------------
- # recebe_atk
- #
- # 用来处理攻击
- # receptor为攻击受体,即函数调用者
- # attacker为攻击方,即函数参数
- #------------------------------------------------------------------------------------
- def recebe_atk(attacker)
-
- #读入攻击方和被攻击方的属性
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
-
- # 普通攻击取10%的伤害波动
- random_num = (attacker_status.atk / Attack_Damage_Wave).to_i
- # 获取本次攻击的伤害偏差
- random_damage = rand(random_num)
- # 获取偏差正负
- coe = (-1) ** (rand(2)+1)
-
- if self.is_a?(Game_Event)
- self.damage = attacker_status.atk * Player_Damage_Rate - receptor_status.def * 2 + coe * random_damage
- else
- self.damage = attacker_status.atk * Enemy_Damage_Rate - receptor_status.def * 2 + coe * random_damage
- end
-
- self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
- self.damage /= 100
- self.damage = 0 if self.damage < 0
-
- if self.is_a?(Game_Player)
- self.critical = (rand(100) < Player_Critical_Rate) # 玩家暴击判定
- else
- self.critical = (rand(100) < Enemy_Critical_Rate) # 敌人暴击判定
- end
-
- self.damage *= 2 if self.critical # 暴击时造成2倍伤害
-
- if self.is_a?(Game_Player)
- self.damage = 0 if rand(100) < Player_Evade_Rate # 玩家闪避判定
- $game_actors[1].hp -= self.damage
- if $game_actors[1].hp <= 0
- $scene = Scene_Gameover.new
- end
- elsif self.is_a?(Game_Event)
- self.damage = 0 if rand(100) < Enemy_Evade_Rate # 敌人闪避判定
- self.hp -= self.damage
- if self.hp <= 0
- self.animation_id = 88
- if @drop_item != 0 && (rand(100) < @drop_rate)
- gain_item(self)
- end
- $game_actors[1].gain_exp(enemy_status.exp, 1)
- if @die == 1
- self.erase
- elsif @die == 2
- key = [$game_map.map_id, self.id, "A"]
- $game_self_switches[key] = true
- end
- refresh
- end
- end
- end
-
- def gain_item (event)
- $game_party.gain_item($data_items[@drop_item], 1)
- event.drop_flag = true
- end
- #-----------------------------------------------------------------------------
- # recebe_skl
- #
- # 用来处理技能
- # receptor为攻击受体,即函数调用者
- # attacker为攻击方,即函数参数
- #-----------------------------------------------------------------------------
- def recebe_skl(attacker)
- for key in Skill_Button.keys
-
- #获取技能id
- sklid = Skill_Button[key]
-
- #读入攻击方和被攻击方属性
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
-
- skill = $data_skills[sklid]
- random_num = (skill.base_damage * skill.variance / 100) #计算分散度造成的伤害偏差
- random_damage = rand(random_num) #获取本次技能的伤害偏差
- coe = (-1) ** (rand(2) + 1) #获取偏差正负
-
- #如果技能伤害为正数,即该技能为伤害技能时
- if skill.base_damage > 0
-
- #------------------------------------------------------------#
- # 计算技能伤害,按照rmvx公式 #
- # 伤害值 = 基本伤害 #
- # + (A 攻击力 × 4 × 攻击关系度 ÷ 100) #
- # + (A 意志力 × 2 × 意志关系度 ÷ 100) #
- # - (B 防御力 × 2 × 攻击关系度 ÷ 100) #
- # - (B 意志力 × 1 × 意志关系度 ÷ 100) #
- #------------------------------------------------------------#
-
- #技能造成伤害的计算
- skill_damage = skill.base_damage
- + (attacker_status.atk * 4 * skill.atk_f / 100)
- + (attacker_status.spi * 2 * skill.spi_f / 100)
-
- #防御方减少伤害的计算
- reduce_damage = (receptor_status.def * 2 * skill.atk_f / 100)
- + (receptor_status.spi * skill.spi_f / 100)
-
- #伤害处理
- self.damage = skill_damage - reduce_damage + coe * random_damage
- self.damage *= attacker_status.elements_max_rate(attacker_status.element_set)
- self.damage /= 100
- self.damage = 0 if self.damage < 0
- self.critical = (rand(100) < 4) #默认暴击率4%
- self.damage *= 2 if self.critical #暴击时造成2倍伤害
-
- #如果该技能伤害为负数,即该技能为回复技能时
- else
- #------------------------------------------------------------#
- # 计算技能伤害,按照rmvx公式 #
- # 伤害值 = 基本伤害 #
- # - (A 防御力 × 2 × 攻击关系度 ÷ 100) #
- # - (A 意志力 × 1 × 意志关系度 ÷ 100) #
- #------------------------------------------------------------#
- skill_damage = skill.base_damage
- - (attacker_status.atk * 2 * skill.atk_f / 100)
- - (attacker_status.spi * 1 * skill.spi_f / 100)
-
- #伤害处理
- self.damage = skill_damage
- end
-
- #处理施法后的消耗以及死亡判断
- attacker_status.mp -= $data_skills[sklid].mp_cost
- if self.is_a?(Game_Player)
- $game_actors[1].hp -= self.damage
- $scene = Scene_Gameover.new if $game_actors[1].hp <= 0
- elsif self.is_a?(Game_Event)
- self.hp -= self.damage
- if self.hp <= 0
- $game_actors[1].gain_exp(enemy_status.exp, 1)
- if @die == 1 #如果该单位非不死,擦除
- self.erase
- elsif @die == 2 #如果该单位不死,复活该单位
- key = [$game_map.map_id, self.id, "A"]
- $game_self_switches[key] = true
- end
- refresh
- end
- end
- end
- end
-
- def follow_hero(dx, dy)
- sx = @x - dx
- sy = @y - dy
-
- if sx == 0 and sy == 0
- return
- end
-
- abs_sx = sx.abs
- abs_sy = sy.abs
- if abs_sx == 0
- sy > 0 ? move_up : move_down
- if not moving? and sx != 0
- sx > 0 ? move_left : move_right
- end
- return
- elsif abs_sy == 0
- sx > 0 ? move_left : move_right
- if not moving? and sy != 0
- sy > 0 ? move_up : move_down
- end
- return
- end
-
- if abs_sx == abs_sy
- rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
- end
-
- if abs_sx > abs_sy
- sx > 0 ? move_left : move_right
- if not moving? and sy != 0
- sy > 0 ? move_up : move_down
- end
- else
- sy > 0 ? move_up : move_down
- if not moving? and sx != 0
- sx > 0 ? move_left : move_right
- end
- end
-
- end
- def raio(dx, dy)
- ax = (@x - dx) ** 2
- ay = (@y - dy) ** 2
- return Math.sqrt(ax + ay)
- end
-
- end
- #--------------------------------------------------------------
- # Game Event
- #--------------------------------------------------------------
- class Game_Event < Game_Character
- attr_reader :inimigo
- attr_reader :enemy_status
- attr_reader :range #敌人攻击距离
- alias vlad_abs_gevent_initialize initialize
- alias vlad_abs_gevent_update update
- alias vlad_abs_gevent_refresh refresh
- def initialize(map_id, event)
- @inimigo = false
- @automove = false
- @range = 0
- vlad_abs_gevent_initialize(map_id, event)
- end
- def check_com(comentario)
- return false if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0].downcase.include?(comentario.downcase)
- return true
- end
- end
- end
- end
- def check_comment(comentario)
- com = comentario.downcase
- return 0 if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
- return $1.to_i
- end
- end
- end
- return 0
- end
- def update
- vlad_abs_gevent_update
- if @inimigo
- new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
- new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
- if self.wait_ataque > 0
- self.wait_ataque -= 1
- elsif can_attack?(new_x, new_y, self.range)
- $game_player.recebe_atk(self)
- $game_player.animation_id = self.enemy_atk_animation_id
- $game_player.jump(0,0)
- self.wait_ataque = get_attack_speed(@enemy_status.agi)
- end
- end
- if @automove
- unless moving?
- self.follow_hero($game_player.x, $game_player.y)
- end
- end
- end
-
- #获得敌人的攻击间隔
- def get_attack_speed(agi)
- return Enemy_Base_Attack_speed - agi
- end
- #判断敌人攻击距离内是否有玩家
- def can_attack?(x, y, range = 0)
- for i in 0...range
- new_x = (x + (@direction == 4 ? -i : @direction == 6 ? i : 0))
- new_y = (y + (@direction == 8 ? -i : @direction == 2 ? i : 0))
- if $game_player.x == new_x and $game_player.y == new_y
- return true
- end
- end
- return false
- end
-
- def refresh
- vlad_abs_gevent_refresh
-
- @inimigo = false
- @enemy_id = check_comment("Enemy") #获取敌人ID
- @automove = true if check_com("Follow") == true #获取敌人移动方式
- @die = check_comment("Die") #获取敌人不死属性
- @range = check_comment("Range") #获取敌人攻击距离
- @drop_item = check_comment("Drop") #获取掉落物品
- @drop_rate = check_comment("Drop_rate") #获取物品掉率
- if @enemy_id > 0
- @inimigo = true
- @enemy_status = Game_Enemy.new(@enemy_id, @enemy_id)
- self.hp = @enemy_status.maxhp
- self.mp = @enemy_status.maxmp
- end
-
- end
-
- def enemy_atk_animation_id
- if Enemy_atk_ani[@enemy_id]
- return (@enemy_status.nil? ? 0 : Enemy_atk_ani[@enemy_id])
- else
- return (@enemy_status.nil? ? 0 : 1)
- end
- end
-
- def Enemy_atk_ani
- return Enemy_atk_ani
- end
-
- end
- #--------------------------------------------------------------
- # Game Player
- #--------------------------------------------------------------
- class Game_Player < Game_Character
- alias vlad_abs_gplayer_update update
- alias vlad_abs_gplayer_refresh refresh
- def update
- vlad_abs_gplayer_update
- self.wait_ataque = 0 if self.wait_ataque == nil
- if self.wait_ataque > 0
- self.wait_ataque -= 1
- end
- self.skill_wait_ataque = 0 if self.skill_wait_ataque == nil
- if self.skill_wait_ataque > 0
- self.skill_wait_ataque -= 1
- end
- def refresh
- vlad_abs_gplayer_refresh
- self.hp = $game_actors[1].hp
- self.mp = $game_actors[1].mp
- end
- if Input.trigger?(Attack_Button) and self.wait_ataque <= 0 #test
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if can_attack?(new_x, new_y, event, Attack_Range)
- event.recebe_atk(self)
- event.animation_id = self.player_atk_animation_id
- event.jump(0,0)
- self.wait_ataque = get_attack_speed($game_actors[1].agi)
- break
- end
- end
- end
- end
- for key in Skill_Button.keys
- if Input.trigger?(key) and can_use_skill?(self, Skill_Button[key])
-
- #如果使用的技能是回复技能,则对自己使用
- if $data_skills[Skill_Button[key]].base_damage < 0
- self.recebe_skl(self)
- self.animation_id = self.player_skl_animation_id
- self.skill_wait_ataque = Skill_Wait_Ataque
- #否则查看该伤害技能是否能攻击到敌人
- else
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if can_attack?(new_x, new_y, event, Attack_Range)
- event.recebe_skl(self)
- event.animation_id = self.player_skl_animation_id
- event.jump(0,0)
- self.skill_wait_ataque = Skill_Wait_Ataque
- break
- end
- end
- end
- end
- end
- end
- #判断是否能使用技能
- def can_use_skill?(player, skill_key)
- return false if skill_key == nil
- return false if skill_key == 0
- return false if $game_actors[1].mp < $data_skills[skill_key].mp_cost
- return false if player.skill_wait_ataque > 0
- return true
- end
- #获得玩家的攻击速度
- def get_attack_speed(agi)
- return Player_Base_Attack_Speed - agi
- end
- #判断玩家攻击距离内是否有敌人
- def can_attack?(x, y, event, range = 0)
- for i in 0...range
- next_x = (x + ($game_player.direction == 4 ? -i : $game_player.direction == 6 ? i : 0))
- next_y = (y + ($game_player.direction == 8 ? -i : $game_player.direction == 2 ? i : 0))
- if event.x == next_x and event.y == next_y
- return true
- end
- end
- return false
- end
- def player_atk_animation_id
- return ($game_actors[1].nil? ? 0 : $game_actors[1].atk_animation_id)
- end
- def player_skl_animation_id
- for key in Skill_Button.keys
- sklid = Skill_Button[key]
- return ($game_actors[1].nil? ? 0 : $data_skills[sklid].animation_id)
- end
- end
- def Attack_Button
- return Attack_Button
- end
- def Skill_Button
- return Skill_Button
- end
- end
- end
- #--------------------------------------------------------------
- # Game Actor
- #--------------------------------------------------------------
- class Game_Actor
- alias vlad_abs_change_exp change_exp
-
- def change_exp(exp, show)
- last_level = @level
- last_skills = skills
- @exp = [[exp, 9999999].min, 0].max
- while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
- level_up
- end
- while @exp < @exp_list[@level]
- level_down
- end
- @hp = [@hp, maxhp].min
- @mp = [@mp, maxmp].min
- if show and @level > last_level
- show_level_up
- end
- vlad_abs_change_exp(exp,show)
- end
-
- def show_level_up
- $game_player.animation_id = LevelUp_Ani
- $game_actors[1].hp = $game_actors[1].maxhp
- $game_actors[1].mp = $game_actors[1].maxmp
- end
-
- def LevelUp_Ani
- return LevelUp_Ani
- end
- end
- #--------------------------------------------------------------
- # Sprite Character
- #--------------------------------------------------------------
- class Sprite_Character < Sprite_Base
- alias vlad_abs_spchar_update update
-
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- super(viewport)
- @character = character
- @balloon_duration = 0
- @_damage_sprites = []
- @_damage_durations = []
- @_critical_durations = []
- @_critical_sprites = []
- update
- end
-
- def update
- vlad_abs_spchar_update
- if $game_switches[Switch_Number] == true
- if @character != nil and @character.damage != nil
- process_damage(@character.damage, @character.critical)
- @character.damage = nil
- @character.critical = false
- end
- process_sprites #处理精灵数组
-
- #显示伤害的精灵
- if @_damage_sprites.size > 0
- for i in 0...@_damage_sprites.size
- if @_damage_durations[i] > 0
- @_damage_durations[i] -= 1
- @_damage_sprites[i].x = self.x
- @_damage_sprites[i].y -= 1 if @_damage_durations[i] % 2
- end
- if @_damage_durations[i] <= 0
- @_damage_sprites[i].bitmap.dispose
- @_damage_sprites[i].dispose
- @_damage_durations[i] = nil
- @_damage_sprites[i] = nil
- end
- end
- end
-
- #显示暴击标志的精灵
- if @_critical_sprites.size > 0
- for i in 0...@_critical_sprites.size
- if @_critical_durations[i] > 0
- @_critical_durations[i] -= 1
- @_critical_sprites[i].x = self.x
- @_critical_sprites[i].y -=1 if @_critical_durations[i] % 2
- end
- if @_critical_durations[i] <= 0
- @_critical_sprites[i].bitmap.dispose
- @_critical_sprites[i].dispose
- @_critical_durations[i] = nil
- @_critical_sprites[i] = nil
- end
- end
- end
- #显示获得物品的精灵
- if @_item_sprite != nil
- @_item_duration -= 1
- @_item_sprite.y -= 1 if @_item_duration % 2
- @_item_sprite.x = self.x
- if @_item_duration <= 0
- @_item_sprite.bitmap.dispose
- @_item_sprite.dispose
- @_item_sprite = nil
- end
- end
- if @character.drop_flag
- process_get_item(@character.drop_item)
- @character.drop_flag = false
- end
- end
- end
-
- def process_sprites
- @_damage_durations = @_damage_durations.compact if @_damage_durations != nil
- @_damage_sprites = @_damage_sprites.compact if @_damage_sprites != nil
- @_critical_durations = @_critical_durations.compact if @_critical_durations != nil
- @_critical_sprites = @_critical_sprites.compact if @_critical_sprites != nil
- end
- #--------------------------------------------------------------------------
- # ● 伤害显示
- #--------------------------------------------------------------------------
- def process_damage(value, critical)
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
-
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Georgia"
- bitmap.font.size = 20
- bitmap.font.italic = true
- if value.is_a?(Numeric) and value == 0
- bitmap = Cache.picture("Invalid")
- elsif value.is_a?(Numeric) and value < 0
- bitmap.draw_number(0, 10, value.abs, "B") #一箭烂大的图片数字脚本
- else
- bitmap.draw_number(0, 10, value.abs, "A") #一箭烂大的图片数字脚本
- end
-
- if critical and value > 0
- critical_bitmap = Cache.picture("Critical")
- _critical_sprite = ::Sprite.new(self.viewport)
- _critical_sprite.bitmap = critical_bitmap
- _critical_sprite.ox = 40
- _critical_sprite.oy = 20
- _critical_sprite.x = self.x
- _critical_sprite.y = self.y - self.oy / 2 - 60
- _critical_sprite.z += 99999
- _critical_duration = 30
- @_critical_sprites.push (_critical_sprite)
- @_critical_durations.push (_critical_duration)
- Sound.play_critical
- end
-
- _damage_sprite = ::Sprite.new(self.viewport)
- _damage_sprite.bitmap = bitmap
- _damage_sprite.ox = 10 * get_horizontal(value.abs)
- _damage_sprite.x = self.x
- _damage_sprite.y = self.y - 80
- _damage_sprite.z += 99999
- _damage_duration = 30
- @_damage_sprites.push (_damage_sprite)
- @_damage_durations.push (_damage_duration)
- end
-
- def process_get_item(drop_item)
- if @_item_sprite != nil
- @_item_sprite.bitmap.dispose
- @_item_sprite.dispose
- @_item_sprite = nil
- end
- bitmap = Cache.picture("Drop_Item")
- viewport = Viewport.new(0, 0, 544, 416)
- @_item_sprite = Sprite.new(viewport)
- @_item_sprite.bitmap = bitmap
- @_item_sprite.ox = 60
- @_item_sprite.oy = 20
- @_item_sprite.x = self.x
- @_item_sprite.y = self.y - 100
- @_item_sprite.z += 99999
- @_item_duration = 30
- Sound.play_gain_item
- end
-
- def get_horizontal(value)
- if value == 0
- return 3
- end
- horizontal = 0
- while (value > 0)
- value = (value / 10).truncate
- horizontal += 1
- end
- return horizontal
- end
- end
-
- #--------------------------------------------------------------
- # Window Skill
- #--------------------------------------------------------------
- class Scene_Skill
- alias vlad_abs_sskill_initialize initialize
- alias vlad_abs_sskill_update update
-
- def initialize(actor_index = 0, equip_index = 0)
- @memory = Window_Command.new(150, ["记录S键技能"])
- @memory.active = false
- @memory.visible = false
- @memory.x = (544 - @memory.width) / 2
- @memory.y = (416 - @memory.height) / 2
- @memory.z = 1500
- vlad_abs_sskill_initialize
- end
-
- def update
- update_skill
- @memory.update if @memory.active
- return update_memory if @memory.active
- vlad_abs_sskill_update
- end
-
- def update_skill
- for key in Skill_Button.keys
- if Input.trigger?(key)
- Sound.play_decision
- Skill_Button[key] = @skill_window.skill.id
- @memory.active = @memory.visible = true
- @skill_window.active = false
- end
- end
- end
-
- def update_memory
- if Input.trigger?(Input::C)
- Sound.play_decision
- @memory.active = @memory.visible = false
- @skill_window.active = true
- end
- end
-
- def Skill_Button
- return Skill_Button
- end
-
- end
- #--------------------------------------------------------------
- # FINISH
- #--------------------------------------------------------------
复制代码- #=============================================================================
- # Window Hud
- #=============================================================================
- class Window_Hud < Window_Base
- def initialize
- super(0,0,128,96)
- self.opacity = 0
- self.visible = false
- refresh
- end
- def refresh
- self.contents.clear
- actor = $game_actors[1]
- draw_actor_hp(actor, 0, 0, 96)
- draw_actor_mp(actor, 0, 32, 96)
- end
- def update
- self.visible = false
- self.visible = true if $game_switches[95] == true
- refresh
- end
- end
- class Scene_Map
- alias hud_main main
- alias hud_update update
- alias hud_terminate terminate
- def main
- @hud = Window_Hud.new
- hud_main
- end
- def update
- @hud.update
- hud_update
- end
- def terminate
- @hud.dispose
- end
- end
- module Sound
- def self.play_critical
- Audio.se_play("Audio/SE/Critical", 100)
- end
-
- def self.play_gain_item
- Audio.se_play("Audio/SE/Get_Item")
- end
- end
复制代码 范例…… |
|