• 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/

Code [Help] ServerPerks DoorHealthVisibilityScaling

hegyeri

Grizzled Veteran
Aug 29, 2012
201
8
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:
 
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.
 
Upvote 0
...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...
 
Upvote 0
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:
Upvote 0