Asking, which Perk is used...

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

StuKKa

FNG / Fresh Meat
Mar 20, 2010
65
10
0
Hi there..
I started coding today and found the first problem with the classes. I wanted to ask, which perk is used to give each perk a replacement weapon, for example another kind of knife or a new high power welder. How do i ask which perk is used?

Code:
function ModifyPlayer(Pawn Other)
{
    if (KFPlayerController.NewPerkClass == class'KFVetCommando')
    {
        Other.CreateInventory("KFMod.Bat");
        Super.ModifyPlayer(Other);
    }
}

Hope you could help me, because I'm completly new at the unreal engine, I only worked with the source engine so far, but i want to do something for my loved Killing Floor....
 

YoYoBatty

FNG / Fresh Meat
Dec 17, 2009
3,459
2,502
0
Canada
Source is quite similar to Unreal Engine because they are both C++ based. Source is written in C++ alone (I think) and Unreal Engine is written in C++ Java and UScript. Once you get all the functions you'll be making mutators as fast as you can say pneumonoultramicroscopicsilicovolcanoconiosis.
 
Last edited:

BEEEEEES

FNG / Fresh Meat
Aug 29, 2009
476
42
0
here's a code snippet you might find helpful:

Code:
    ForEach DynamicActors(class'KFHumanPawn', KFHP)
    {
        if (KFHP == None)
        {
            continue;
        }
        PC = KFPlayerController(KFHP.Controller);        
        if (PC != None)
        {
            PRI = KFPlayerReplicationInfo(KFHP.PlayerReplicationInfo);
            if (PRI != none)
            {
                if (PRI.ClientVeteranSkill == none)
                {

...is how you see what perk some pawn (KFHP) has.

All the perks (KFMod.KFVet*) have a function, AddDefaultInventory, which adds things to a pawn's inventory when it spawns. Additionally, KFMod.KFHumanPawn sets several items in the array, RequiredEquipment, which will also be spawned into a KFHumanPawn's inventory whenever it spawns. You can, for example, in a mutator's CheckReplacement function, catch KFHumanPawns before they are spawned and modify their RequiredEquipment array to control what they spawn with.
 

StuKKa

FNG / Fresh Meat
Mar 20, 2010
65
10
0
Thank you, i got it worked. I got a small other question:
How do I remove a weapon from a player. I want to remove the knife, because some perks got other standart melee weapon, for example, the demolition perk now gets a hockey bat if he reaches level 5.
 

BEEEEEES

FNG / Fresh Meat
Aug 29, 2009
476
42
0
Personally, I think you're better off rolling new perk classes and adding the equip you want in their adddefaultinventory function. Or you could use the RequiredEquipment array and modify it in a mutator's checkreplace. There's quite a few ways.

two functions you might look at are CreateInventory...deleteinventory I think.

Here's something you might want to peruse:

http://ericdives.com/UT2004-UnCodex/classtree.html#Weapon

pretty much the entire source tree for ut2004. anything you want to know how to do, there is probably an example in there.