查看: 2656|回复: 4

[已经解决] 有没有那种关于饱食度的脚本?

[复制链接]
梦石
0
星屑
1007
在线时间
211 小时
注册时间
2017-8-16
回帖
7
发表于 2021-8-19 20:33:29 | 显示全部楼层 |阅读模式
悬赏100星屑已解决
有没有那种关于饱食度的脚本?
想要的是像谜托邦那样可以只靠食物(道具)来提升角色属性的效果

队伍里的每个角色都有自己的饱食度条,经过一次战斗或移动一定的步数后每个人的饱食度会自然减少
可以在道具那备注一次回复多少饱食度,饱食度超过上限时无法继续进食

最好是可以单独设定每个角色的饱食度上限以及消耗速度的那种
梦石
1
星屑
14373
在线时间
2109 小时
注册时间
2017-9-28
回帖
607
发表于 2021-8-19 20:33:30 | 显示全部楼层
脚本1
  1. #==============================================================================
  2. # Bravo 饥饿/口渴/睡眠(疲劳) 系统
  3. #------------------------------------------------------------------------------
  4. # Author: Bravo2Kilo
  5. # Version: 1.1
  6. #
  7. # Version History:
  8. #   v1.0 = Initial Release
  9. #   v1.1 = New Features and Bug Fixes
  10. #==============================================================================
  11. # 注意
  12. #   All of the stat decreases stack.
  13. #   在下面的脚本中,如果“角色”为0,则代表全部队员.
  14. #==============================================================================
  15. # 增减角色饥饿值的脚本:
  16. #   change_hunger(角色, 数值)
  17. #
  18. # 增减角色口渴值的脚本:
  19. #   change_thirst(角色, 数值)
  20. #
  21. # 增减角色疲劳值的脚本:
  22. #   change_sleep(角色, 数值)
  23. #
  24. # 设定最大饥饿值的角色备注:
  25. #   <hungermax: x>
  26. #
  27. # 设定最大口渴值的角色备注:
  28. #   <thirstmax: x>
  29. #
  30. # 设定最大疲劳值的角色备注:
  31. #   <sleepmax: x>
  32. #
  33. # 使用以后,目标可以增减饥饿值的技能/物品备注 :
  34. #   <hunger: x>
  35. #
  36. # 使用以后,目标可以增减口渴值的技能/物品备注 :
  37. #   <thirst: x>
  38. #
  39. # 使用以后,目标可以增减疲劳值的技能/物品备注 :
  40. #   <sleep: x>
  41. #
  42. # 使用以后,自身可以增减饥饿值的技能/物品备注 :
  43. #   <user-hunger: x>
  44. #
  45. # 使用以后,自身可以增减口渴值的技能/物品备注 :
  46. #   <user-thirst: x>
  47. #
  48. # 使用以后,自身可以增减疲劳值的技能/物品备注 :
  49. #   <user-sleep: x>
  50. #
  51. #==============================================================================
  52. module BRAVO_HTS
  53.   # 饥饿、口渴、疲劳的名称
  54.   HTS_NAMES = ["饥饿", "口渴", "疲劳"]
  55.   # 是否启用任意一个系统
  56.   # 顺序为饥饿、口渴、疲劳
  57.   HTS_USE = [true, true, true]
  58.   # 各值到达最大时,角色是否会死亡
  59.   # 顺序为饥饿、口渴、疲劳
  60.   HTS_DIE_MAX = [true, true, true]
  61.   # 各值的最大值
  62.   # 顺序为饥饿、口渴、疲劳
  63.   HTS_MAX = [100, 100, 100]
  64.   # 玩家每走一步,各值减少的数量.
  65.   # 顺序为饥饿、口渴、疲劳
  66.   HTS_INCREASE = [1, 1, 1]
  67.   # 各值到达该数值时,玩家无法冲刺.
  68.   # 顺序为饥饿、口渴、疲劳
  69.   DISABLE_DASH = [50, 50, 50]
  70.   # 队长各值到达该数值时,玩家无法冲刺.
  71.   # 还是队伍中任意一位队员各值到达该数值时,玩家无法冲刺.
  72.   # 前者设定为 ":leader" ,后者为 ":party"
  73.   DIASBLE_DASH_METHOD = :leader
  74.   # 饥饿值到达一定数值时,能力值下降.
  75.   HUNGER_STAT_DECREASE = {
  76.   # :能力值 => [下降比率, 要求饥饿值下降到该值时生效]
  77.     :attack => [20, 50],
  78.     :defense => [20, 50],
  79.     :mattack => [20, 50],
  80.     :mdefense => [20, 50],
  81.     :agility => [20, 50],
  82.   }# Don't Touch This
  83.   # 口渴值到达一定数值时,能力值下降.
  84.   THIRST_STAT_DECREASE = {
  85.   # :能力值 => [下降比率, 要求口渴值下降到该值时生效]
  86.     :attack => [20, 50],
  87.     :defense => [20, 50],
  88.     :mattack => [20, 50],
  89.     :mdefense => [20, 50],
  90.     :agility => [20, 50],
  91.   }# Don't Touch This
  92.   # 疲劳值到达一定数值时,能力值下降.
  93.   SLEEP_STAT_DECREASE = {
  94.   # :能力值 => [下降比率, 要求疲劳值下降到该值时生效]
  95.     :attack => [20, 50],
  96.     :defense => [20, 50],
  97.     :mattack => [20, 50],
  98.     :mdefense => [20, 50],
  99.     :agility => [20, 50],
  100.   }# Don't Touch This
  101.   # 此开关开启时,显示HUD.
  102.   HTS_HUD_SWITCH = 1
  103.   # HUD的x坐标偏移.
  104.   HTS_HUD_X = 0
  105.   # HUD的y坐标偏移.
  106.   HTS_HUD_Y = 0
  107.   # HUD图片文件名,不显示HUD图片时留空就好.
  108.   HTS_HUD_BACK = ""
  109.   # HUD窗口不透明度.
  110.   HTS_HUD_OPACITY = 255
  111. #==============================================================================
  112. # End of Configuration
  113. #==============================================================================
  114. end
  115. $imported ||= {}
  116. $imported[:Bravo_HTS] = true

  117. #==============================================================================
  118. # ** RPG Actor
  119. #==============================================================================

  120. class RPG::Actor < RPG::BaseItem
  121.   #--------------------------------------------------------------------------
  122.   # * Hunger Max
  123.   #--------------------------------------------------------------------------
  124.   def hunger_max
  125.     if @note =~ /<hungermax: (.*)>/i
  126.       return $1.to_i
  127.     else
  128.       return BRAVO_HTS::HTS_MAX[0]
  129.     end
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # * Thirst Max
  133.   #--------------------------------------------------------------------------
  134.   def thirst_max
  135.     if @note =~ /<thirstmax: (.*)>/i
  136.       return $1.to_i
  137.     else
  138.       return BRAVO_HTS::HTS_MAX[1]
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # * Sleep Max
  143.   #--------------------------------------------------------------------------
  144.   def sleep_max
  145.     if @note =~ /<sleepmax: (.*)>/i
  146.       return $1.to_i
  147.     else
  148.       return BRAVO_HTS::HTS_MAX[2]
  149.     end
  150.   end
  151. end

  152. #==============================================================================
  153. # ** RPG UsableItem
  154. #==============================================================================

  155. class RPG::UsableItem < RPG::BaseItem
  156.   #--------------------------------------------------------------------------
  157.   # * User Hunger
  158.   #--------------------------------------------------------------------------
  159.   def user_hunger
  160.     if @note =~ /<user-hunger: (.*)>/i
  161.       return $1.to_i
  162.     else
  163.       return 0
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # * User Thirst
  168.   #--------------------------------------------------------------------------
  169.   def user_thirst
  170.     if @note =~ /<user-thirst: (.*)>/i
  171.       return $1.to_i
  172.     else
  173.       return 0
  174.     end
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # * User Sleep
  178.   #--------------------------------------------------------------------------
  179.   def user_sleep
  180.     if @note =~ /<user-sleep: (.*)>/i
  181.       return $1.to_i
  182.     else
  183.       return 0
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # * Hunger
  188.   #--------------------------------------------------------------------------
  189.   def hunger
  190.     if @note =~ /<hunger: (.*)>/i
  191.       return $1.to_i
  192.     else
  193.       return 0
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # * Thirst
  198.   #--------------------------------------------------------------------------
  199.   def thirst
  200.     if @note =~ /<thirst: (.*)>/i
  201.       return $1.to_i
  202.     else
  203.       return 0
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # * Sleep
  208.   #--------------------------------------------------------------------------
  209.   def sleep
  210.     if @note =~ /<sleep: (.*)>/i
  211.       return $1.to_i
  212.     else
  213.       return 0
  214.     end
  215.   end
  216. end

  217. #==============================================================================
  218. # ** Game_Actor
  219. #==============================================================================

  220. class Game_Actor < Game_Battler
  221.   #--------------------------------------------------------------------------
  222.   # * Public Instance Variables
  223.   #--------------------------------------------------------------------------
  224.   attr_accessor :hunger
  225.   attr_accessor :hunger_max
  226.   attr_accessor :thirst
  227.   attr_accessor :thirst_max
  228.   attr_accessor :sleep
  229.   attr_accessor :sleep_max
  230.   #--------------------------------------------------------------------------
  231.   # * Setup
  232.   #--------------------------------------------------------------------------
  233.   alias bravo_hts_setup setup
  234.   def setup(actor_id)
  235.     bravo_hts_setup(actor_id)
  236.     @hunger = 0
  237.     @hunger_max = actor.hunger_max
  238.     @thirst = 0
  239.     @thirst_max = actor.thirst_max
  240.     @sleep = 0
  241.     @sleep_max = actor.sleep_max
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Check Death
  245.   #--------------------------------------------------------------------------
  246.   def check_death
  247.     if @hunger > @hunger_max
  248.       @hunger = @hunger_max
  249.     elsif @hunger < 0
  250.       @hunger = 0
  251.     end
  252.     if @thirst > @thirst_max
  253.       @thirst = @thirst_max
  254.     elsif @thirst < 0
  255.       @thirst = 0
  256.     end
  257.     if @sleep > @sleep_max
  258.       @sleep = @sleep_max
  259.     elsif @sleep < 0
  260.       @sleep = 0
  261.     end
  262.     if @hunger >= @hunger_max && BRAVO_HTS::HTS_DIE_MAX[0] == true
  263.       self.hp = 0
  264.     elsif @thirst >= @thirst_max && BRAVO_HTS::HTS_DIE_MAX[1] == true
  265.       self.hp = 0
  266.     elsif @sleep >= @sleep_max && BRAVO_HTS::HTS_DIE_MAX[2] == true
  267.       self.hp = 0
  268.     end
  269.     SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # * Use Skill/Item
  273.   #    Called for the acting side and applies the effect to other than the user.
  274.   #--------------------------------------------------------------------------
  275.   def use_item(item)
  276.     super(item)
  277.     @hunger += item.user_hunger if BRAVO_HTS::HTS_USE[0] == true
  278.     @thirst += item.user_thirst if BRAVO_HTS::HTS_USE[1] == true
  279.     @sleep += item.user_sleep if BRAVO_HTS::HTS_USE[2] == true
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # * Apply Effect of Skill/Item
  283.   #--------------------------------------------------------------------------
  284.   def item_apply(user, item)
  285.     super(user, item)
  286.     @hunger += item.hunger if BRAVO_HTS::HTS_USE[0] == true
  287.     @thirst += item.thirst if BRAVO_HTS::HTS_USE[1] == true
  288.     @sleep += item.sleep if BRAVO_HTS::HTS_USE[2] == true
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # * Get Parameter
  292.   #--------------------------------------------------------------------------
  293.   def param(param_id)
  294.     value = param_base(param_id) + param_plus(param_id)
  295.     value *= param_rate(param_id) * param_buff_rate(param_id)
  296.     case param_id
  297.     when 2 # Attack Parameter
  298.       if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[0] == true
  299.         hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:attack][0] * 0.01)
  300.         value = value - hunger
  301.       end
  302.       if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[1] == true
  303.         thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:attack][0] * 0.01)
  304.         value = value - thirst
  305.       end
  306.       if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:attack][1] && BRAVO_HTS::HTS_USE[2] == true
  307.         sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:attack][0] * 0.01)
  308.         value = value - sleep
  309.       end
  310.     when 3 # Defense Parameter
  311.       if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[0] == true
  312.         hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:defense][0] * 0.01)
  313.         value = value - hunger
  314.       end
  315.       if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[1] == true
  316.         thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:defense][0] * 0.01)
  317.         value = value - thirst
  318.       end
  319.       if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:defense][1] && BRAVO_HTS::HTS_USE[2] == true
  320.         sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:defense][0] * 0.01)
  321.         value = value - sleep
  322.       end
  323.     when 4 # Magic Attack Parameter
  324.       if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[0] == true
  325.         hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:mattack][0] * 0.01)
  326.         value = value - hunger
  327.       end
  328.       if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[1] == true
  329.         thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:mattack][0] * 0.01)
  330.         value = value - thirst
  331.       end
  332.       if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:mattack][1] && BRAVO_HTS::HTS_USE[2] == true
  333.         sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:mattack][0] * 0.01)
  334.         value = value - sleep
  335.       end
  336.     when 5 # Magic Defense Parameter
  337.       if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[0] == true
  338.         hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:mdefense][0] * 0.01)
  339.         value = value - hunger
  340.       end
  341.       if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[1] == true
  342.         thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:mdefense][0] * 0.01)
  343.         value = value - thirst
  344.       end
  345.       if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:mdefense][1] && BRAVO_HTS::HTS_USE[2] == true
  346.         sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:mdefense][0] * 0.01)
  347.         value = value - sleep
  348.       end
  349.     when 6 # Agility Parameter
  350.       if @hunger >= BRAVO_HTS::HUNGER_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[0] == true
  351.         hunger = value * (BRAVO_HTS::HUNGER_STAT_DECREASE[:agility][0] * 0.01)
  352.         value = value - hunger
  353.       end
  354.       if @thirst >= BRAVO_HTS::THIRST_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[1] == true
  355.         thirst = value * (BRAVO_HTS::THIRST_STAT_DECREASE[:agility][0] * 0.01)
  356.         value = value - thirst
  357.       end
  358.       if @sleep >= BRAVO_HTS::SLEEP_STAT_DECREASE[:agility][1] && BRAVO_HTS::HTS_USE[2] == true
  359.         sleep = value * (BRAVO_HTS::SLEEP_STAT_DECREASE[:agility][0] * 0.01)
  360.         value = value - sleep
  361.       end
  362.     end
  363.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # * Hunger Rate
  367.   #--------------------------------------------------------------------------
  368.   def hunger_rate
  369.     @hunger.to_f / @hunger_max
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # * Thirst Rate
  373.   #--------------------------------------------------------------------------
  374.   def thirst_rate
  375.     @thirst.to_f / @thirst_max
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # * Sleep Rate
  379.   #--------------------------------------------------------------------------
  380.   def sleep_rate
  381.     @sleep.to_f / @sleep_max
  382.   end
  383. end

  384. #==============================================================================
  385. # ** Game_Party
  386. #==============================================================================

  387. class Game_Party < Game_Unit
  388.   #--------------------------------------------------------------------------
  389.   # * Increase Steps
  390.   #--------------------------------------------------------------------------
  391.   alias bravo_hts_increase_steps increase_steps
  392.   def increase_steps
  393.     bravo_hts_increase_steps
  394.     members.each do |actor|
  395.       actor.hunger += BRAVO_HTS::HTS_INCREASE[0] if BRAVO_HTS::HTS_USE[0] == true
  396.       actor.thirst += BRAVO_HTS::HTS_INCREASE[1] if BRAVO_HTS::HTS_USE[1] == true
  397.       actor.sleep += BRAVO_HTS::HTS_INCREASE[2] if BRAVO_HTS::HTS_USE[2] == true
  398.       actor.check_death
  399.     end
  400.   end
  401. end

  402. #==============================================================================
  403. # ** Game_Player
  404. #==============================================================================

  405. class Game_Player < Game_Character
  406.   #--------------------------------------------------------------------------
  407.   # * Determine if Dashing
  408.   #--------------------------------------------------------------------------
  409.   alias bravo_hts_dash? dash?
  410.   def dash?
  411.     if BRAVO_HTS::DIASBLE_DASH_METHOD == :leader
  412.       return false if $game_party.leader.hunger >= BRAVO_HTS::DISABLE_DASH[0]
  413.       return false if $game_party.leader.thirst >= BRAVO_HTS::DISABLE_DASH[1]
  414.       return false if $game_party.leader.sleep >= BRAVO_HTS::DISABLE_DASH[2]
  415.     elsif BRAVO_HTS::DIASBLE_DASH_METHOD == :party
  416.       $game_party.members.each do |actor|
  417.         return false if actor.hunger >= BRAVO_HTS::DISABLE_DASH[0]
  418.         return false if actor.thirst >= BRAVO_HTS::DISABLE_DASH[1]
  419.         return false if actor.sleep >= BRAVO_HTS::DISABLE_DASH[2]
  420.       end
  421.     end
  422.     bravo_hts_dash?
  423.   end
  424. end

  425. #==============================================================================
  426. # ** Game_Interpreter
  427. #==============================================================================

  428. class Game_Interpreter
  429.   #--------------------------------------------------------------------------
  430.   # * Change Hunger
  431.   #--------------------------------------------------------------------------
  432.   def change_hunger(actor, amount)
  433.     if actor == 0
  434.       $game_party.members.each do |actor|
  435.         actor.hunger += amount
  436.         actor.check_death
  437.       end
  438.     else
  439.       $game_actors[actor].hunger += amount
  440.       $game_actors[actor].check_death
  441.     end
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # * Change Thirst
  445.   #--------------------------------------------------------------------------
  446.   def change_thirst(actor, amount)
  447.     if actor == 0
  448.       $game_party.members.each do |actor|
  449.         actor.thirst += amount
  450.         actor.check_death
  451.       end
  452.     else
  453.       $game_actors[actor].thirst += amount
  454.       $game_actors[actor].check_death
  455.     end
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # * Change Sleep
  459.   #--------------------------------------------------------------------------
  460.   def change_sleep(actor, amount)
  461.     if actor == 0
  462.       $game_party.members.each do |actor|
  463.         actor.sleep += amount
  464.         actor.check_death
  465.       end
  466.     else
  467.       $game_actors[actor].sleep += amount
  468.       $game_actors[actor].check_death
  469.     end
  470.   end
  471. #~   #--------------------------------------------------------------------------
  472. #~   # * Change Sleep
  473. #~   #--------------------------------------------------------------------------
  474. #~   def change_sleep(param1, param2, param3, param4, param5)
  475. #~     value = operate_value(param3, param4, param5)
  476. #~     iterate_actor_var(param1, param2) do |actor|
  477. #~       actor.sleep += value
  478. #~       actor.check_death
  479. #~     end
  480. #~   end
  481. end

  482. #==============================================================================
  483. # ** Window_Base
  484. #==============================================================================

  485. class Window_Base < Window
  486.   #--------------------------------------------------------------------------
  487.   # * Draw Hunger
  488.   #--------------------------------------------------------------------------
  489.   def draw_actor_hunger(actor, x, y, width = 124)
  490.     draw_gauge(x, y, width, actor.hunger_rate, hp_gauge_color1, hp_gauge_color2)
  491.     change_color(system_color)
  492.     draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[0])
  493.     draw_current_and_max_values(x, y, width, actor.hunger, actor.hunger_max,
  494.     normal_color, normal_color)
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # * Draw Thirst
  498.   #--------------------------------------------------------------------------
  499.   def draw_actor_thirst(actor, x, y, width = 124)
  500.     draw_gauge(x, y, width, actor.thirst_rate, hp_gauge_color1, hp_gauge_color2)
  501.     change_color(system_color)
  502.     draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[1])
  503.     draw_current_and_max_values(x, y, width, actor.thirst, actor.thirst_max,
  504.     normal_color, normal_color)
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # * Draw Sleep
  508.   #--------------------------------------------------------------------------
  509.   def draw_actor_sleep(actor, x, y, width = 124)
  510.     draw_gauge(x, y, width, actor.sleep_rate, hp_gauge_color1, hp_gauge_color2)
  511.     change_color(system_color)
  512.     draw_text(x-17, y, 124, line_height, BRAVO_HTS::HTS_NAMES[2])
  513.     draw_current_and_max_values(x, y, width, actor.sleep, actor.sleep_max,
  514.     normal_color, normal_color)
  515.   end
  516. end

  517. #==============================================================================
  518. # ** Window_Status
  519. #==============================================================================

  520. class Window_Status < Window_Selectable
  521.   #--------------------------------------------------------------------------
  522.   # * Public Instance Variables
  523.   #--------------------------------------------------------------------------
  524.   attr_accessor :info
  525.   #--------------------------------------------------------------------------
  526.   # * Object Initialization
  527.   #--------------------------------------------------------------------------
  528.   alias bravo_hts_initialize initialize
  529.   def initialize(actor)
  530.     bravo_hts_initialize(actor)
  531.     @info = 0
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Draw Block 2
  535.   #--------------------------------------------------------------------------
  536.   def draw_block2(y)
  537.     draw_actor_face(@actor, 8, y)
  538.     draw_basic_info(136, y)
  539.     if @info == 1
  540.       draw_hts_info(304, y)
  541.     else
  542.       draw_exp_info(304, y)
  543.     end
  544.     draw_press_shift(0, y - line_height)
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # * Draw HTS Information
  548.   #--------------------------------------------------------------------------
  549.   def draw_hts_info(x, y)
  550.     draw_actor_hunger(@actor, x+17, y) if BRAVO_HTS::HTS_USE[0] == true
  551.     if BRAVO_HTS::HTS_USE[0] == false
  552.       draw_actor_thirst(@actor, x+17, y) if BRAVO_HTS::HTS_USE[1] == true
  553.     else
  554.       draw_actor_thirst(@actor, x+17, y+line_height) if BRAVO_HTS::HTS_USE[1] == true
  555.     end
  556.     if BRAVO_HTS::HTS_USE[0] == false || BRAVO_HTS::HTS_USE[1] == false
  557.       draw_actor_sleep(@actor, x+17, y+line_height) if BRAVO_HTS::HTS_USE[2] == true
  558.     else
  559.       draw_actor_sleep(@actor, x+17, y+line_height*2) if BRAVO_HTS::HTS_USE[2] == true
  560.     end
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   # * Draw Press Shift
  564.   #--------------------------------------------------------------------------
  565.   def draw_press_shift(x, y)
  566.     text = "按SHIFT键查看饥饿、口渴和疲劳信息."
  567.     draw_text(x, y, 520, line_height, text, 2)
  568.   end
  569. end

  570. #==============================================================================
  571. # ** Window_HTS
  572. #==============================================================================

  573. class Window_HTS < Window_Base
  574.   #--------------------------------------------------------------------------
  575.   # * Object Initialization
  576.   #--------------------------------------------------------------------------
  577.   def initialize(x, y)
  578.     super(x, y, 165, window_height)
  579.     self.opacity = BRAVO_HTS::HTS_HUD_OPACITY
  580.     refresh
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # * Get Window Width
  584.   #--------------------------------------------------------------------------
  585.   def window_height
  586.     n = 0
  587.     if BRAVO_HTS::HTS_USE[0] == true
  588.       n += 1
  589.     end
  590.     if BRAVO_HTS::HTS_USE[1] == true
  591.       n += 1
  592.     end
  593.     if BRAVO_HTS::HTS_USE[2] == true
  594.       n += 1
  595.     end
  596.     return fitting_height(n)
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # * Refresh
  600.   #--------------------------------------------------------------------------
  601.   def refresh
  602.     contents.clear
  603.     actor = $game_party.leader
  604.     draw_actor_hunger(actor, 17, 0) if BRAVO_HTS::HTS_USE[0] == true
  605.     if BRAVO_HTS::HTS_USE[0] == false
  606.       draw_actor_thirst(actor, 17, 0) if BRAVO_HTS::HTS_USE[1] == true
  607.     else
  608.       draw_actor_thirst(actor, 17, line_height) if BRAVO_HTS::HTS_USE[1] == true
  609.     end
  610.     if BRAVO_HTS::HTS_USE[0] == false || BRAVO_HTS::HTS_USE[1] == false
  611.       draw_actor_sleep(actor, 17, line_height) if BRAVO_HTS::HTS_USE[2] == true
  612.     else
  613.       draw_actor_sleep(actor, 17, line_height*2) if BRAVO_HTS::HTS_USE[2] == true
  614.     end
  615.   end
  616. end

  617. #==============================================================================
  618. # ** Scene_Map
  619. #==============================================================================

  620. class Scene_Map < Scene_Base
  621.   #--------------------------------------------------------------------------
  622.   # * Termination Processing
  623.   #--------------------------------------------------------------------------
  624.   alias bravo_hts_terminate terminate
  625.   def terminate
  626.     if BRAVO_HTS::HTS_HUD_BACK != ""
  627.       @hts_view.dispose
  628.     end
  629.     bravo_hts_terminate
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # * Frame Update
  633.   #--------------------------------------------------------------------------
  634.   alias bravo_hts_update update
  635.   def update
  636.     bravo_hts_update
  637.     if $game_switches[BRAVO_HTS::HTS_HUD_SWITCH] == true
  638.       @hts_window.show
  639.       if BRAVO_HTS::HTS_HUD_BACK != ""
  640.         @hts_hud.visible = true
  641.       end
  642.       @hts_window.refresh
  643.     else
  644.       @hts_window.hide
  645.       if BRAVO_HTS::HTS_HUD_BACK != ""
  646.         @hts_hud.visible = false
  647.       end
  648.     end
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # * Create All Windows
  652.   #--------------------------------------------------------------------------
  653.   alias bravo_hts_create_all_windows create_all_windows
  654.   def create_all_windows
  655.     bravo_hts_create_all_windows
  656.     @hts_window = Window_HTS.new(BRAVO_HTS::HTS_HUD_X, BRAVO_HTS::HTS_HUD_Y)
  657.     @hts_window.hide
  658.     if BRAVO_HTS::HTS_HUD_BACK != ""
  659.       @hts_hud = Sprite.new
  660.       @hts_hud.bitmap = Cache.system(BRAVO_HTS::HTS_HUD_BACK)
  661.       @hts_hud.x = BRAVO_HTS::HTS_HUD_X
  662.       @hts_hud.y = BRAVO_HTS::HTS_HUD_Y
  663.       @hts_hud.visible = false
  664.     end
  665.   end
  666. end

  667. #==============================================================================
  668. # ** Scene_Status
  669. #==============================================================================

  670. class Scene_Status < Scene_MenuBase
  671.   #--------------------------------------------------------------------------
  672.   # * Frame Update
  673.   #--------------------------------------------------------------------------
  674.   def update
  675.     super
  676.     if Input.trigger?(:SHIFT)
  677.       if @status_window.info == 0
  678.         @status_window.info = 1
  679.       elsif @status_window.info == 1
  680.         @status_window.info = 0
  681.       end
  682.       @status_window.refresh
  683.     end
  684.   end
  685. end

  686. #==============================================================================
  687. # ** Scene_Battle
  688. #==============================================================================

  689. class Scene_Battle < Scene_Base
  690.   #--------------------------------------------------------------------------
  691.   # * Processing at End of Action
  692.   #--------------------------------------------------------------------------
  693.   alias bravo_hts_process_action_end process_action_end
  694.   def process_action_end
  695.     if @subject.is_a?(Game_Actor)
  696.       @subject.check_death
  697.     end
  698.     bravo_hts_process_action_end
  699.   end
  700. end
