Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Killing Floor Forums > Killing Floor Modifications > Coding

Reply
 
Thread Tools Display Modes
  #1  
Old 09-28-2010, 07:51 PM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,430
Default [Tutorial] Modifying Existing Weapons

This tutorial it outdated. Please see the new version on the official wiki.

Spoiler!

Last edited by Benjamin; 11-28-2012 at 11:29 PM.
Reply With Quote
  #2  
Old 09-28-2010, 08:07 PM
YoYoBatty's Avatar
YoYoBatty YoYoBatty is offline
Senior Member
 
Join Date: Dec 2009
Location: Canada
Posts: 3,334
Default

I was waiting for you to put something like this up! GJ
__________________
Reply With Quote
  #3  
Old 09-29-2010, 11:19 AM
Marco Marco is offline
Senior Member
 
Join Date: May 2009
Location: Finland
Posts: 454
Default

On a note you have to be careful when editing default values. Clients may keep the modified values still after mapswitch (or server when switching between game modes).
Meaning client may get wrong fire rates/weapon names or such after connected to different server.
Reply With Quote
  #4  
Old 09-29-2010, 03:42 PM
YoYoBatty's Avatar
YoYoBatty YoYoBatty is offline
Senior Member
 
Join Date: Dec 2009
Location: Canada
Posts: 3,334
Default

You have to make it some how only relevant to the server.
__________________
Reply With Quote
  #5  
Old 09-29-2010, 04:36 PM
C_Gibby's Avatar
C_Gibby C_Gibby is offline
Break Blocks Team
 
Join Date: Jan 2010
Location: Suffocating in a furpile
Posts: 5,896
Default

I love you.

*starts helping Yomomomassis with Rainbow Six porting*
Reply With Quote
  #6  
Old 09-29-2010, 11:04 PM
Zeron's Avatar
Zeron Zeron is offline
Senior Member
 
Join Date: Jun 2010
Location: Somewhere Over The Rainbow...
Posts: 489
Default

Great guide. I'm not too much into editing but i understood it quite well.
Reply With Quote
  #7  
Old 10-01-2010, 09:49 PM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,430
Default

Thanks guys, I appreciate the comments. If I can find some time soon I'd like to write a tutorial on making weapons from scratch, but I'd need to do some more research first since I have no experience with media handling in UE.

Quote:
Originally Posted by Marco View Post
On a note you have to be careful when editing default values. Clients may keep the modified values still after mapswitch (or server when switching between game modes).
Meaning client may get wrong fire rates/weapon names or such after connected to different server.
I hadn't thought of that, thanks. I'm not sure about the client retaining the default values, but I know for sure that after a map switch (and no doubt a game mode switch) a server still retains them after the mutator is disabled. Still, for the sake of the tutorial I think it works well since it's a clean and easy way to explain which classes contain which variables. I've modified the tutorial a little bit (including the code) to point out that the example method is for single-player.
Reply With Quote
  #8  
Old 10-30-2010, 07:19 AM
justinas91 justinas91 is offline
Junior Member
 
Join Date: Oct 2010
Posts: 3
Default

Can someone please cleare some things up
Do i have to create a mutator with this?
And could someone post an example of a moded weapon how should all the lines look?
Thankyou
Reply With Quote
  #9  
Old 11-01-2010, 01:08 PM
KF-Argentina KF-Argentina is offline
Senior Member
 
Join Date: Oct 2010
Location: Argentina
Posts: 226
Default

Quote:
Originally Posted by justinas91 View Post
Can someone please cleare some things up
Do i have to create a mutator with this?
And could someone post an example of a moded weapon how should all the lines look?
Thankyou

Agree
Reply With Quote
  #10  
Old 11-02-2010, 04:49 PM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,430
Default

Yes, it has to be created as a mutator. See the link to the tutorial on making a mutator at the top of my post.
Reply With Quote
  #11  
