查看: 2260|回复: 1

[已经过期] 變量系統

[复制链接]
梦石
0
星屑
50
在线时间
41 小时
注册时间
2013-3-19
回帖
41
发表于 2013-4-29 22:57:25 | 显示全部楼层 |阅读模式

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

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

×
如何再地圖的最左上方顯示一個變量,並使用一個開關操縱是否顯示?

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2013-4-29 23:16:20 | 显示全部楼层
  1. #==============================================================================
  2. #   XS - Variable Hud
  3. #   Author: Nicke
  4. #   Created: 02/04/2012
  5. #   Edited: 09/04/2012
  6. #   Version: 1.0a
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ? Materials but above ? Main. Remember to save.
  12. #
  13. # A small hud to display variables on the map.
  14. #
  15. # *** Only for RPG Maker VX Ace. ***
  16. #==============================================================================
  17. ($imported ||= {})["XAIL-VAR-WIN-HUD"] = true

  18. module XAIL
  19.   module VAR_HUD
  20.   #--------------------------------------------------------------------------#
  21.   # * Settings
  22.   #--------------------------------------------------------------------------#
  23.       # FONT = [name, size, color, bold, shadow]
  24.       FONT = [["Verdana"], 14, Color.new(255,255,255), true, true] #这里修改显示变量的字体(字体、颜色、加粗、阴影)

  25.       # HUD = [width, x, y, z, opacity, skin]
  26.       HUD = [270, 295, -5,  200, 0, nil] #这里修改显示的位置

  27.       # VAR_HUD_SWITCH = switch_id
  28.       VAR_HUD_SWITCH = 1 #这里设置开关,开关关闭则脚本失效

  29.       # VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y] #这里设置要显示的变量
  30.       VAR_LIST = [] # Don't remove!
  31.       VAR_LIST[0] = [5, "HP", nil]
  32.       VAR_LIST[1] = [6, "MP", nil]
  33.       
  34.       # Set the symbol for the amount.
  35.       # Can be set to "" to disable.
  36.       # SYMBOL = string
  37.       SYMBOL = ""

  38.       # The space beetween the variables.
  39.       # SPACING = number
  40.       SPACING = 24

  41.   end
  42. end
  43. # *** Don't edit below unless you know what you are doing. ***
  44. #==============================================================================#
  45. # ** Window_Var_Hud
  46. #------------------------------------------------------------------------------
  47. #  Class for drawing the variable hud.
  48. #==============================================================================#
  49. class Window_Var_Hud < Window_Base

  50.   def initialize
  51.     # // Method to initialize the var hud window.
  52.     super(0, 0, window_width, fitting_height(XAIL::VAR_HUD::VAR_LIST.size))
  53.     refresh
  54.   end

  55.   def window_width
  56.     # // Method to return the width.
  57.     return XAIL::VAR_HUD::HUD[0]
  58.   end

  59.   def draw_var(var, unit, x, y, width)
  60.     # // Method to draw a variable with the content.
  61.     value = "#{$game_variables[var]}#{XAIL::VAR_HUD::SYMBOL}"
  62.     contents.font = Font.new(XAIL::VAR_HUD::FONT[0], XAIL::VAR_HUD::FONT[1])
  63.     contents.font.color = XAIL::VAR_HUD::FONT[2]
  64.     contents.font.bold = XAIL::VAR_HUD::FONT[3]
  65.     contents.font.shadow = XAIL::VAR_HUD::FONT[4]
  66.     draw_text(x, y, width - 60, line_height, value, 2)
  67.     draw_text(x, y, width - 18, line_height, unit, 2) unless unit.nil?
  68.     reset_font_settings
  69.   end

  70.   def refresh
  71.     # // Method to refresh the variable hud.
  72.     contents.clear
  73.     draw_var_hud
  74.   end

  75.   def draw_var_hud
  76.     # // Method to draw the var hud.
  77.     y = 0
  78.     @vars = {}
  79.     for i in XAIL::VAR_HUD::VAR_LIST
  80.       x = i[1].nil? ? 32 : -10
  81.       draw_var(i[0], i[1], x, y, contents.width - 8)
  82.       draw_icon(i[2], 210, y - 2) unless i[2].nil?
  83.       y += XAIL::VAR_HUD::SPACING
  84.       @vars[i[0]] = $game_variables[i[0]]
  85.     end
  86.   end

  87.   def update
  88.     # // Method to update the variable hud if a value has been changed.
  89.     super
  90.     for i in XAIL::VAR_HUD::VAR_LIST
  91.       refresh if($game_variables[i[0]] != @vars[i[0]])
  92.     end
  93.   end

  94. end
  95. #==============================================================================
  96. # ** Scene_Map
  97. #------------------------------------------------------------------------------
  98. #  Show variable hud on the map.
  99. #==============================================================================
  100. class Scene_Map < Scene_Base

  101.   alias xail_var_hud_window_start start
  102.   def start(*args, &block)
  103.     # // Method to start the var hud window on the map.
  104.     xail_var_hud_window_start(*args, &block)
  105.     create_var_hud_window
  106.     @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  107.   end

  108.   alias xail_var_hud_window_terminate terminate
  109.   def terminate(*args, &block)
  110.     # // Method to terminate the var hud window on the map.
  111.     xail_var_hud_window_terminate(*args, &block)
  112.   end

  113.   def create_var_hud_window
  114.     # // Method to create the variable window.
  115.     @var_hud_window = Window_Var_Hud.new
  116.     @var_hud_window.x = XAIL::VAR_HUD::HUD[1]
  117.     @var_hud_window.y = XAIL::VAR_HUD::HUD[2]
  118.     @var_hud_window.z = XAIL::VAR_HUD::HUD[3]
  119.     @var_hud_window.opacity = XAIL::VAR_HUD::HUD[4]
  120.     @var_hud_window.windowskin = Cache.system(XAIL::VAR_HUD::HUD[5]) unless XAIL::VAR_HUD::HUD[5].nil?
  121.   end

  122.   alias xail_var_hud_window_update update
  123.   def update(*args, &block)
  124.     # // Method to update the var hud window on the map.
  125.     xail_var_hud_window_update(*args, &block)
  126.     @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  127.   end

  128. end # END OF FILE

  129. #=*==========================================================================*=#
  130. # ** END OF FILE
  131. #=*==========================================================================*=#
复制代码
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部