复制代码


脚本2
  1. # )--------------------------------------------------(
  2. # )--     Author:     Mr Trivel                    --(
  3. # )--     Name:       饥渴系统                     --(
  4. # )--     Created:    2014-06-08                   --(
  5. # )--     Version:    1.1                          --(
  6. # )--------------------------------------------------(
  7. # )-- v1.1 - Negative Quench values can now be used--(
  8. # )--        to make the person more thirsty.      --(
  9. # )--------------------------------------------------(
  10. # )--     Requires:   None                         --(
  11. # )--------------------------------------------------(
  12. # )--                   说明                      --(
  13. # )--  角色会感到饥渴! 饥渴度= 0 时会开始失去hp     --(
  14. # )--------------------------------------------------(
  15. # )--             使用方法                   --(
  16. # )--  使用物品备注: <Quench: X>  (该物品必须可消耗)   --(
  17. # )--  可以恢复 X% 的饥渴值.           --(
  18. # )--------------------------------------------------(
  19. # )--  Thanks to TheoAllen for helping with item   --(
  20. # )--  targets.                                    --(
  21. # )--------------------------------------------------(
  22. # )--             LICENSE INFO                     --(
  23. # )--http://mrtrivelvx.wordpress.com/terms-of-use/ --(
  24. # )--------------------------------------------------(

  25. module MrTS
  26.   module Thirst
  27.     LEVELS = {
  28.     # )--------------------------------------------------(
  29.     # )--  在菜单中显示的饥渴程度文字    --(
  30.     # )--  如果饥渴值 >= X, 则会显示该等级的文字--(
  31.     # )--  X - 0..100                                  --(
  32.     # )--------------------------------------------------(
  33.     # )--     X  => "文本"                             --(
  34.     # )--------------------------------------------------(
  35.               65 => "不渴",
  36.               30 => "口渴",
  37.               1  => "脱水",
  38.               0  => "渴死"
  39.     # )--------------------------------------------------(
  40.              }
  41.     # )--------------------------------------------------(
  42.     # )--  角色初始饥渴值.   --(
  43.     # )--  默认: 70, 代表角色一开始的饥渴度为 70%  . --(
  44.     # )--------------------------------------------------(
  45.     DEFAULT_THIRST = 70
  46.    
  47.     # )--------------------------------------------------(
  48.     # )--  每回合失去多少饥渴度.          --(
  49.     # )--------------------------------------------------(
  50.     LOSE_THIRST_PER = 7
  51.    
  52.     # )--------------------------------------------------(
  53.     # )--  如果角色饥渴度=0,饥渴度再次减少时,会失去多少hp.        --(
  54.     # )--------------------------------------------------(
  55.     THIRST_DAMAGE = 25
  56.   end
  57. end

  58. # )--------------------------------------------------(
  59. $imported = {} if $imported.nil?  #                --(
  60. $imported["MrTS_Thirst"] = true   #                --(
  61. # )--------------------------------------------------(

  62. # )----------------------------------------(
  63. # )--  Class: Game_Actor < Game_Battler  --(
  64. # )----------------------------------------(
  65. class Game_Actor < Game_Battler
  66.   
  67.   # )-------------------------------(
  68.   # )--  Public access variables  --(
  69.   # )-------------------------------(
  70.   attr_accessor     :thirst
  71.   
  72.   # )-----------------------(
  73.   # )--  Alias to: setup  --(
  74.   # )-----------------------(
  75.   alias mrts_ga_setup setup
  76.   def setup(*args)
  77.     mrts_ga_setup(*args)
  78.     @thirst = MrTS::Thirst::DEFAULT_THIRST
  79.   end
  80.   
  81.   # )------------------------------------(
  82.   # )--  New Method: get_thirst_level  --(
  83.   # )------------------------------------(
  84.   def get_thirst_level
  85.     MrTS::Thirst::LEVELS.each do |val, txt|
  86.       if @thirst >= val
  87.         return txt
  88.       end
  89.     end
  90.     return ""
  91.   end
  92.   
  93.   # )-------------------------------(
  94.   # )--  New Method: lose_thirst  --(
  95.   # )-------------------------------(
  96.   def lose_thirst
  97.     if @thirst >= 1
  98.       @thirst -= 1
  99.     elsif @thirst <= 0
  100.       self.hp -= MrTS::Thirst::THIRST_DAMAGE
  101.     end
  102.   end
  103.   
  104.   # )----------------------------(
  105.   # )--  Alias to: item_apply  --(
  106.   # )----------------------------(
  107.   alias mrts_item_apply item_apply
  108.   def item_apply(user, item)
  109.     mrts_item_apply(user, item)
  110.     item.note[/<[q-qQ-Q]uench:\s*(-*\d*)>/]
  111.     if $1
  112.       self.thirst += $1.to_i
  113.       self.thirst = 100 if self.thirst > 100
  114.       self.thirst = 0 if self.thirst < 0
  115.     end
  116.   end
  117.   
  118.   # )-----------------------------------(
  119.   # )--  Overwrite Method: item_test  --(
  120.   # )-----------------------------------(
  121.   def item_test(user, item)
  122.     item.note[/<[q-qQ-Q]uench:\s*(-*\d*)>/]

  123.     return false if item.for_dead_friend? != dead?
  124.     return true if $game_party.in_battle
  125.     return true if item.for_opponent?
  126.     return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
  127.     return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
  128.     return true if item_has_any_valid_effects?(user, item)
  129.     return true if $1
  130.    
  131.     return false
  132.   end
  133.   
  134. end

  135. # )----------------------------------------------------(
  136. # )--  Class: Window_MenuStatus < Window_Selectable  --(
  137. # )----------------------------------------------------(
  138. class Window_MenuStatus < Window_Selectable
  139.   
  140.   # )-----------------------------------(
  141.   # )--  Overwrite Method: draw_item  --(
  142.   # )-----------------------------------(
  143.   def draw_item(index)
  144.     actor = $game_party.members[index]
  145.     enabled = $game_party.battle_members.include?(actor)
  146.     rect = item_rect(index)
  147.     rect.y -= line_height/2
  148.     draw_item_background(index)
  149.     draw_actor_face(actor, rect.x + 1, rect.y + 1 + line_height/2, enabled)
  150.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  151.     draw_thirst_gauge(actor, rect.x + 108 + 120, rect.y + line_height * 3 + line_height/2)
  152.   end
  153. end

  154. # )--------------------------(
  155. # )--  Class: Window_Base  --(
  156. # )--------------------------(
  157. class Window_Base
  158.   
  159.   # )-------------------------------------(
  160.   # )--  New Method: draw_thirst_gauge  --(
  161.   # )-------------------------------------(
  162.   def draw_thirst_gauge(actor, x, y, width=124, height=line_height)
  163.     draw_gauge(x, y, width, actor.thirst.to_f/100.0, text_color(16), text_color(23) )
  164.     draw_text(x, y, width, line_height, actor.get_thirst_level)
  165.   end
  166. end

  167. # )-------------------------------------------(
  168. # )--  Class: Game_Player < Game_Character  --(
  169. # )-------------------------------------------(
  170. class Game_Player < Game_Character
  171.   
  172.   # )--------------------------------(
  173.   # )--  Alias to: increase_steps  --(
  174.   # )--------------------------------(
  175.   alias mrts_gp_increase_steps increase_steps
  176.   def increase_steps
  177.     mrts_gp_increase_steps
  178.     if $game_party.steps % MrTS::Thirst::LOSE_THIRST_PER == 0
  179.       $game_party.all_members.each { |actor| actor.lose_thirst }
  180.     end
  181.   end
  182. end
