查看: 2087|回复: 1

[已经解决] 想在菜单界面角色名字下面做个经验条要怎么办啊?

[复制链接]
梦石
0
星屑
125
在线时间
152 小时
注册时间
2014-8-23
回帖
109
发表于 2016-6-22 16:18:25 | 显示全部楼层 |阅读模式

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

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

×
原来XP的时候还可以显示经验值,VA直接没有了……
所以我想做根经验条,能显示距离下一级的经验值,还有直观的条形,请问要怎么做啊?
本人脚本废……
顺便图书馆里的“VA的使用小技巧”里有一个能在菜单显示TP条的脚本,能效仿一下么?

漾夕☽星化残月☾

梦石
0
星屑
8611
在线时间
3858 小时
注册时间
2015-5-12
回帖
2022

剧作品鉴家

发表于 2016-6-22 16:39:13 | 显示全部楼层
本帖最后由 御曹司 于 2016-6-22 16:54 编辑

拿别人的菜单脚本改了一下。。。效果如下图


图床没问题吧

另外满级的数字我是20、手动定义的(197 198 290行的数字)。所以麻烦用的时候改一下那个,,,


拿别人的脚本改的
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Menu Layout
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.4
  6. #------------------------------------------------------------------------------#
  7. #  2012-11-10 - Version 1.4 - Added option to set how many actors visible
  8. #  2012-10-19 - Version 1.3 - Fixed a bug that happened with lots of members
  9. #  2012-10-13 - Version 1.2 - Fixed to work in all screen resolutions with some
  10. #                             options to tweak position.
  11. #  2012-10-13 - Version 1.1 - Changed to use /Pictures/ instead of /Faces/
  12. #                             Seemed more appropriate as this would be used to
  13. #                             draw the image as a picture in game.
  14. #  2012-10-13 - Version 1.0 - release
  15. #------------------------------------------------------------------------------#
  16. #  This script overwrites the default menu so the actors on the main menu screen
  17. #  are lined up horizontally and display a portrait image instead of the face.
  18. #
  19. #  INSTRUCTIONS:
  20. #  Copy this script below materials and above main
  21. #
  22. #  You MUST have a portrait for each actor. This was designed to work with
  23. #  the RTP potraits that you must have purchased the right stuff to use.
  24. #  These portrat images are around 270px x 290px.

  25. #  Put these portraits in the Graphics/faces/ and name them the same as the
  26. #  face graphic the actor uses, plus the position of the face in it.
  27. #  For example
  28. #  If your actor uses "Actor1" face and uses the first face in that file then
  29. #  you will name the portrait image "Actor1-1.png"
  30. #
  31. #  Download the demo if you don't understand
  32. #------------------------------------------------------------------------------#


  33. #------------------------------------------------------------------------------#  
  34. #  SCREEN SIZE
  35. #------------------------------------------------------------------------------#
  36.   # This menu layout looks better on larger screen size. The below line
  37.   # increases your screen size to the max. Remove it if you don't want this.

  38.     Graphics.resize_screen(640, 480)

  39. #------------------------------------------------------------------------------#
  40. #------------------------------------------------------------------------------#
  41. module Galv_Menu  
  42. #------------------------------------------------------------------------------#  
  43. #  SETUP OPTIONS
  44. #------------------------------------------------------------------------------#

  45.   CURRENCY_ICON = 341       # Icon to display instead of currency vocab.
  46.                             # Change this to 0 to use currency vocab instead.

  47.   PORTRAIT_X_OFFSET = 0     # add a positive or negative number to offset
  48.   PORTRAIT_Y_OFFSET = 0     # each portrait's postion if the portraits you use
  49.                             # do not line up with your screen width/height.

  50.   PORTRAIT_HEIGHT = 400     # So you can tweak the height of the portraits.

  51.   NUMBER_OF_ACTORS = 4      # number of actors visible before scrolling

  52. #------------------------------------------------------------------------------#  
  53. #  END SETUP OPTIONS
  54. #------------------------------------------------------------------------------#
  55. end

  56. module RIMO
  57. module Exp_Gauge
  58.   #颜色渐变
  59.   EXP_COLOR1 = 4
  60.   EXP_COLOR2 = 3
  61.   #经验数显示*(true\false)
  62.   EXP_TEXT = true
  63. end
  64. end



  65. class Window_MenuCommand < Window_Command
  66.   def window_width
  67.     return 130
  68.   end
  69. end


  70. class Window_Gold < Window_Base
  71.   def window_width
  72.     return 130
  73.   end
  74.   def refresh
  75.     contents.clear
  76.     if Galv_Menu::CURRENCY_ICON > 0
  77.       draw_currency_value(value, currency_icon, 4, 0, contents.width - 25)
  78.     else
  79.       draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  80.     end
  81.   end
  82.   def currency_icon
  83.     draw_icon(Galv_Menu::CURRENCY_ICON, contents.width - 23, -1, true)
  84.   end

  85. end


  86. class Window_Base < Window
  87. include RIMO::Exp_Gauge
  88. def exp_color1;   text_color(EXP_COLOR1);  end;
  89. def exp_color2;   text_color(EXP_COLOR2);  end;
  90. end


  91. class Window_MenuStatus < Window_Selectable

  92.   
  93.   def window_width
  94.     Graphics.width - 130
  95.   end

  96.   def item_height
  97.     (height - standard_padding * 2)
  98.   end

  99.   def draw_portrait(face_name, face_index, x, y, enabled = true)
  100.     bitmap = Cache.picture(face_name + "-" + (face_index + 1).to_s)
  101.     portrait_width = bitmap.width / 3 + Galv_Menu::PORTRAIT_X_OFFSET
  102.     y_offset = Galv_Menu::PORTRAIT_Y_OFFSET
  103.     rect = Rect.new(portrait_width - 37 , -70 + y_offset, col_width + tweak, Galv_Menu::PORTRAIT_HEIGHT)
  104.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  105.     bitmap.dispose
  106.   end

  107.   def tweak
  108.     if Galv_Menu::NUMBER_OF_ACTORS <= 3
  109.       return -2
  110.     else
  111.       return 0
  112.     end
  113.   end

  114.   def draw_actor_portrait(actor, x, y, enabled = true)
  115.     draw_portrait(actor.face_name, actor.face_index, x, y, enabled)
  116.   end

  117.   def draw_item(index)
  118.     actor = $game_party.members[index]
  119.     enabled = $game_party.battle_members.include?(actor)
  120.     rect = item_rect(index)
  121.     draw_item_background(index)
  122.     draw_actor_portrait(actor, rect.x + 1, rect.y + 1, enabled)
  123.     draw_actor_simple_status(actor, rect.x, rect.y)
  124.   end

  125.   def draw_actor_simple_status(actor, x, y)
  126.     draw_actor_name(actor, x, y)
  127.     draw_actor_level(actor, x, y + line_height * 2)
  128.     draw_actor_icons(actor, x, y + Graphics.height - line_height * 5)
  129.     draw_actor_class(actor, x, y + line_height * 1)
  130.     draw_actor_hp(actor, x, y + Graphics.height - line_height * 4)
  131.     draw_actor_mp(actor, x, y + Graphics.height - line_height * 3)
  132.     #draw_actor_tp(actor, x, y + Graphics.height - line_height * 2)
  133.     draw_actor_exp(actor, x, y + Graphics.height - line_height * 2, EXP_TEXT)
  134.   end

  135.   def col_width
  136.     window_width / Galv_Menu::NUMBER_OF_ACTORS - standard_padding - 2
  137.   end

  138.   def draw_actor_hp(actor, x, y, width = col_width)
  139.     draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  140.     change_color(system_color)
  141.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  142.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  143.     hp_color(actor), normal_color)
  144.   end

  145.   def draw_actor_mp(actor, x, y, width = col_width)
  146.     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  147.     change_color(system_color)
  148.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  149.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  150.       mp_color(actor), normal_color)
  151.   end

  152.   def draw_actor_tp(actor, x, y, width = col_width)
  153.     draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  154.     change_color(system_color)
  155.     draw_text(x, y, 30, line_height, Vocab::tp_a)
  156.     change_color(tp_color(actor))
  157.     draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  158.   end

  159.   
  160. def draw_actor_exp(actor, x, y, display = true, width = 113)
  161.     this_level = actor.exp - actor.past_level_exp
  162.     next_level = actor.next_level_exp - actor.past_level_exp
  163.     draw_gauge(x, y, width, actor.exp_rate, exp_color1, exp_color2)
  164.     this_level = "max" if actor.level == 20
  165.     next_level = "max" if actor.level == 20
  166.     change_color(system_color)

  167.   if display
  168.       draw_text(x, y, 40, line_height, "Exp")
  169.       draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)
  170.     end
  171. end
  172.   
  173.   
  174.   
  175.   
  176.   

  177.   def draw_current_and_max_values(x, y, width, current, max, color1, color2)
  178.     change_color(color1)
  179.     xr = x + width
  180.     if width < 100
  181.       draw_text(xr - 40, y, 42, line_height, current, 2)
  182.     else
  183.       draw_text(xr - 92, y, 42, line_height, current, 2)
  184.       change_color(color2)
  185.       draw_text(xr - 52, y, 12, line_height, "/", 2)
  186.       draw_text(xr - 42, y, 42, line_height, max, 2)
  187.     end
  188.   end
  189.   def draw_actor_name(actor, x, y, width = col_width)
  190.     change_color(hp_color(actor))
  191.     draw_text(x, y, width, line_height, actor.name)
  192.   end
  193.   def draw_actor_class(actor, x, y, width = col_width)
  194.     change_color(normal_color)
  195.     draw_text(x, y, width, line_height, actor.class.name)
  196.   end
  197.   def visible_line_number
  198.     return 1
  199.   end
  200.   def col_max
  201.     return Galv_Menu::NUMBER_OF_ACTORS
  202.   end
  203.   def spacing
  204.     return 8
  205.   end
  206.   def contents_width
  207.     (item_width + spacing) * item_max - spacing
  208.   end
  209.   def contents_height
  210.     item_height
  211.   end
  212.   def top_col
  213.     ox / (item_width + spacing)
  214.   end
  215.   def top_col=(col)
  216.     col = 0 if col < 0
  217.     @member_count = $game_party.members.count
  218.     col = col_max + @member_count if col > col_max + @member_count
  219.     self.ox = col * (item_width + spacing)
  220.   end
  221.   def bottom_col
  222.     top_col + col_max - 1
  223.   end
  224.   def bottom_col=(col)
  225.     self.top_col = col - (col_max - 1)
  226.   end
  227.   def ensure_cursor_visible
  228.     self.top_col = index if index < top_col
  229.     self.bottom_col = index if index > bottom_col
  230.   end
  231.   def item_rect(index)
  232.     rect = super
  233.     rect.x = index * (item_width + spacing)
  234.     rect.y = 0
  235.     rect
  236.   end
  237.   def alignment
  238.     return 1
  239.   end
  240.   def cursor_down(wrap = false)
  241.   end
  242.   def cursor_up(wrap = false)
  243.   end
  244.   def cursor_pagedown
  245.   end
  246.   def cursor_pageup
  247.   end
  248. end


  249. class Game_Actor < Game_Battler
  250. def exp_rate
  251.     this_level = exp - past_level_exp
  252.     next_level = next_level_exp - past_level_exp
  253.     this_level = next_level if level == 20
  254.     next_level > 0 ? this_level.to_f / next_level : 0
  255. end

  256. def past_level_exp
  257.   @level > 1 ? exp_for_level(@level) : 0
  258. end



  259. end
复制代码

点评

我只要能显示经验值的那几行……谢谢  发表于 2016-6-22 18:05
我这是原版版的菜单哦没问题么= -  发表于 2016-6-22 17:27

评分

参与人数 1梦石 +1 收起 理由
丿梁丶小柒 + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部