Old 12-04-2010, 10:56 AM
RichardtheLionhart RichardtheLionhart is offline
Junior Member
 
Join Date: Nov 2010
Posts: 13
Default Darn

Why doesn't this work when I put it on a server? It works fine on solo.
Great work Benjamin! This is helped me so much.

Last edited by RichardtheLionhart; 06-22-2011 at 11:15 AM.
Reply With Quote
  #12  
Old 03-14-2011, 07:19 AM
elrocker's Avatar
elrocker elrocker is offline
Junior Member
 
Join Date: Feb 2011
Posts: 22
Default m14ebrm

I'm having problems with this, i have enter the info for a weapon (M14EBRM) which is a automatic m14. I am fairly new to coding, so i think the problem is format, or misplacement of {'s and }'s.
This is the .uc file code:
[CODE][class AlteredWeaponMut extends Mutator;
function PostBeginPlay()
{
class'Single'.default.ItemName = "M14EBRBattleRifle";
}
weaponname
{
class'Single'.default.ItemName = "M14EBRBattleRifle";
class'SinglePickup'.default.Itemname = "M14EBR";
class'SinglePickup'.default.ItemShortName = "M14EBR";
}
firetype
{
class'SingleFire'.default.bWaitForRelease = false;
}
damage
{
class'SingleFire'.default.DamageMax = 65;
class'DamTypeM14EBR'.default.HeadShotDamageMult = 2.5;
}
firerate
{
class'SingleFire'.default.FireRate = 0.175;
class'SingleFire'.default.FireAnimRate = 2.0;
}
recoil
{
class'SingleFire'.default.RecoilRate = 0.07;
class'SingleFire'.default.MaxVerticalRecoilAngle = 25;
class'SingleFire'.default.MaxHorizontalRecoilAngle = 5;
}
accuracy
{
class'SingleFire'.default.Spread = 0.015;
class'SingleFire'.default.MaxSpread = 0.12;
}
aiming
{
class'Single'.default.bHasAimingMode = true;
class'Single'.StandardDisplayFOV = 70.0;
class'Single'.ZoomedDisplayFOV = 65.0;
class'Single'.PlayerIronSightFOV = 75.0;
}
ammuntion
{
class'SingleAmmo'.default.MaxAmmo = 200;
class'SingleAmmo'.default.InitialAmount = 100;
class'SingleAmmo'.default.AmmoPickupAmount = 40;
class'SingleAmmoPickup'.default.AmmoAmount = 30;
}
pickupmessage
{
class'SinglePickup'.default.PickupMessage = "You got the M14EBR";
}
trader
{
class'SinglePickup'.default.Cost = 200;
class'SinglePickup'.default.AmmoCost = 10;
class'SinglePickup'.default.BuyClipSize = 30;
class'SinglePickup'.default.PowerValue = 40;
class'SinglePickup'.default.SpeedValue = 5;
class'SinglePickup'.default.RangeValue = 35;
}
inventory
{
class'Single'.default.InventoryGroup = 4;
class'Single'.default.GroupOffset = 1;
class'Single'.default.Priority = 3;
class'Single'.default.Weight = 6;
class'Single'.default.bKFNeverThrow = true;
}
defaultproperties
{
GroupName="KFM14EBRM"
FriendlyName="Altered Weapon Mutator"
Description="Automatic M14EBR."
}/CODE]
My second one there may be one error in.
.bat file:
Code:
del "C:\Program Files\Steam\steamapps\common\killingfloor\M14EBRM.u"
"C:\Program Files\Steam\steamapps\common\killingfloor\System\UCC.exe" make
del "C:\Program Files\Steam\steamapps\common\killingfloor\System\steam_appid.txt"
pause
thanks
Reply With Quote
  #13  
Old 03-14-2011, 12:40 PM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,430
Default

You don't split it into sections like that, you can just put all lines in the PostBeginPlay function.

Quote:
Originally Posted by RichardtheLionhart View Post
Why doesn't this work when I put it on a server? It works fine on solo.
This method works a certain way that isn't meant for online play. If you want to make weapons that work online I'd suggest subclassing existing weapons and adding them to the trader.

Last edited by Benjamin; 03-14-2011 at 12:41 PM.
Reply With Quote
  #14  
Old 04-13-2011, 10:09 PM
Scyther Scyther is offline
Junior Member
 
Join Date: Apr 2011
Posts: 3
Default

Quote:
Originally Posted by Benjamin View Post
This method works a certain way that isn't meant for online play. If you want to make weapons that work online I'd suggest subclassing existing weapons and adding them to the trader.
How would I go about doing this? I'm new to making mutators for KF and want to make custom weapons (or edit current ones) for online play with some friends.

(Oh and great guide, worked perfectly in SP )
Reply With Quote
  #15  
Old 04-16-2011, 02:59 PM
Entangler Entangler is offline
Senior Member
 
Join Date: Jul 2009
Location: Sydney, Australia
Posts: 450
Default

The method described in the OP does in fact work for multiplayer mutators, if:
  • PostBeginPlay is declared simulated and
  • the mutator is replicated to clients (bAlwaysRelevant = true).
Reply With Quote
  #16  
Old 04-16-2011, 03:24 PM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,430
Default

Quote:
Originally Posted by Entangler View Post
The method described in the OP does in fact work for multiplayer mutators, if:
  • PostBeginPlay is declared simulated and
  • the mutator is replicated to clients (bAlwaysRelevant = true).
Right, but it's not a good idea since when you run such a mutator on a server the values will stick even when the mutator is disabled, unless you manually restore them yourself.
Reply With Quote
  #17  
Old 04-16-2011, 03:29 PM
Entangler Entangler is offline
Senior Member
 
Join Date: Jul 2009
Location: Sydney, Australia
Posts: 450
Default

Quote:
Originally Posted by Benjamin View Post
Right, but it's not a good idea since when you run such a mutator on a server the values will stick even when the mutator is disabled, unless you manually restore them yourself.
Oh I see. Strange, though... I don't recall having ever run into that problem. Still, I'll take your word for it.
Reply With Quote
  #18  
Old 07-01-2011, 01:22 PM
Dave_Scream Dave_Scream is offline
Senior Member
 
Join Date: Jan 2010
Location: Russia, Rostov-on-Don
Posts: 159
Default

Hi.
I want to make vampire Katana for berserker.
When berserker player hit some enemy it heal himself.

from where I can start to dig?
I think the start point is KFMeleeFire -> Timer() function where HitActor.TakeDamage function calls are.
but how I can access Player healths and Player veterancy type from this section of code? how to access Owner? and how to make mutator of KFMeleeFire
----
ok. I have step 1
this function is placed in KFMeleeFire.uc -> Timer() and it deals damage to enemy
HitActor.TakeDamage(MyDamage, Instigator, HitLocation, vector(PointRot), hitDamageClass) ;

so for "Vampire" effect, after Enemy TakeDamage
I must somehow make somethink like this
if (Instigator.VeterancyType=class<'KFVetBerserker'>)
{
Instigator.GiveHealth(MyDamage*coefficient);
}

need help!)

Last edited by Dave_Scream; 07-01-2011 at 02:02 PM.
Reply With Quote
  #19  
Old 11-21-2011, 05:13 PM
ASSAYARO's Avatar
ASSAYARO ASSAYARO is offline
Senior Member
 
Join Date: Sep 2010
Location: Behind you...
Posts: 137
Default I wonder...

What code to enable level-up?
Reply With Quote
  #20  
Old 11-22-2011, 10:02 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,795
Default

Quote:
Originally Posted by ASSAYARO View Post
What code to enable level-up?
That's done by the damagetype of the weapon.
__________________

Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC