Advertisement
offyerrocker

playermanager.lua

Apr 21st, 2020
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. --[[hook to "lib/managers/playermanager"
  2. you should to replace the names of the following:
  3.  
  4. (line 25)
  5. "yuri_customperkdeck_register_listeners"
  6. ^ should be a better unique hook id of your choice
  7.  
  8. (line 26)
  9. self:has_category_upgrade("player", "placeholder_health_regen_upgrade")
  10. ^ "player" should be the category of your upgrade; "placeholder_health_regen_upgrade" should be the same name of the upgrade id you made in upgradestweakdata.
  11. This upgrade should be a true/false value, which indicates whether or not the player has the ability to heal upon a headshot kill.
  12.  
  13. (line 30)
  14. self:get_upgrade_value("player","yuri_health_regen_amount",0)
  15. ^ "player" should be the category of your upgrade; "placeholder_health_regen_upgrade" should be the same name of the upgrade id you made in upgradestweakdata.
  16. This upgrade should be a number value (inside a table), in case you want to make this amount upgradeable in later card tiers of your custom perk deck
  17.  
  18. (lines 27 and 37)
  19. "activate_yuri_health_regen"
  20. ^ should be a unique "event id", or the name of what should happen when you get a headshot kill. don't worry too much about it, just make it unique like the hook id.
  21.  
  22. --]]
  23.  
  24.  
  25. Hooks:PostHook(PlayerManager,"check_skills","yuri_customperkdeck_register_listeners",function(self)
  26.     if self:has_category_upgrade("player", "placeholder_health_regen_upgrade") then
  27.         self._message_system:register(Message.OnLethalHeadShot, "activate_yuri_health_regen", function()
  28.             local player = self:local_player()
  29.             if alive(player) then
  30.                 local restore_hp_amount = self:get_upgrade_value("player","yuri_health_regen_amount",0)
  31.                 if restore_hp_amount ~= 0 then
  32.                     player:character_damage():change_health(restore_hp_amount)
  33.                 end
  34.             end
  35.         end)
  36.     else
  37.         self._message_system:unregister(Message.OnLethalHeadShot, "activate_yuri_health_regen")
  38.     end
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement