KF [Help] ServerPerks DoorHealthVisibilityScaling

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

hegyeri

Member
Aug 29, 2012
201
8
18
I would like to make a Perk support DoorHealthVisibilityScaling code but for some reason does not work. :(
Someone help this to become operational this feature!

MyPerk:
Code:
class MyVetSupportSpec extends MyVeterancyTypes
    abstract;
...
static function float DoorHealthVisibilityScaling(KFPlayerReplicationInfo KFPRI, Pawn P)
{
    return 1.0 + 0.5 * KFPRI.ClientVeteranSkillLevel;
}
...

MyVeterancyTypes:
Code:
class MyVeterancyTypes extends SRVeterancyTypes
    abstract;
...
static function float DoorHealthVisibilityScaling(KFPlayerReplicationInfo KFPRI, Pawn P)
{
    return 1.0;
}
...

We still need or what went wrong, it should be good :confused:
 

hegyeri

Member
Aug 29, 2012
201
8
18
Yes I know...
So I ask the help of a knowledgeable who would help in the creation of it to work. What code would need to be working on such a feature?
Pls help!
 

Skell

Active member
Mar 21, 2013
1,245
2
38
On the Internet.
Yes I know...
So I ask the help of a knowledgeable who would help in the creation of it to work. What code would need to be working on such a feature?
Pls help!
You need to make your own HUD class that extends off of HUDKillingFloor and overrides the function DrawDoorHealthBars(). I haven't looked into it too much but it seems like you'll need to change the following.
Code:
function DrawDoorHealthBars(Canvas C)
{
    [COLOR=Black][...][/COLOR]
    if ( Level.TimeSeconds > LastDoorBarHealthUpdate + 0.2 ||
        (PlayerOwner.Pawn.Weapon != none && PlayerOwner.Pawn.Weapon.class == class'Welder' && PlayerOwner.bFire == 1 ))
    {
        DoorCache.Remove(0, DoorCache.Length);

        [COLOR=Lime]foreach CollidingActors(class'KFDoorMover', DamageDoor, [COLOR=Red]300.00[/COLOR], PlayerOwner.Pawn.Location)[/COLOR]
        {
            [COLOR=Black][...][/COLOR]
        }

        LastDoorBarHealthUpdate = Level.TimeSeconds;
    }
    else
    {
          [COLOR=Black][...][/COLOR]
    }
}
The 300 is responsible for how far from the player the door can be. I'd like to point out that the function 'foreach CollidingActors()', like all actor iterator functions, is not cheap. Increasing that 300 value to ridiculously high numbers can become costly, especially on modded servers where there's just random garbage and players everywhere.

Luckily for you, PlayerOwner is current controller for the local client, so getting your perk's stuff isn't going to be too difficult. It should look something like this:
Code:
VisibilityMultiplier = KFPlayerReplicationInfo(PlayerReplicationInfo).ClientVeteranSkill.Static.DoorHealthVisibilityScaling(KFPlayerReplicationInfo(PRI), self);
Where VisibilityMultiplier is a local variable of type float. Then you can just use this VisibilityMultiplier*300 to get the new radius for the function foreach CollidingActors.
 

hegyeri

Member
Aug 29, 2012
201
8
18
Skell thanks for trying to help, heartily appreciate.
Is not entirely clear to what I should write. Would you elaborate a complete "DrawDoorHealthBars" code.
 

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
DoorHealthVisibilityScaling() is implemented in ScrnBalance. There is no such function in KFMod and ServerPerks.
 

hegyeri

Member
Aug 29, 2012
201
8
18
...is implemented in ScrnBalance
I am glad that there is such a function scrnbalance mod, I've used it a long time ago. Unfortunately, too many of the features have been included which makes a lot of mod does not work.
That's why many people do not use anymore.

There is no such function in KFMod and ServerPerks.
So I ask the experts to help. You are welcome if you can help it...
 

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
The code you listed is copy-pasted from ScrnVeterancyTypes and ScrnVetSupportSpec. Is it so hard to search for function call in the package and copy-paste that code too?
 

hegyeri

Member
Aug 29, 2012
201
8
18
As I said before, I do not want to use the scrnbalance. Alternative solution would I need.
 

Skell

Active member
Mar 21, 2013
1,245
2
38
On the Internet.
I don't think I can honestly explain what I said any better without just writing out the code, sorry hegyeri. DrawDoorHealthBars is a function in the class HUDKillingFloor, as I said above.

I have no idea why you brought up ScrN features in a thread titled ServerPerks, PooSH, but I'm sure it was because you misread it. As for copy-pasted code, I have no idea who you're referring to. Is that where hegyeri got the function name from or something? The code I listed is just from HUDKillingFloor with irrelevant lines removed.
 
Last edited:

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
I was referring to hegyeri's function declarations, which he took from ScrnBalance.