复制代码


脚本3
  1. #-----------------------------------------------------------------
  2. #              饥饿系统  
  3. #              作者:milanda
  4. #              制作时间:18,7,26
  5. #----------------------------------------------------------------
  6. #             物品设置:
  7. #             <解饿:x>
  8. #             x为填充饥饿的数量
  9. #-----------------------------------------------------------------

  10. module Mi
  11.   module Hunger
  12.     #开始游戏时候以这个饥饿值开始
  13.     DEFAULT_HUNGER = 100
  14.    #下面是设置显示词的
  15.     LEVELS = {
  16.              100 => "充实",
  17.               60 => "正常",
  18.               30 => "略饿",
  19.               1  => "很饿",
  20.               0  => "饿死"
  21.              } #不可以删除
  22.     LOSE_HUNGER_PER = 7      #每走x步消耗饥饿值
  23.     HUNGER_DAMAGE = 25       #每走x步所扣的血量
  24.   end
  25. end

  26. #---------------------------------------------
  27. #        开始设置
  28. #---------------------------------------------
  29. $imported = {} if $imported.nil?
  30. $imported["Mi_Jie"] = true   
  31. # ----------------------------------------
  32. # 赋予: Game_Actor < Game_Battler
  33. # ----------------------------------------
  34. class Game_Actor < Game_Battler
  35.   
  36.   # -------------------------------
  37.   #          访问变量  
  38.   # -------------------------------
  39.   attr_accessor     :hunger
  40.   
  41.   # -----------------------
  42.   #  别名: setup  
  43.   # -----------------------
  44.   alias mrts_ga_setup setup
  45.   def setup(*args)
  46.     mrts_ga_setup(*args)
  47.     @hunger = Mi::Hunger::DEFAULT_HUNGER
  48.   end
  49.   
  50.   # ------------------------------------
  51.   #   新方法: get_hunger_level  
  52.   # ------------------------------------
  53.   def get_hunger_level
  54.     Mi::Hunger::LEVELS.each do |val, txt|
  55.       if @hunger >= val
  56.         return txt
  57.       end
  58.     end
  59.     return ""
  60.   end
  61.   
  62.   # -------------------------------
  63.   #  新方法: lose_hunger
  64.   # -------------------------------
  65.   def lose_hunger
  66.     if @hunger >= 1
  67.       @hunger -= 1
  68.     elsif @hunger <= 0
  69.       self.hp -= Mi::Hunger::HUNGER_DAMAGE
  70.     end
  71.   end
  72.   
  73.   # ----------------------------
  74.   #   新方法: item_apply
  75.   # )----------------------------
  76.   alias mrts_item_apply item_apply
  77.   def item_apply(user, item)
  78.     mrts_item_apply(user, item)
  79.     item.note[/<[q-qQ-Q]解饿:\s*(-*\d*)>/]
  80.     if $1
  81.       self.hunger += $1.to_i
  82.       self.hunger = 100 if self.hunger > 100
  83.       self.hunger = 0 if self.hunger < 0
  84.     end
  85.   end
  86.   
  87.   # -----------------------------------
  88.   #   覆盖方式: item_test
  89.   # -----------------------------------
  90.   def item_test(user, item)
  91.     item.note[/<[q-qQ-Q]解饿:\s*(-*\d*)>/]

  92.     return false if item.for_dead_friend? != dead?
  93.     return true if $game_party.in_battle
  94.     return true if item.for_opponent?
  95.     return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
  96.     return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
  97.     return true if item_has_any_valid_effects?(user, item)
  98.     return true if $1
  99.    
  100.     return false
  101.   end
  102.   
  103. end

  104. # ----------------------------------------------------
  105. #   赋予: Window_MenuStatus < Window_Selectable  
  106. # ----------------------------------------------------
  107. class Window_MenuStatus < Window_Selectable
  108.   
  109.   # -----------------------------------
  110.   #   覆盖方法: draw_item  
  111.   # -----------------------------------
  112.   def draw_item(index)
  113.     actor = $game_party.members[index]
  114.     enabled = $game_party.battle_members.include?(actor)
  115.     rect = item_rect(index)
  116.     rect.y -= line_height/2
  117.     draw_item_background(index)
  118.     draw_actor_face(actor, rect.x + 1, rect.y + 1 + line_height/2, enabled)
  119.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  120.     draw_hunger_gauge(actor, rect.x + 108 + 120, rect.y + line_height * 3 + line_height/2)
  121.   end
  122. end

  123. # --------------------------
  124. #   分类: Window_Base  
  125. # --------------------------
  126. class Window_Base
  127.   
  128.   # -------------------------------------
  129.   #   新方法: draw_hunger_gauge  
  130.   # -------------------------------------
  131.   def draw_hunger_gauge(actor, x, y, width=124, height=line_height)
  132.     draw_gauge(x, y, width, actor.hunger.to_f/100.0, text_color(16), text_color(23) )
  133.     draw_text(x, y, width, line_height, actor.get_hunger_level)
  134.   end
  135. end

  136. # -------------------------------------------
  137. #  赋予: Game_Player < Game_Character
  138. # -------------------------------------------
  139. class Game_Player < Game_Character
  140.   
  141.   # --------------------------------
  142.   #  别名: increase_steps
  143.   # --------------------------------
  144.   alias mrts_gp_increase_steps increase_steps
  145.   def increase_steps
  146.     mrts_gp_increase_steps
  147.     if $game_party.steps % Mi::Hunger::LOSE_HUNGER_PER == 0
  148.       $game_party.all_members.each { |actor| actor.lose_hunger }
  149.     end
  150.   end
  151. end
