PAYDAY 2

PAYDAY 2

View Stats:
SpritePony Mar 10, 2019 @ 6:06pm
Any way to change how Berserker Healing Block works?
Note: Not looking for Berserker Lives Matter. I am merely looking for any ideas or insight as to how one could possibly change Berserker's supposed healing block to block not only Gambler's regeneration, but also Hacker and Tag Team.

From my understanding, or how I interpret it at least, is that Gambler's healing is blocked due to a trigger effect, instead of an "aura" type effect like with Hacker's Pocket ECM and Tag Team's Gas Dispenser.

Trying to keep this as vanilla as possible for my rebalance mod.
< >
Showing 1-10 of 10 comments
Ludor Experiens Mar 11, 2019 @ 4:39pm 
Aura is not a bad comparison.
The issue however is, that there is no logical reason why some healing sources are excluded but others aren't. There are just checks missing at certain locations in the code.
Codewise you could say, Gambler effect happens from outside (the function to restore health is completely seperated from the actual player health / damage) while effects like Combat Medic or Hacker happen from inside (everything happens in the player health calculation)

Edit: Rechecked the code and my first assessment was a bit wrong; corrected it.
Last edited by Ludor Experiens; Mar 11, 2019 @ 4:44pm
SpritePony Mar 11, 2019 @ 6:57pm 
Originally posted by Ludor Experiens:
Aura is not a bad comparison.
The issue however is, that there is no logical reason why some healing sources are excluded but others aren't. There are just checks missing at certain locations in the code.
Codewise you could say, Gambler effect happens from outside (the function to restore health is completely seperated from the actual player health / damage) while effects like Combat Medic or Hacker happen from inside (everything happens in the player health calculation)

Edit: Rechecked the code and my first assessment was a bit wrong; corrected it.
Yeah, I know. It's a REALLY odd way to handle things, and it sucks. If only there was a way to block it using simple code rather than the entire seemingly jumbled mess of Berserker Lives Matter.
Ludor Experiens Mar 12, 2019 @ 7:44am 
Tbh, the mod is only that big because it 1) it distinguishes between Berserker Basic and Ace, 2) has the feature with the fixed max health, 3) let's host disable those "cheaty" aspects for clients and 4) has an ingame menu to change on the fly.

If you just want to check for any berserker, you have
managers.player:local_player():character_damage():is_berserker()

If you decide to include combat medic, the only thing you need is basically
function PlayerDamage:set_revive_boost(revive_health_level) if self:is_berserker() then return end old_set_revive_boost(self, revive_health_level) end

For hacker it is
function PlayerInventory:_feedback_heal_on_kill() if managers.player:local_player():character_damage():is_berserker() then return end old_feedback_heal_on_kill(self) end

I didn't even know tag team could trigger with berserker; to be fair noone seems to use it.

If you have an idea how to improve Berserker Live Matters, let me know.
SpritePony Mar 12, 2019 @ 7:57am 
Originally posted by Ludor Experiens:
Tbh, the mod is only that big because it 1) it distinguishes between Berserker Basic and Ace, 2) has the feature with the fixed max health, 3) let's host disable those "cheaty" aspects for clients and 4) has an ingame menu to change on the fly.

If you just want to check for any berserker, you have
managers.player:local_player():character_damage():is_berserker()

If you decide to include combat medic, the only thing you need is basically
function PlayerDamage:set_revive_boost(revive_health_level) if self:is_berserker() then return end old_set_revive_boost(self, revive_health_level) end

For hacker it is
function PlayerInventory:_feedback_heal_on_kill() if managers.player:local_player():character_damage():is_berserker() then return end old_feedback_heal_on_kill(self) end

I didn't even know tag team could trigger with berserker; to be fair noone seems to use it.

If you have an idea how to improve Berserker Live Matters, let me know.
These hook into... Which files? I think PlayerDamage code just goes into the PlayerDamage files...
And yes, Tag Team does trigger with Berserker if you don't have BLM.

I'll give the codes a go once I figure out what file(s) they need to hook into and get them installed on my mod.
SpritePony Mar 12, 2019 @ 5:04pm 
Bumping, still looking for what files the code hooks into, and Tag Team's healing code.

Edit: Pretty sure the Combat Medic blocker is PlayerDamage and Feedback Heal on Kill is PlayerManager. Not 100% sure. Still need TT's code.

Edit 2: Feedback Heal on Kill doesn't work. Not sure if I need to somehow assign the managers.player code or not, but either way it doesn't work under PlayerManager.

