Project1

标题: 查看敌人属性脚本设置求教 [打印本页]

作者: guoyq1988    时间: 2014-4-20 20:46
标题: 查看敌人属性脚本设置求教
从天干宝典里挖出来的脚本,也把查看等级设置成最高了
可是敌人显示的资料都是????
请问大神们,要怎么设置才对



  1. #==============================================================================
  2. #   探查技能  BY绿发的Eclair
  3. #------------------------------------------------------------------------------  
  4. #   使用方法:在数据库中设定一个叫“探查”的状态(想要用别的名字在下面改啦~)
  5. #   然后把想要做成有探查效果的特技或物品附加这个状态。就这样简单~~
  6. #   修改自然属性的个数在第16行。
  7. #==============================================================================
  8. #   探查技能加强  BY snstar2006
  9. #------------------------------------------------------------------------------  
  10. #   加强部分:
  11. #   1. 敌人的属性为[王]的话,HP和SP不会显示,直到HP少於一半才会显示。
  12. #   2. 用变数做技能等级,可以直接用事件升级、降级。
  13. #   3. 可以设置不同能力所需要的等级。等级不够时显示为????。
  14. #   4. 设置为四格掉宝内的宝物看不见。
  15. #==============================================================================
  16. $探查状态名 = "探查"         # 探查状态的名字
  17. $eye_level = 1               # 探查技能等级的变数ID

  18. $头目属性名 = "王"

  19. # 探查能力的等级
  20. $eye_level_ability = [0, 1, 2, 3, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14]
  21. # 依次为:
  22. # 0->名称 、1->HP+SP、2->HP+SP Max、3->种族、
  23. # 4->经验 、5->金钱 、6->掉落物   、7->攻击、
  24. # 8->物防 、9->魔防 、10->力量    、11->灵巧、
  25. # 12->速度、13->魔力、14->属性有效度

  26. $text_4_unknown = "????" # 未知时的文字

  27. class Window_cateyes < Window_Base
  28.   def initialize
  29.     super(120,40,400,400)
  30.     self.contents = Bitmap.new(width - 32, height - 32)
  31.     self.visible = false
  32.     self.z = 9999
  33.     self.back_opacity = 160  #信息窗口的透明度
  34.     [url=home.php?mod=space&uid=12971]@element[/url]          = 8    #自然属性个数
  35.     [url=home.php?mod=space&uid=29967]@Race[/url]             = 8
  36.   end
  37.   def set_target(target)
  38.     self.contents.clear
  39.     self.visible = true
  40.     @target = target
  41.    
  42.     if $game_variables[$eye_level] >= $eye_level_ability[0]
  43.       self.contents.draw_text(10,10,360-32,32,"#{@target.name}",0)
  44.     else
  45.       self.contents.draw_text(10,10,360-32,32,$text_4_unknown,0)
  46.     end
  47.         
  48.    
  49.     # 描绘种族
  50.     self.contents.font.color = system_color
  51.     self.contents.draw_text(10,100,180,32,"种族",0)
  52.     self.contents.font.color = normal_color
  53.     for i in @element + 1..@element+1+@race
  54.       if @target.element_rate(i) > 100
  55.         race = $data_system.elements[i]
  56.         break
  57.       end
  58.     end
  59.    
  60.     # 獲取是否為頭目
  61.     for i in @element + 2 + @race..$data_system.elements.size
  62.       unless $data_system.elements[i] == $头目属性名
  63.         # 检验是否显示HP/SP
  64.         if (@target.hp)<=(@target.maxhp/2)
  65.           @show_hsp = true
  66.         else
  67.           @show_hsp = false
  68.         end
  69.       else
  70.         @show_hsp = true
  71.       end
  72.     end
  73.    
  74.     # 描绘HP
  75.     draw_actor_hp(@target,10,100 - 32 - 25,160)
  76.     # 描绘SP
  77.     draw_actor_sp(@target,10,100 - 32,160)
  78.    
  79.    
  80.     if $game_variables[$eye_level] >= $eye_level_ability[3]
  81.       self.contents.draw_text(70,100,100,32,race,2)
  82.     else
  83.       self.contents.draw_text(70,100,100,32,$text_4_unknown,2)
  84.     end
  85.    
  86.     # 目标是敌方角色的场合
  87.     if @target.is_a?(Game_Enemy)
  88.       # 描绘经验
  89.       self.contents.font.color = system_color  
  90.       self.contents.draw_text(190,100 - 32 - 25,180-32,32,"经验",0)
  91.       self.contents.font.color = normal_color
  92.       if $game_variables[$eye_level] >= $eye_level_ability[4]
  93.         self.contents.draw_text(190,100 - 32 - 25,180 - 32,32,"#{@target.exp}",2)
  94.       else
  95.         self.contents.draw_text(190,100 - 32 - 25,180 - 32,32,$text_4_unknown,2)
  96.       end
  97.       # 描绘金钱
  98.       self.contents.font.color = system_color  
  99.       self.contents.draw_text(190,100 - 32 ,180-32,32,$data_system.words.gold,0)
  100.       self.contents.font.color = normal_color
  101.       if $game_variables[$eye_level] >= $eye_level_ability[5]
  102.         self.contents.draw_text(190,100 - 32,180-32,32,"#{@target.gold}",2)
  103.       else
  104.         self.contents.draw_text(190,100 - 32,180-32,32,$text_4_unknown,2)
  105.       end
  106.       # 描绘掉落物
  107.       self.contents.font.color = system_color  
  108.       self.contents.draw_text(190,100 ,180,32,"携带",0)
  109.       self.contents.font.color = normal_color
  110.       if $game_variables[$eye_level] >= $eye_level_ability[6]
  111.         if (target.item_id > 0 or target.weapon_id != 0 or target.armor_id != 0)
  112.           draw_item_name($data_items[@target.item_id],197,57 + 25 + 25 + 25) if @target.item_id > 0
  113.           draw_item_name($data_weapons[@target.weapon_id],197,57 + 25 + 25 + 25) if @target.weapon_id > 0
  114.           draw_item_name($data_armors[@target.armor_id],197,57 + 25 + 25 + 25) if @target.armor_id > 0
  115.         else
  116.           self.contents.draw_text(190,57+75,180-32,32,"无",2)
  117.         end
  118.       else
  119.         self.contents.draw_text(197,57 + 75,180-32,32,$text_4_unknown,2)
  120.       end
  121.     end
  122.    
  123.     # 描绘攻击
  124.     if $game_variables[$eye_level] >= $eye_level_ability[7]
  125.       draw_actor_parameter(@target, 10, 112 + 20, 0)
  126.     else
  127.       draw_actor_parameter_u(10, 112 + 20, 0)
  128.     end
  129.     # 描绘物理防御
  130.     if $game_variables[$eye_level] >= $eye_level_ability[8]
  131.       draw_actor_parameter(@target, 10, 144 + 20, 1)
  132.     else
  133.       draw_actor_parameter_u(10, 144 + 20, 1)
  134.     end
  135.     # 描绘魔法防御
  136.     if $game_variables[$eye_level] >= $eye_level_ability[9]
  137.       draw_actor_parameter(@target, 10, 176 + 20, 2)
  138.     else
  139.       draw_actor_parameter_u(10, 176 + 20, 2)
  140.     end
  141.     # 描绘力量
  142.     if $game_variables[$eye_level] >= $eye_level_ability[10]
  143.       draw_actor_parameter(@target, 10, 208 + 20, 3)
  144.     else
  145.       draw_actor_parameter_u(10, 208 + 20, 3)
  146.     end
  147.     # 描绘灵巧
  148.     if $game_variables[$eye_level] >= $eye_level_ability[11]
  149.       draw_actor_parameter(@target, 10, 240 + 20, 4)
  150.     else
  151.       draw_actor_parameter_u(10, 240 + 20, 4)
  152.     end
  153.     # 描绘速度
  154.     if $game_variables[$eye_level] >= $eye_level_ability[12]
  155.       draw_actor_parameter(@target, 10, 272 + 20, 5)
  156.     else
  157.       draw_actor_parameter_u(10, 272 + 20, 5)
  158.     end
  159.     # 描绘魔力
  160.     if $game_variables[$eye_level] >= $eye_level_ability[13]
  161.       draw_actor_parameter(@target, 10, 304 + 20, 6)
  162.     else
  163.       draw_actor_parameter_u(10, 304 + 20, 6)
  164.     end
  165.    
  166.     # 描绘属性抵抗度
  167.     self.contents.font.color = system_color
  168.     self.contents.draw_text(190,153 + 12,180,32,"属性抵抗",0)
  169.     self.contents.font.color = normal_color
  170.     num = @element_max == 0 ? $data_system.elements.size : @element_max
  171.     y = 0
  172.     weaker = ""
  173.     weak = ""
  174.     resist = ""
  175.     guard = ""
  176.     recover = ""
  177.     race = ""
  178.     for i in 1..@element
  179.       case @target.element_rate(i)
  180.       when 151..200
  181.         weaker += $data_system.elements[i]
  182.       when 101..150
  183.         weak +=   $data_system.elements[i]
  184.       when 1..99
  185.         resist += $data_system.elements[i]
  186.       when 0
  187.         guard += $data_system.elements[i]
  188.       when -200..-1
  189.         recover += $data_system.elements[i]
  190.       end
  191.     end
  192.     if $game_variables[$eye_level] >= $eye_level_ability[14]
  193.       if weaker != ""
  194.         weaker += "超弱"
  195.         self.contents.draw_text(190,153 + 32+ 12,180,32,weaker,0)
  196.         y += 1
  197.       end
  198.       if weak != ""
  199.         weak += "弱点"
  200.         self.contents.draw_text(190,153 + 32+ 12 + 32 * y,180,32,weak,0)
  201.         y += 1
  202.       end
  203.       if resist != ""
  204.         resist += "抵抗"
  205.         self.contents.draw_text(190,153 + 32+ 12 + 32 * y,180,32,resist,0)
  206.         y += 1
  207.       end
  208.       if guard != ""
  209.         guard += "无效"
  210.         self.contents.draw_text(190,153 + 32+ 12 + 32 * y,180,32,guard,0)
  211.         y += 1
  212.       end
  213.       if recover != ""
  214.         recover += "吸收"
  215.         self.contents.draw_text(190,153 + 32+ 12 + 32 * y,180,32,recover,0)
  216.       end
  217.     else
  218.       self.contents.draw_text(190,153 + 32+ 12 + 32 * y,180,32,$text_4_unknown,0)
  219.     end
  220.    
  221.   end
  222.   def draw_item_name(item, x, y)
  223.     if item == nil
  224.       return
  225.     end
  226.     bitmap = RPG::Cache.icon(item.icon_name)
  227.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  228.     self.contents.font.color = normal_color
  229.     self.contents.draw_text(x + 28, y, 150, 32, item.name)
  230.   end
  231.   
  232.   def draw_actor_parameter_u(x, y, type)
  233.     case type
  234.     when 0
  235.       parameter_name = $data_system.words.atk
  236.     when 1
  237.       parameter_name = $data_system.words.pdef
  238.     when 2
  239.       parameter_name = $data_system.words.mdef
  240.     when 3
  241.       parameter_name = $data_system.words.str
  242.     when 4
  243.       parameter_name = $data_system.words.dex
  244.     when 5
  245.       parameter_name = $data_system.words.agi
  246.     when 6
  247.       parameter_name = $data_system.words.int
  248.     end
  249.     self.contents.font.color = system_color
  250.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  251.     self.contents.font.color = normal_color
  252.     self.contents.draw_text(x + 120, y, 36, 32, $text_4_unknown, 2)
  253.   end
  254.   def draw_actor_hp(actor, x, y, width = 144)
  255.     # Draw "HP" text string
  256.     self.contents.font.color = system_color
  257.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  258.     # Calculate if there is draw space for MaxHP
  259.     if width - 32 >= 108
  260.       hp_x = x + width - 108
  261.       flag = true
  262.     elsif width - 32 >= 48
  263.       hp_x = x + width - 48
  264.       flag = false
  265.     end
  266.     # Draw HP
  267.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  268.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  269.     if $game_variables[$eye_level] >= $eye_level_ability[1] and @show_hsp
  270.       self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  271.     else
  272.       self.contents.draw_text(hp_x, y, 48, 32, $text_4_unknown, 2)
  273.     end
  274.     # Draw MaxHP
  275.     if flag
  276.       self.contents.font.color = normal_color
  277.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  278.       if $game_variables[$eye_level] >= $eye_level_ability[2] and @show_hsp
  279.         self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  280.       else
  281.         self.contents.draw_text(hp_x + 60, y, 48, 32, $text_4_unknown)
  282.       end
  283.     end
  284.   end
  285.   def draw_actor_sp(actor, x, y, width = 144)
  286.     # Draw "SP" text string
  287.     self.contents.font.color = system_color
  288.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  289.     # Calculate if there is draw space for MaxHP
  290.     if width - 32 >= 108
  291.       sp_x = x + width - 108
  292.       flag = true
  293.     elsif width - 32 >= 48
  294.       sp_x = x + width - 48
  295.       flag = false
  296.     end
  297.     # Draw SP
  298.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  299.     actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  300.     if $game_variables[$eye_level] >= $eye_level_ability[1] and @show_hsp
  301.       self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  302.     else
  303.       self.contents.draw_text(sp_x, y, 48, 32, $text_4_unknown, 2)
  304.     end
  305.     # Draw MaxSP
  306.     if flag
  307.       self.contents.font.color = normal_color
  308.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  309.       if $game_variables[$eye_level] >= $eye_level_ability[2] and @show_hsp
  310.         self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  311.       else
  312.         self.contents.draw_text(sp_x + 60, y, 48, 32, $text_4_unknown)
  313.       end
  314.     end
  315.   end
  316. end
  317. class Scene_Battle
  318.   alias update_phase4_step5_eclair2 :update_phase4_step5
  319.   def update_phase4_step5
  320.     for i in 1..$data_states.size - 1
  321.       if $data_states[i].name == $探查状态名
  322.         $探查状态ID = i
  323.         break
  324.       end
  325.     end
  326.     if (@active_battler.current_action.kind == 1 and $data_skills[@active_battler.current_action.skill_id].plus_state_set.include?($探查状态ID)) or (@active_battler.current_action.kind == 2 and $data_items[@active_battler.current_action.skill_id].plus_state_set.include?($探查状态ID))
  327.       @eye_window = Window_cateyes.new
  328.     for target in @target_battlers
  329.     target.damage = ""
  330.     @eye_window.set_target(target)
  331.     for i in 0...120
  332.     Input.update
  333.     @eye_window.update
  334.     Graphics.update
  335.     @spriteset.update
  336.     if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  337.     $game_system.se_play($data_system.decision_se)
  338.     break  
  339.     end
  340.     end
  341.   end
  342.     @eye_window.dispose
  343.     @eye_window = nil
  344. end
  345.     update_phase4_step5_eclair2
  346.   end
  347. end  
  348. #==============================================================================
  349. #   探查技能  BY绿发的Eclair
  350. #   加強      BY snstar2006
  351. #==============================================================================
复制代码

作者: guoyq1988    时间: 2014-4-21 13:33
没人吗?郁闷啊。。。。@myownroc @天地有正气  




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1