复制代码


评分

参与人数 1星屑 +100 赞 +1 收起 理由
alexncf125 + 100 + 1 搬运辛苦了~

查看全部评分

VA外站脚本汉化群:226308173   |    部分远古文件备份:https://wwzv.lanzoue.com/b02rac5pc  密码:acgm
回复

使用道具 举报

梦石
0
星屑
1007
在线时间
211 小时
注册时间
2017-8-16
回帖
7
 楼主| 发表于 2021-8-20 11:50:07 | 显示全部楼层

谢谢,不过这三个脚本都是生存向的,跟我想要的不太一样。主要是三个脚本都没有进食上限的限制,不吃东西会死,但是却可以无限进食。
要说的话,第一个脚本的那些功能更接近我想要的,不过吃东西倒减数值看起来挺别扭的,也没有关闭debuff的开关
回复

使用道具 举报

梦石
0
星屑
1130
在线时间
138 小时
注册时间
2020-12-6
回帖
27
发表于 2021-8-23 01:16:59 | 显示全部楼层
为什么不用事件变量?
我是的大大,一个做辣鸡游戏的。
回复

使用道具 举报

梦石
0
星屑
34
在线时间
20 小时
注册时间
2021-7-6
回帖
3
发表于 2021-8-25 10:33:32 | 显示全部楼层
https://www.bilibili.com/video/BV17s411K7MS,这个纯事件的,也可以无限进食,还能在地图上显示饱食度

评分

参与人数 1星屑 +10 收起 理由
alexncf125 + 10 塞糖

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部