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

KF Replacing the default knife through trader

Drifty2Lock

Member
Oct 13, 2014
10
0
I was making a knife weapon mod and I was wondering if it's possible that when this new knife is bought it can remove the default knife from your inventory so the new one may take its place?

I'm trying to make it so players have a chance to upgrade thier knife and be able to drop the default one (or just trader delete it) when buying this new one. It would be nice, even though it doesn't weigh anything, it still would be interesting to have it do that.

Anybody know how to do that?
 
Sorry you can not auto replace a weapon, but you can make it sell-able/throwable.

Make a edited knife extending off the original
Code:
bKFNeverThrow=True
change True to False, now the knife can be tossed, and im sure it also means it can be sold. Thats the best you can do.

These 2 next are optional additions:

If you want it to weight at lease 1 block then
Code:
     Weight=0.000000
change the first 0 to 1 in both the pickup class and the main class. Could be used if you dont want to pick it up if you are already max weight.

If you or someone you know might have OCD, then in the pickup class, give it a pickup noise
Code:
     PickupSound=None
change None to SoundGroup'KF_KnifeSnd.Knife_Select'

Hope that helps, have fun!
 
Last edited:
Upvote 0
You can replace a weapon but not in the trader without ServerPerks.

Here is some code that will help replace it for all spawned pawns and replace all knives on the map.

Code:
function PostBeginPlay()
{
	// Set the pawns 0 slot and replace knife with new knife.
	KFHumanPawn.Default.RequiredEquipment[0] = "File.NewKnife"
	return;
}

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	// If a knife is found, replace it with the new one.
	if ( Other.IsA( 'KnifePickup' ) )
		ReplaceWith( Other, "NewKnife" );
}

For the custom knife itself, do what DMN has mentioned.
 
Last edited:
Upvote 0