• 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/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Weapon Mutator Problem

Pirangunter21

FNG / Fresh Meat
May 5, 2016
5
0
0
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;


}
 

Pharrahnox

FNG / Fresh Meat
Feb 3, 2016
268
71
0
Cranny mate
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 '//'.
 

oldschool

Active member
May 1, 2015
376
37
28
NYC
osghc.com
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! ;)

 
Last edited:
  • Like
Reactions: Pharrahnox

Pirangunter21

FNG / Fresh Meat
May 5, 2016
5
0
0
but there's one problem, somehow i can't run the mutator KFGame kf-bioticslab?game=ARK65.DocWeapon

ARK65 = SDK package
Docweapon = gameinfo
 

oldschool

Active member
May 1, 2015
376
37
28
NYC
osghc.com
Does the weapon spawn in regular game? If you have the files loaded locally start a offline game. Pull down console type=>enablecheats Then=>giveweapon <packagename>.<classname> If it isn't added to player pawn's inventory then the weapon is not coded properly.