赞 | 5 |
VIP | 0 |
好人卡 | 2 |
积分 | 36 |
经验 | 24079 |
最后登录 | 2024-11-22 |
在线时间 | 1891 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3606
- 在线时间
- 1891 小时
- 注册时间
- 2010-6-19
- 帖子
- 1211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 黑米馒头 于 2022-4-24 20:55 编辑
下面这个脚本,可以显示角色名字,如何改成人物死亡名字不显示~
[fold][/fold]
- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的活动块的类。本类在 Scene_Battle 类
- # 的内部使用。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :viewport1 # 敌人方的显示端口
- attr_reader :viewport2 # 角色方的显示端口
- #--------------------------------------------------------------------------
- # ● 初始化变量
- #--------------------------------------------------------------------------
- def initialize
- # 生成显示端口
- @viewport1 = Viewport.new(0, 0, 1024, 768)
- @viewport2 = Viewport.new(0, 0, 1024, 768)
- @viewport3 = Viewport.new(0, 0, 1024, 768)
- @viewport4 = Viewport.new(0, 0, 1024, 768)
- @viewport2.z = 101
- @viewport3.z = 200
- @viewport4.z = 5000
- # 生成战斗背景活动块
- @battleback_sprite = Sprite.new(@viewport1)
- # 生成敌人活动块
- @enemy_sprites = []
- @enemy_name = []
- # 银~添加名字缓存数组(步骤1
- @name2 = []
- # ===================(步骤1 end
- for enemy in $game_troop.enemies.reverse
- # 银~给名字缓存数组塞敌人队伍成员名字(步骤2
- @name2.push(enemy.name)
- # ===================================(步骤2 end
- @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
- @enemy_name.push(Sprite.new(@viewport1))
- @enemy_name[-1].bitmap = Bitmap.new(240,32)
- @enemy_name[-1].bitmap.font.name = (["宋体","黑体"])
- @enemy_name[-1].bitmap.font.size = 16
- @enemy_name[-1].bitmap.font.color.set(255, 255, 128)
- @enemy_name[-1].bitmap.draw_text(0,0,240,32,enemy.name,1)
- @enemy_name[-1].x = enemy.screen_x - 488+13-112
- @enemy_name[-1].y = enemy.screen_y - 133+15
- @enemy_name[-1].z = enemy.screen_z# + 10
- end
- # 生成敌人活动块
- @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))
- @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))
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- @actor_sprites.push(Sprite_Battler.new(@viewport1))
- @name = []
- @name_sprites = []
- for i in $game_party.actors
- @name.push(i.name)
- @name_sprites.push(Sprite.new(@viewport1))
- @name_sprites[-1].bitmap = Bitmap.new(240,32)
- @name_sprites[-1].bitmap.font.name = (["宋体","黑体"])
- @name_sprites[-1].bitmap.font.size = 16
- @name_sprites[-1].bitmap.font.color.set(60, 255, 120)
- @name_sprites[-1].bitmap.draw_text(0,0,240,32,i.name,1)
- @name_sprites[-1].x = i.screen_x - 488+13-112
- @name_sprites[-1].y = i.screen_y - 133+15
- @name_sprites[-1].z = i.s_z# + 10
- end
- # 生成天候
- @weather = RPG::Weather.new(@viewport1)
- # 生成图片活动块
- @picture_sprites = []
- for i in 51..100
- @picture_sprites.push(Sprite_Picture.new(@viewport3,
- $game_screen.pictures[i]))
- end
- # 生成计时器块
- @timer_sprite = Sprite_Timer.new
- # 刷新画面
- update
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- # 如果战斗背景位图存在的情况下就释放
- if @battleback_sprite.bitmap != nil
- @battleback_sprite.bitmap.dispose
- end
- # 释放战斗背景活动块
- @battleback_sprite.dispose
- # 释放敌人活动块、角色活动块
- for sprite in @enemy_sprites + @actor_sprites
- sprite.dispose
- end
- # 释放天候
- @weather.dispose
- # 释放图片活动块
- for sprite in @picture_sprites
- sprite.dispose
- end
- # 释放计时器活动块
- @timer_sprite.dispose
- # 释放显示端口
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- @viewport4.dispose
- end
- #--------------------------------------------------------------------------
- # ● 显示效果中判定
- #--------------------------------------------------------------------------
- def effect?
- # 如果是在显示效果中的话就返回 true
- for sprite in @enemy_sprites + @actor_sprites
- return true if sprite.effect?
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新角色的活动块 (对应角色的替换)
- @actor_sprites[0].battler = $game_party.actors[0]
- @actor_sprites[1].battler = $game_party.actors[1]
- @actor_sprites[2].battler = $game_party.actors[2]
- @actor_sprites[3].battler = $game_party.actors[3]
- @actor_sprites[4].battler = $game_party.actors[4]
- @actor_sprites[5].battler = $game_party.actors[5]
- @actor_sprites[6].battler = $game_party.actors[6]
- @actor_sprites[7].battler = $game_party.actors[7]
- @actor_sprites[8].battler = $game_party.actors[8]
- @actor_sprites[9].battler = $game_party.actors[9]
- temp = []
- for i in $game_party.actors
- temp.push(i.name)
- end
- if !(temp == @name)
- @name_sprites.each{|fuck| fuck.dispose} #==========释放名字==============
- @name_sprites = []
- for i in $game_party.actors
- @name_sprites.push(Sprite.new(@viewport1))
- @name_sprites[-1].bitmap = Bitmap.new(240,32)
- @name_sprites[-1].bitmap.font.name = (["宋体","黑体"])
- @name_sprites[-1].bitmap.font.size = 16
- @name_sprites[-1].bitmap.font.color.set(60, 255, 120)
- @name_sprites[-1].bitmap.draw_text(0,0,240,32,i.name,1)
- @name_sprites[-1].x = i.screen_x - 488+13-112
- @name_sprites[-1].y = i.screen_y - 133+15
- @name_sprites[-1].z = i.s_z# + 10
- end
- @name = temp
- end
-
- # 银~以下是有条件刷新(步骤3
- # 建立临时对比数组
- temp2 = []
- # 给临时数组塞最新的敌人成员名字
- for enemy in $game_troop.enemies.reverse
- temp2.push(enemy.name)
- end
- # 如果不是临时数组跟开始的缓存数组相同
- if !(temp2 == @name2)
- # 消除原来的描画(不知道有什么意义~~囧
- for enemy in $game_troop.enemies.reverse
- @enemy_name[-1].bitmap.clear
- end
- # 初始化敌人名字精灵组
- @enemy_name.each{|fuck| fuck.dispose} #==========释放名字================
- @enemy_name = []
- # 再描画敌人名字
- for enemy in $game_troop.enemies.reverse
- @enemy_name.push(Sprite.new(@viewport1))
- @enemy_name[-1].bitmap = Bitmap.new(240,32)
- @enemy_name[-1].bitmap.font.name = (["宋体","黑体"])
- @enemy_name[-1].bitmap.font.size = 16
- @enemy_name[-1].bitmap.font.color.set(255, 255, 128)
- @enemy_name[-1].bitmap.draw_text(0,0,240,32,enemy.name,1)
- @enemy_name[-1].x = enemy.screen_x - 488+13-112
- @enemy_name[-1].y = enemy.screen_y - 133+15
- @enemy_name[-1].z = enemy.screen_z# + 10
- end
- # 把临时组代入名字缓存组
- @name2 = temp2
- end
- # ==================(步骤3 end
- for i in 0...$game_troop.enemies.size
- @enemy_name[i].x = @enemy_sprites[i].x - 110
- @enemy_name[i].y = @enemy_sprites[i].y - 116
- @enemy_name[i].z = @enemy_sprites[i].z# - 10
- end
-
- #==================战斗的时候影响到名字显示在战斗图上面==================
- for i in 0...$game_party.actors.size
- @name_sprites[i].x = @actor_sprites[i].x - 110
- @name_sprites[i].y = @actor_sprites[i].y - 116
- @name_sprites[i].z = @actor_sprites[i].z# + 10
- end
- #==================战斗的时候影响到名字显示在战斗图上面==================
- for i in 0...$game_party.actors.size
- @name_sprites[i].z = @actor_sprites[i].z# - 10
- end
- #==================战斗的时候影响到名字显示在战斗图上面==================
- # 战斗背景的文件名与现在情况有差异的情况下
- if @battleback_name != $game_temp.battleback_name
- @battleback_name = $game_temp.battleback_name
- if @battleback_sprite.bitmap != nil
- @battleback_sprite.bitmap.dispose
- end
- @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
- @battleback_sprite.src_rect.set(0, 0, 1024, 768)
- end
- # 刷新战斗者的活动块
- for sprite in @enemy_sprites + @actor_sprites
- sprite.update
- end
- # 刷新天气图形
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.update
- # 刷新图片活动块
- for sprite in @picture_sprites
- sprite.update
- end
- # 刷新计时器活动块
- @timer_sprite.update
- # 设置画面的色调与震动位置
- @viewport1.tone = $game_screen.tone
- @viewport1.ox = $game_screen.shake
- # 设置画面的闪烁色
- @viewport4.color = $game_screen.flash_color
- # 刷新显示端口
- @viewport1.update
- @viewport2.update
- @viewport4.update
- end
- end
复制代码
|
|