FATAL ERROR: (c:\users\znix\source\repos\superblt\src\initiatestate.cpp:285) mods/Sprite's All-in-One Rebalance/PlyrMngr.lua:3: attempt to index global 'PlayerInventory' (a nil value)
stack traceback:
mods/Sprite's All-in-One Rebalance/PlyrMngr.lua:3: in main chunk
[C]: in function 'dofile'
mods/base/base.lua:130: in function 'RunHookFile'
mods/base/base.lua:122: in function 'RunHookTable'
mods/base/base.lua:152: in function 'OrigRequire'
mods/BeardLib/Core.lua:215: in function 'require'
[string "lib/setups/setup.lua"]:65: in main chunk
[C]: in function 'require'
mods/base/base.lua:151: in function 'OrigRequire'
mods/BeardLib/Core.lua:215: in function 'require'
[string "lib/setups/menusetup.lua"]:1: in main chunk
[C]: in function 'require'
mods/base/base.lua:151: in function 'OrigRequire'
mods/BeardLib/Core.lua:215: in function 'require'
[string "lib/entry.lua"]:8: in main chunk
[C]: in function 'require'
mods/base/base.lua:151: in function 'OrigRequire'
mods/BeardLib/Core.lua:215: in function 'require'
[string "core/lib/coreentry.lua"]:19: in main chunk
Last edited by SpritePony; Mar 12, 2019 @ 5:27pm
Ludor Experiens Mar 12, 2019 @ 10:15pm 
PlayerInventory is lib/units/beings/player/playerinventory

Tag team is in lib/player_actions/skills/playeractiontagteam

This should work; I haven't tested it though:
local old_tagged_function = PlayerAction.TagTeamTagged.Function PlayerAction.TagTeamTagged.Function = function(tagged, owner) if managers.player:local_player():character_damage():is_berserker() then return end old_tagged_function(tagged, owner) end
Last edited by Ludor Experiens; Mar 12, 2019 @ 10:28pm
SpritePony Mar 14, 2019 @ 2:51pm 
Okay, two more things to note:
1. Tag Team code does not work. At all. It still heals through Berserker.
2. Hacker code causes a crash upon killing an enemy with the following log:
Application has crashed: C++ exception
mods/Sprite's All-in-One Rebalance/HackerBlocker.lua:3: attempt to call global 'old_feedback_heal_on_kill' (a nil value)



SCRIPT STACK

the_fixes_notify_now_by_added_message() @mods/The Fixes/messagesystem.lua:9
on_killshot() @mods/The Fixes/playermanager.lua:23
chk_killshot() lib/units/enemies/cop/copdamage.lua:2434
original_function() lib/units/enemies/cop/copdamage.lua:518
damage_bullet() @mods/Enhanced Hitmarkers/lua/copdamage.lua:20
give_impact_damage() lib/units/weapons/raycastweaponbase.lua:2223
on_collision() lib/units/weapons/raycastweaponbase.lua:2136
_fire_raycast() lib/units/weapons/raycastweaponbase.lua:695
fire() lib/units/weapons/raycastweaponbase.lua:468
fire() @mods/BeardLib/Hooks/Fixes.lua:194
callback() lib/units/weapons/akimboweaponbase.lua:129
lib/units/weapons/akimboweaponbase.lua:19


-------------------------------

Callstack:

payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) zip_get_name
Ludor Experiens Mar 14, 2019 @ 5:23pm 
Naturally you first have to define old_feedback_heal_on_kill. Same with old_set_revive_boost. Sorry I left that out; I thought I'd leave a bit of modding to you.
local old_set_revive_boost = PlayerDamage.set_revive_boost function PlayerDamage:set_revive_boost(revive_health_level) if self:is_berserker() then return end old_set_revive_boost(self, revive_health_level) end
local old_feedback_heal_on_kill = PlayerInventory._feedback_heal_on_kill function PlayerInventory:_feedback_heal_on_kill() if managers.player:local_player():character_damage():is_berserker() then return end old_feedback_heal_on_kill(self) end

If tag team does not crash, it should work; note that I only overwrote the healing if you are the one getting tagged, not if you do the tagging.
Last edited by Ludor Experiens; Mar 14, 2019 @ 5:24pm
SpritePony Mar 14, 2019 @ 5:38pm 
Originally posted by Ludor Experiens:
Naturally you first have to define old_feedback_heal_on_kill. Same with old_set_revive_boost. Sorry I left that out; I thought I'd leave a bit of modding to you.
local old_set_revive_boost = PlayerDamage.set_revive_boost function PlayerDamage:set_revive_boost(revive_health_level) if self:is_berserker() then return end old_set_revive_boost(self, revive_health_level) end
local old_feedback_heal_on_kill = PlayerInventory._feedback_heal_on_kill function PlayerInventory:_feedback_heal_on_kill() if managers.player:local_player():character_damage():is_berserker() then return end old_feedback_heal_on_kill(self) end

If tag team does not crash, it should work; note that I only overwrote the healing if you are the one getting tagged, not if you do the tagging.
Tag Team did not crash, but it also did not work properly. I had my partner install my mod, complete with the current patch code, had them go down, revived... Then tagged them with Tag Team and they regenerated, thus the code did not work.
And yes, they had both Berserker and Frenzy.

I'll try this new code out. I don't fully understand putting in fresh code right now. I mostly just know of manipulating current, existing code.
Last edited by SpritePony; Mar 14, 2019 @ 5:40pm
SpritePony Mar 16, 2019 @ 6:34pm 
Tried it again, Hacker still crashes. Thanks for trying, but I'm just going to give up on this. Too annoying to try and make new code that ACTUALLY functions without crashing or doing something completely wrong.
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Mar 10, 2019 @ 6:06pm
Posts: 10