• 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 Weapon Mutator Problem

So i want to make my custom models to be in my own mutator, the thing is the script that i make seems not working. anybody know what did i do wrong?
class DocWeaponPack extends KFGameInfo_Survival;

exec function NewWeapons()
{

GiveWeapon( "DocWeps.KFWeap_Edged_TEST" );
}
//=============================================================================
// KFWeap_Edged_Zweihander
//=============================================================================
// A two-handed sword primarily of the Renaissance. It is a true two-handed
// sword because it requires two hands to wield, unlike other large swords
// that are wielded with two hands but can also be wielded with one.
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
// - Andrew "Strago" Ladenberger
//=============================================================================

class KFWeap_Edged_TEST extends KFWeap_MeleeBase;

var StaticMeshComponent FireAxeStaticmesh;
var name RootBoneName;
var SkelControlSingleBone RootBone;


simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
Super.PostInitAnimTree(SkelComp);
}

//=============================================================================
// KFWeaponDefintion
//=============================================================================
// A lightweight container for basic weapon properties that can be safely
// accessed without a weapon actor (UI, remote clients).
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
//=============================================================================
class KFWeapDef_TEST extends KFWeaponDefinition
abstract;


}
 
What about it is not working? Does it compile? If you have all of that in one file, then it's not going to compile; you need one class definition per file. I don't think you'll be able to call GiveWeapon() directly from KFGameInfo_Survival, since that function is defined in CheatManager. I think you'd probably want to override the model-related variables that are set in the DefaultProperties block of the weapons.

By the way, you can get rid of those big blocks of comments - they start with '//'.
 
Upvote 0
First learn exactly how the weapon is built in game.

3 files are needed. To make a custom weapon. You will need to extend a base game class. One <weaponclass> file and a <kfweapdef> file. Do your due diligence and make a proper KF2SDK package that will support your custom weapon. Which includes the following. 1P Mesh, 3P Mesh, StaticMesh for Pickup object, Texture for model, texture for Trader weapon select, MaterialInstanceConstance for weapon skin made up of material and textures, and last but not least an Archetype that will tell the game what animations to use what mesh to create in game for the player pawn and how the mesh is skinned is based on mesh properties.. All those can be combined in one KF2SDk package that will support the custom weapon. ATTACHED PACKAGE AT END.

Take your model for example. I used this to get it to work online.

KFWeap_MK42b.uc:
Spoiler!

KFWeapDef_MK42B.uc
Spoiler!

Those 3 things are the base you will need to implement one weapon. Learn how to make it work online from scratch first. When you can use "enablecheats" and "giveweapon mk42b.kfweap_mk42b" in console and it spawns then you can look into adding it via Mutator or Gametype which is the way you were trying to go about it in your code above. Then read this thread. An awesome way of adding it via Gametype. HERE Thank you for your models and time in helping me get my workshop item up and running! ;)
customtradermut.png

 
Last edited:
  • Like
Reactions: Pharrahnox
Upvote 0
Friends, there is a similar question.
There are 2 files. script. u and pack. upk
If I publish it in the steam workshop, it works. (for steam only)
However, there is no download from the workshop on Epic Games clients.

If I throw the script and the package to my personal ftp.
Then everything is downloaded, but in the script the paths do not match because the download takes place in the cache folder under the name ex: 9823589327583759782347.u.

If there is a solution to this problem, I will be happy.
 
Upvote 0
Friends, there is a similar question.
There are 2 files. script. u and pack. upk
If I publish it in the steam workshop, it works. (for steam only)
However, there is no download from the workshop on Epic Games clients.

If I throw the script and the package to my personal ftp.
Then everything is downloaded, but in the script the paths do not match because the download takes place in the cache folder under the name ex: 9823589327583759782347.u.

If there is a solution to this problem, I will be happy.
Solution was found.
 
Upvote 0