设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 806|回复: 0
打印 上一主题 下一主题

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7802
在线时间
1343 小时
注册时间
2015-8-15
帖子
752
跳转到指定楼层
1
发表于 2023-8-23 10:26:19 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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




RUBY 代码复制
  1. class Window_Pre_Battle_View < Window_Base
  2.  
  3.   def initialize(attacker,defender)
  4.     #选项背景
  5.     @base = Sprite.new
  6.     @base.bitmap = RPG::Cache.menu("pre_battle/engage_enermy_base")
  7.     @base.x = origin_x
  8.     @base.y = origin_x
  9.     super(0, 0, 1200+32,700+32)
  10.     @windowskin_name = "trans"
  11.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)   
  12.     self.contents = Bitmap.new(width, height)
  13.     self.contents.font.size = 12
  14.     #self.contents.font.name = "Garamond"
  15.  
  16.     @attacker = attacker
  17.     @defender = defender
  18.  
  19.     draw_info
  20.     self.opacity = 0
  21.     self.active = true
  22.  
  23.   end
  24.   def origin_x
  25.     return 0
  26.   end
  27.   def origin_y
  28.     return 0
  29.   end
  30.  
  31.  
  32.   def draw_info
  33.     self.contents.font.size = 12
  34.     self.contents.font.color = efs_text_color(1)
  35.     self.contents.draw_text(160, 350-12*2, self.width - 40, 12, "总兵力:", 0)
  36.     self.contents.draw_text(160, 350-12*1, self.width - 40, 12, "士气:", 0)
  37.     self.contents.font.color = efs_text_color(0)
  38.     self.contents.draw_text(160, 350, self.width - 40, 12, "轻步兵:", 0)
  39.     self.contents.draw_text(160, 350+12*1, self.width - 40, 12, "重步兵:", 0)
  40.     self.contents.draw_text(160, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
  41.     self.contents.draw_text(160, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
  42.     self.contents.draw_text(160, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
  43.     self.contents.draw_text(160, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
  44.     self.contents.draw_text(160, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
  45.     self.contents.draw_text(160, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
  46.     self.contents.font.color = efs_text_color(1)
  47.     self.contents.draw_text(480, 350-12*2, self.width - 40, 12, "总兵力:", 0)
  48.     self.contents.draw_text(480, 350-12*1, self.width - 40, 12, "士气:", 0)
  49.     self.contents.font.color = efs_text_color(0)
  50.     self.contents.draw_text(480, 350, self.width - 40, 12, "轻步兵:", 0)
  51.     self.contents.draw_text(480, 350+12*1, self.width - 40, 12, "重步兵:", 0)
  52.     self.contents.draw_text(480, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
  53.     self.contents.draw_text(480, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
  54.     self.contents.draw_text(480, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
  55.     self.contents.draw_text(480, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
  56.     self.contents.draw_text(480, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
  57.     self.contents.draw_text(480, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
  58.  
  59.     alives = @attacker.get_num_all_type(true)
  60.     totals = @attacker.get_num_all_type
  61.  
  62.     self.contents.font.color = text_color(0)
  63.     the_width = 250
  64.     text = @attacker.get_alive_num.to_s+"/"+@attacker.base_member_size.to_s
  65.     the_size = self.contents.text_size(text).width
  66.     self.contents.draw_text(160, 350-12*2,  the_width - the_size, 12, text, 1)
  67.  
  68.     text = @attacker.get_morale.to_s
  69.     the_size = self.contents.text_size(text).width
  70.     self.contents.draw_text(160, 350-12*1,  the_width - the_size, 12, text, 1)
  71.  
  72.  
  73.     text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
  74.     the_size = self.contents.text_size(text).width
  75.     self.contents.draw_text(160, 350-0,  the_width - the_size, 12, text, 1)
  76.     text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
  77.     the_size = self.contents.text_size(text).width
  78.     self.contents.draw_text(160, 350+12*1,  the_width - the_size, 12, text, 1)
  79.     text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
  80.     the_size = self.contents.text_size(text).width
  81.     self.contents.draw_text(160, 350+12*2,  the_width - the_size, 12, text, 1)
  82.     text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
  83.     the_size = self.contents.text_size(text).width
  84.     self.contents.draw_text(160, 350+12*3,  the_width - the_size, 12, text, 1)
  85.     text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
  86.     the_size = self.contents.text_size(text).width
  87.     self.contents.draw_text(160, 350+12*4,  the_width - the_size, 12, text, 1)
  88.     text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
  89.     the_size = self.contents.text_size(text).width
  90.     self.contents.draw_text(160, 350+12*5,  the_width - the_size, 12, text, 1)
  91.     text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
  92.     the_size = self.contents.text_size(text).width
  93.     self.contents.draw_text(160, 350+12*6,  the_width - the_size, 12, text, 1)
  94.     text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
  95.     the_size = self.contents.text_size(text).width
  96.     self.contents.draw_text(160, 350+12*7,  the_width - the_size, 12, text, 1)
  97.  
  98.     alives = @defender.get_num_all_type(true)
  99.     totals = @defender.get_num_all_type
  100.  
  101.     self.contents.font.color = text_color(0)
  102.     the_width = 250
  103.     text = @defender.get_alive_num.to_s+"/"+@defender.base_member_size.to_s
  104.     the_size = self.contents.text_size(text).width
  105.     self.contents.draw_text(480, 350-12*2,  the_width - the_size, 12, text, 1)
  106.  
  107.     text = @defender.get_morale.to_s
  108.     the_size = self.contents.text_size(text).width
  109.     self.contents.draw_text(480, 350-12*1,  the_width - the_size, 12, text, 1)
  110.  
  111.     text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
  112.     the_size = self.contents.text_size(text).width
  113.     self.contents.draw_text(480, 350-0,  the_width - the_size, 12, text, 1)
  114.     text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
  115.     the_size = self.contents.text_size(text).width
  116.     self.contents.draw_text(480, 350+12*1,  the_width - the_size, 12, text, 1)
  117.     text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
  118.     the_size = self.contents.text_size(text).width
  119.     self.contents.draw_text(480, 350+12*2,  the_width - the_size, 12, text, 1)
  120.     text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
  121.     the_size = self.contents.text_size(text).width
  122.     self.contents.draw_text(480, 350+12*3,  the_width - the_size, 12, text, 1)
  123.     text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
  124.     the_size = self.contents.text_size(text).width
  125.     self.contents.draw_text(480, 350+12*4,  the_width - the_size, 12, text, 1)
  126.     text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
  127.     the_size = self.contents.text_size(text).width
  128.     self.contents.draw_text(480, 350+12*5,  the_width - the_size, 12, text, 1)
  129.     text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
  130.     the_size = self.contents.text_size(text).width
  131.     self.contents.draw_text(480, 350+12*6,  the_width - the_size, 12, text, 1)
  132.     text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
  133.     the_size = self.contents.text_size(text).width
  134.     self.contents.draw_text(480, 350+12*7,  the_width - the_size, 12, text, 1)
  135.  
  136.     #===============================================================
  137.     #self.contents.draw_text(119, 118, self.width - 40, 12, "当前效果对部队属性的影响总合(%)", 0)
  138.     self.contents.font.size = 10
  139.     self.contents.font.color = efs_text_color(0)
  140.     i = 0
  141.     dis = 49
  142.     x = 10
  143.     y = 350 + 12
  144.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
  145.     i+=1
  146.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
  147.     i+=1
  148.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
  149.     i = 0
  150.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
  151.     i+=1  
  152.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
  153.     i+=1
  154.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
  155.     i = 0
  156.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
  157.     i+=1
  158.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
  159.     i = 0
  160.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
  161.     i+=1
  162.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
  163.     i+=1
  164.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
  165.     i = 0
  166.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
  167.     i+=1  
  168.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
  169.     i+=1
  170.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
  171.     i = 0
  172.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
  173.     i+=1
  174.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
  175.     i = 0
  176.     dis = 49
  177.     x = 10 + 320
  178.     y = 350 + 12
  179.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
  180.     i+=1
  181.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
  182.     i+=1
  183.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
  184.     i = 0
  185.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
  186.     i+=1  
  187.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
  188.     i+=1
  189.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
  190.     i = 0
  191.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
  192.     i+=1
  193.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
  194.     i = 0
  195.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
  196.     i+=1
  197.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
  198.     i+=1
  199.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
  200.     i = 0
  201.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
  202.     i+=1  
  203.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
  204.     i+=1
  205.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
  206.     i = 0
  207.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
  208.     i+=1
  209.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
  210.  
  211.  
  212.     const_states = @attacker.get_const_states
  213.     result = Const_State_data.get_data_for_display(const_states)
  214.  
  215.     red = text_color(2)
  216.     green = text_color(3)
  217.     white = text_color(0)
  218.     self.contents.font.size = 10
  219.     x = 10 + 25
  220.     y = 350 + 12
  221.     dis = 49
  222.     for i in 0...3
  223.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  224.     self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result[i].to_s, 0)
  225.     end
  226.     for i in 3...6
  227.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  228.     self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result[i].to_s, 0)
  229.     end
  230.     for i in 6...8
  231.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  232.     self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result[i].to_s, 0)
  233.     end
  234.     for i in 8...11
  235.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  236.     self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result[i].to_s, 0)
  237.     end
  238.     for i in 11...14
  239.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  240.     self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result[i].to_s, 0)
  241.     end
  242.     for i in 14...16
  243.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  244.     self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result[i].to_s, 0)
  245.     end
  246.  
  247.     const_states = @defender.get_const_states
  248.     result = Const_State_data.get_data_for_display(const_states)
  249.  
  250.     x = 10 + 25 + 320
  251.     y = 350 + 12
  252.     dis = 49
  253.     for i in 0...3
  254.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  255.     self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result[i].to_s, 0)
  256.     end
  257.     for i in 3...6
  258.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  259.     self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result[i].to_s, 0)
  260.     end
  261.     for i in 6...8
  262.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  263.     self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result[i].to_s, 0)
  264.     end
  265.     for i in 8...11
  266.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  267.     self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result[i].to_s, 0)
  268.     end
  269.     for i in 11...14
  270.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  271.     self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result[i].to_s, 0)
  272.     end
  273.     for i in 14...16
  274.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  275.     self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result[i].to_s, 0)
  276.     end
  277.  
  278.     #==============================================================
  279.     draw_walk_actor_graphic(@attacker.event.character_name, 10,308,50)
  280.     draw_walk_actor_graphic(@defender.event.character_name,603,308,50)
  281.     self.contents.font.size = 12
  282.     self.contents.font.color = efs_text_color(1)
  283.  
  284.     self.contents.draw_text(10, 335-12, self.width, 12, @attacker.the_name, 0)
  285.     self.contents.draw_text(330, 335-12, self.width, 12, @defender.the_name, 0)
  286.  
  287.     text = @attacker.get_battle_effective.to_s
  288.     self.contents.draw_text(10, 335, self.width, 12, "战斗力: "+text, 0)
  289.     text = @defender.get_battle_effective.to_s
  290.     self.contents.draw_text(330, 335, self.width, 12, "战斗力: "+text, 0)
  291.     self.contents.font.size = 10
  292.     self.contents.font.color = efs_text_color(0)
  293.     self.contents.draw_text(10, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
  294.     self.contents.draw_text(330, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
  295.  
  296.  
  297.   end
  298.  
  299.   #--------------------------------------------------------------------------
  300.   # ● 一些方法的重载
  301.   #--------------------------------------------------------------------------  
  302.   def dispose
  303.     @base.dispose
  304.     super
  305.   end
  306.   def y=(y)
  307.     super(y)
  308.     @base.y=y
  309.   end  
  310.   def visible=(visible)
  311.     super(visible)
  312.     @base.visible = visible
  313.   end
  314.   def contents_opacity=(opacity)
  315.     super(opacity)
  316.     @base.opacity = opacity   
  317.   end
  318. end

  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 (671.59 KB, 下载次数: 21)

总战力.png

22.png (9.32 KB, 下载次数: 19)

22.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-21 22:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表