Advertisement
roninator2

Survival System + KMS Generic Gauge compatibility patch

Dec 6th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.92 KB | None | 0 0
  1. #==============================================================================
  2. # Compatibility Patch :                                         v1.0 (09/10/23)
  3. #   Survival System by Apellonyx + KMS Generic Gauge
  4. #==============================================================================
  5. # Script by:
  6. #     Roninator2
  7. #--------------------------------------------------------------------------
  8. # Place this script below both Survival System by Apellonyx
  9. # and KMS Generic Gauge in your script edtior.
  10. #
  11. # Due to the nature of both scripts, several methods
  12. # in Survival System by Apellonyx were overwritten.
  13. #
  14. # All Generic Gauge images must be placed in the "Graphics/System"
  15. # folder of your project.
  16. #--------------------------------------------------------------------------
  17. #   ++ Changelog ++
  18. #--------------------------------------------------------------------------
  19. # v1.0 : Initial release. (09/10/2023)
  20. #==============================================================================
  21.  
  22. module KMS_GenericGauge
  23.   # * Gauge File Names
  24.   #   Images must be placed in the "Graphics/System" folder of your project
  25.   LIFE_IMAGE  = "GaugeLIFE"   # Life
  26.   FOOD_IMAGE  = "GaugeFOOD"   # Food
  27.   WATER_IMAGE = "GaugeWATER"  # WATER
  28.   REST_IMAGE  = "GaugeREST"   # REST
  29.   TOXIN_IMAGE = "GaugeTOXIN"  # TOXIN
  30.  
  31.   # * Gauge Position Offset [x, y]
  32.   LIFE_OFFSET  = [-23, -2]  # LIFE
  33.   FOOD_OFFSET  = [-23, -2]  # FOOD
  34.   WATER_OFFSET = [-23, -2]  # WATER
  35.   REST_OFFSET  = [-23, -2]  # REST
  36.   TOXIN_OFFSET = [-23, -2]  # TOXIN
  37.  
  38.   # * Gauge Length Adjustment
  39.   LIFE_LENGTH  = -4  # LIFE
  40.   FOOD_LENGTH  = -4  # FOOD
  41.   WATER_LENGTH = -4  # WATER
  42.   REST_LENGTH  = -4  # REST
  43.   TOXIN_LENGTH = -4  # TOXIN
  44.  
  45.   # * Gauge Slope
  46.   #   Must be between -89 ~ 89 degrees
  47.   LIFE_SLOPE  = 30  # LIFE
  48.   FOOD_SLOPE  = 30  # FOOD
  49.   WATER_SLOPE = 30  # WATER
  50.   REST_SLOPE  = 30  # REST
  51.   TOXIN_SLOPE = 30  # TOXIN
  52. end
  53.  
  54. class Window_Survival < Window_Base
  55.   def draw_life(actor, x, y, width = Anyx::WINWIDTH - 22)
  56.     life_25 = Anyx::LIFEMAX / 4
  57.     life_26 = life_25 + 0.001
  58.     life_50 = life_25 * 2
  59.     life_51 = life_50 + 0.001
  60.     life_75 = life_25 * 3
  61.     life_76 = life_75 + 0.001
  62.     life_99 = Anyx::LIFEMAX - 0.001
  63.     life_color = dep_color if 1 > $survival_v[1]
  64.     life_color = dan_color if (1..life_25) === $survival_v[1]
  65.     life_color = low_color if (life_26..life_50) === $survival_v[1]
  66.     life_color = ave_color if (life_51..life_75) === $survival_v[1]
  67.     life_color = sat_color if (life_76..life_99) === $survival_v[1]
  68.     life_color = exc_color if Anyx::LIFEMAX <= $survival_v[1]
  69.     life_rate = $survival_v[1] / Anyx::LIFEMAX.to_f
  70.     draw_generic_gauge(KMS_GenericGauge::LIFE_IMAGE,
  71.             x, y, width, life_rate,
  72.             KMS_GenericGauge::LIFE_OFFSET,
  73.             KMS_GenericGauge::LIFE_LENGTH,
  74.             KMS_GenericGauge::LIFE_SLOPE
  75.     )
  76.     change_color(system_color)
  77.     draw_text(x, y, 100, line_height, Anyx::LIFEVOCAB)
  78.     draw_current_and_max_values(x, y, width, $survival_v[1].round.to_i, Anyx::LIFEMAX, life_color, life_color)
  79.   end # def draw_life(actor, x, y, width = Anyx::WINWIDTH - 22)
  80.   def draw_food(actor, x, y, width = Anyx::WINWIDTH - 22)
  81.     food_25 = Anyx::FOODMAX / 4
  82.     food_26 = food_25 + 0.001
  83.     food_50 = food_25 * 2
  84.     food_51 = food_50 + 0.001
  85.     food_75 = food_25 * 3
  86.     food_76 = food_75 + 0.001
  87.     food_99 = Anyx::FOODMAX - 0.001
  88.     food_color = dep_color if 1 > $survival_v[2]
  89.     food_color = dan_color if (1..food_25) === $survival_v[2]
  90.     food_color = low_color if (food_26..food_50) === $survival_v[2]
  91.     food_color = ave_color if (food_51..food_75) === $survival_v[2]
  92.     food_color = sat_color if (food_76..food_99) === $survival_v[2]
  93.     food_color = exc_color if Anyx::FOODMAX <= $survival_v[2]
  94.     food_rate = $survival_v[2] / Anyx::FOODMAX.to_f
  95.     draw_generic_gauge(KMS_GenericGauge::FOOD_IMAGE,
  96.             x, y, width, food_rate,
  97.             KMS_GenericGauge::FOOD_OFFSET,
  98.             KMS_GenericGauge::FOOD_LENGTH,
  99.             KMS_GenericGauge::FOOD_SLOPE
  100.     )
  101.     change_color(system_color)
  102.     draw_text(x, y, 100, line_height, Anyx::FOODVOCAB)
  103.     draw_current_and_max_values(x, y, width, $survival_v[2].round.to_i, Anyx::FOODMAX, food_color, food_color)
  104.   end # def draw_food(actor, x, y, width = Anyx::WINWIDTH - 22)
  105.   def draw_water(actor, x, y, width = Anyx::WINWIDTH - 22)
  106.     water_25 = Anyx::WATERMAX / 4
  107.     water_26 = water_25 + 0.001
  108.     water_50 = water_25 * 2
  109.     water_51 = water_50 + 0.001
  110.     water_75 = water_25 * 3
  111.     water_76 = water_75 + 0.001
  112.     water_99 = Anyx::WATERMAX - 0.001
  113.     water_color = dep_color if 1 > $survival_v[3]
  114.     water_color = dan_color if (1..water_25) === $survival_v[3]
  115.     water_color = low_color if (water_26..water_50) === $survival_v[3]
  116.     water_color = ave_color if (water_51..water_75) === $survival_v[3]
  117.     water_color = sat_color if (water_76..water_99) === $survival_v[3]
  118.     water_color = exc_color if Anyx::WATERMAX <= $survival_v[3]
  119.     water_rate = $survival_v[3] / Anyx::WATERMAX.to_f
  120.     draw_generic_gauge(KMS_GenericGauge::WATER_IMAGE,
  121.             x, y, width, water_rate,
  122.             KMS_GenericGauge::WATER_OFFSET,
  123.             KMS_GenericGauge::WATER_LENGTH,
  124.             KMS_GenericGauge::WATER_SLOPE
  125.     )
  126.     change_color(system_color)
  127.     draw_text(x, y, 100, line_height, Anyx::WATERVOCAB)
  128.     draw_current_and_max_values(x, y, width, $survival_v[3].round.to_i, Anyx::WATERMAX, water_color, water_color)
  129.   end # def draw_water(actor, x, y, width = Anyx::WINWIDTH - 22)
  130.   def draw_rest(actor, x, y, width = Anyx::WINWIDTH - 22)
  131.     rest_25 = Anyx::WATERMAX / 4
  132.     rest_26 = rest_25 + 0.001
  133.     rest_50 = rest_25 * 2
  134.     rest_51 = rest_50 + 0.001
  135.     rest_75 = rest_25 * 3
  136.     rest_76 = rest_75 + 0.001
  137.     rest_99 = Anyx::RESTMAX - 0.001
  138.     rest_color = dep_color if 1 > $survival_v[4]
  139.     rest_color = dan_color if (1..rest_25) === $survival_v[4]
  140.     rest_color = low_color if (rest_26..rest_50) === $survival_v[4]
  141.     rest_color = ave_color if (rest_51..rest_75) === $survival_v[4]
  142.     rest_color = sat_color if (rest_76..rest_99) === $survival_v[4]
  143.     rest_color = exc_color if Anyx::RESTMAX <= $survival_v[4]
  144.     rest_rate = $survival_v[4] / Anyx::RESTMAX.to_f
  145.     draw_generic_gauge(KMS_GenericGauge::REST_IMAGE,
  146.             x, y, width, rest_rate,
  147.             KMS_GenericGauge::REST_OFFSET,
  148.             KMS_GenericGauge::REST_LENGTH,
  149.             KMS_GenericGauge::REST_SLOPE
  150.     )
  151.     change_color(system_color)
  152.     draw_text(x, y, 100, line_height, Anyx::RESTVOCAB)
  153.     draw_current_and_max_values(x, y, width, $survival_v[4].round.to_i, Anyx::RESTMAX, rest_color, rest_color)
  154.   end # def draw_rest(actor, x, y, width = Anyx::WINWIDTH - 22)
  155.   def draw_toxin(actor, x, y, width = Anyx::WINWIDTH - 22)
  156.     toxin_25 = Anyx::TOXINMAX / 4
  157.     toxin_26 = toxin_25 + 0.001
  158.     toxin_50 = toxin_25 * 2
  159.     toxin_51 = toxin_50 + 0.001
  160.     toxin_75 = toxin_25 * 3
  161.     toxin_76 = toxin_75 + 0.001
  162.     toxin_99 = Anyx::TOXINMAX - 0.001
  163.     toxin_color = exc_color if 1 > $survival_v[5]
  164.     toxin_color = sat_color if (1..toxin_25) === $survival_v[5]
  165.     toxin_color = ave_color if (toxin_26..toxin_50) === $survival_v[5]
  166.     toxin_color = low_color if (toxin_51..toxin_75) === $survival_v[5]
  167.     toxin_color = dan_color if (toxin_76..toxin_99) === $survival_v[5]
  168.     toxin_color = dep_color if Anyx::TOXINMAX <= $survival_v[5]
  169.     toxin_rate = $survival_v[5] / Anyx::TOXINMAX.to_f
  170.     draw_generic_gauge(KMS_GenericGauge::TOXIN_IMAGE,
  171.             x, y, width, toxin_rate,
  172.             KMS_GenericGauge::TOXIN_OFFSET,
  173.             KMS_GenericGauge::TOXIN_LENGTH,
  174.             KMS_GenericGauge::TOXIN_SLOPE
  175.     )
  176.     change_color(system_color)
  177.     draw_text(x, y, 100, line_height, Anyx::TOXINVOCAB)
  178.     draw_current_and_max_values(x, y, width, $survival_v[5].round.to_i, Anyx::TOXINMAX, toxin_color, toxin_color)
  179.   end # def draw_toxin(actor, x, y, width = Anyx::WINWIDTH - 22)
  180. end # class
  181.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement