查看: 1448|回复: 0

[有事请教] 事件制作剩余战斗力(总兵力),只要总兵力血条

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2023-8-23 10:26:19 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 金芒芒 于 2023-8-24 11:40 编辑

不能用窗口制作,只能用事件
第一段脚本是网络上复制 第2段脚本是本来就有的脚本是战前,我要的是把
第2段改为战斗中使用,战斗中不能使用窗口,战斗只要显示总战斗力血条方式显示
只要把第2段改为第一段脚本模样属性内容是第2段
[pre lang="ruby"]剩下的血=$game_actors[1].hp
所有的血=$game_actors[1].maxhp
if $l_old_hp != 剩下的血 or ($l_old_hp1 !=
所有的血)
$l_old_hp = 剩下的血
$l_old_hp1 = 所有的血
放大率=剩下的血*100/所有的血
x坐标=41
y坐标=421
$game_screen.pictures[3].show("hp.png",
0,x坐标,y坐标,放大率,100,150,0)
end[/pre]



[pre lang="ruby"]class Window_Pre_Battle_View < Window_Base
  
  def initialize(attacker,defender)
    #选项背景
    @base = Sprite.new
    @base.bitmap = RPG::Cache.menu("pre_battle/engage_enermy_base")
    @base.x = origin_x
    @base.y = origin_x
    super(0, 0, 1200+32,700+32)
    @windowskin_name = "trans"
    self.windowskin = RPG::Cache.windowskin(@windowskin_name)   
    self.contents = Bitmap.new(width, height)
    self.contents.font.size = 12
    #self.contents.font.name = "Garamond"
   
    @attacker = attacker
    @defender = defender
   
    draw_info
    self.opacity = 0
    self.active = true
   
  end
  def origin_x
    return 0
  end
  def origin_y
    return 0
  end

  
  def draw_info
    self.contents.font.size = 12
    self.contents.font.color = efs_text_color(1)
    self.contents.draw_text(160, 350-12*2, self.width - 40, 12, "总兵力:", 0)
    self.contents.draw_text(160, 350-12*1, self.width - 40, 12, "士气:", 0)
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(160, 350, self.width - 40, 12, "轻步兵:", 0)
    self.contents.draw_text(160, 350+12*1, self.width - 40, 12, "重步兵:", 0)
    self.contents.draw_text(160, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
    self.contents.draw_text(160, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
    self.contents.draw_text(160, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
    self.contents.draw_text(160, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
    self.contents.draw_text(160, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
    self.contents.draw_text(160, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
    self.contents.font.color = efs_text_color(1)
    self.contents.draw_text(480, 350-12*2, self.width - 40, 12, "总兵力:", 0)
    self.contents.draw_text(480, 350-12*1, self.width - 40, 12, "士气:", 0)
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(480, 350, self.width - 40, 12, "轻步兵:", 0)
    self.contents.draw_text(480, 350+12*1, self.width - 40, 12, "重步兵:", 0)
    self.contents.draw_text(480, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
    self.contents.draw_text(480, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
    self.contents.draw_text(480, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
    self.contents.draw_text(480, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
    self.contents.draw_text(480, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
    self.contents.draw_text(480, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  

    alives = @attacker.get_num_all_type(true)
    totals = @attacker.get_num_all_type
   
    self.contents.font.color = text_color(0)
    the_width = 250
    text = @attacker.get_alive_num.to_s+"/"+@attacker.base_member_size.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350-12*2,  the_width - the_size, 12, text, 1)
   
    text = @attacker.get_morale.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350-12*1,  the_width - the_size, 12, text, 1)
   
   
    text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350-0,  the_width - the_size, 12, text, 1)
    text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*1,  the_width - the_size, 12, text, 1)
    text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*2,  the_width - the_size, 12, text, 1)
    text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*3,  the_width - the_size, 12, text, 1)
    text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*4,  the_width - the_size, 12, text, 1)
    text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*5,  the_width - the_size, 12, text, 1)
    text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*6,  the_width - the_size, 12, text, 1)
    text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*7,  the_width - the_size, 12, text, 1)
   
    alives = @defender.get_num_all_type(true)
    totals = @defender.get_num_all_type
   
    self.contents.font.color = text_color(0)
    the_width = 250
    text = @defender.get_alive_num.to_s+"/"+@defender.base_member_size.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-12*2,  the_width - the_size, 12, text, 1)
   
    text = @defender.get_morale.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-12*1,  the_width - the_size, 12, text, 1)
   
    text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-0,  the_width - the_size, 12, text, 1)
    text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*1,  the_width - the_size, 12, text, 1)
    text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*2,  the_width - the_size, 12, text, 1)
    text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*3,  the_width - the_size, 12, text, 1)
    text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*4,  the_width - the_size, 12, text, 1)
    text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*5,  the_width - the_size, 12, text, 1)
    text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*6,  the_width - the_size, 12, text, 1)
    text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*7,  the_width - the_size, 12, text, 1)
   
    #===============================================================
    #self.contents.draw_text(119, 118, self.width - 40, 12, "当前效果对部队属性的影响总合(%)", 0)
    self.contents.font.size = 10
    self.contents.font.color = efs_text_color(0)
    i = 0
    dis = 49
    x = 10
    y = 350 + 12
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
    i = 0
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
    i = 0
    dis = 49
    x = 10 + 320
    y = 350 + 12
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
    i = 0
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
   
   
    const_states = @attacker.get_const_states
    result = Const_State_data.get_data_for_display(const_states)

    red = text_color(2)
    green = text_color(3)
    white = text_color(0)
    self.contents.font.size = 10
    x = 10 + 25
    y = 350 + 12
    dis = 49
    for i in 0...3
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result.to_s, 0)
    end
    for i in 3...6
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result.to_s, 0)
    end
    for i in 6...8
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result.to_s, 0)
    end
    for i in 8...11
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result.to_s, 0)
    end
    for i in 11...14
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result.to_s, 0)
    end
    for i in 14...16
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result.to_s, 0)
    end
  
    const_states = @defender.get_const_states
    result = Const_State_data.get_data_for_display(const_states)

    x = 10 + 25 + 320
    y = 350 + 12
    dis = 49
    for i in 0...3
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result.to_s, 0)
    end
    for i in 3...6
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result.to_s, 0)
    end
    for i in 6...8
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result.to_s, 0)
    end
    for i in 8...11
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result.to_s, 0)
    end
    for i in 11...14
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result.to_s, 0)
    end
    for i in 14...16
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result.to_s, 0)
    end

    #==============================================================
    draw_walk_actor_graphic(@attacker.event.character_name, 10,308,50)
    draw_walk_actor_graphic(@defender.event.character_name,603,308,50)
    self.contents.font.size = 12
    self.contents.font.color = efs_text_color(1)
   
    self.contents.draw_text(10, 335-12, self.width, 12, @attacker.the_name, 0)
    self.contents.draw_text(330, 335-12, self.width, 12, @defender.the_name, 0)

    text = @attacker.get_battle_effective.to_s
    self.contents.draw_text(10, 335, self.width, 12, "战斗力: "+text, 0)
    text = @defender.get_battle_effective.to_s
    self.contents.draw_text(330, 335, self.width, 12, "战斗力: "+text, 0)
    self.contents.font.size = 10
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(10, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
    self.contents.draw_text(330, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
   
   
  end
  
  #--------------------------------------------------------------------------
  # ● 一些方法的重载
  #--------------------------------------------------------------------------  
  def dispose
    @base.dispose
    super
  end
  def y=(y)
    super(y)
    @base.y=y
  end  
  def visible=(visible)
    super(visible)
    @base.visible = visible
  end
  def contents_opacity=(opacity)
    super(opacity)
    @base.opacity = opacity   
  end
end  [/pre]
  1. class Scene_Map
  2.    
  3.   #--------------------------------------------------------------------------
  4.   # ● 主处理
  5.   #--------------------------------------------------------------------------
  6.   def display_pre_battle_view(attacker,defender)
  7.     attacker = $scene.armies[attacker].clone
  8.     defender = $scene.armies[defender].clone
  9.     # 演奏确定 SE
  10.     $game_system.se_play($data_system.decision_se)
  11.     @user_choosed_action_efs = -1
复制代码
总战力.png
22.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部