Work in progress.

Still working on the design for this blog.
You can find all my tutorials in the tutorial tab.

Tuesday, September 17, 2013

UDK Script: Custom weapon script.

This guide will show you how to make your own custom weapon in UDK. I will use LinkGun as an example in this guide. I will also describe some of the main functions you should change in the script. 

Starting up: 

I start of by copying UTWeap_LinkGun, located in UDK/Development/Scr/UTGame/Classes to your custom folder. 

Rename your script, in this guide I have named my script: ATWeap_TestGun. 
Open your script, and rename UTWeap_LinkGun too "your gun name (ATWeap_TestGun)

In extends you got to type UTWeap_LinkGun. 

Remove everything that is over defaultproperties.


It should look like this:





When this is done, I recommend to Compile your script. 
Open Unreal Frontend - press on the the Script arrow and choose Full Recompile.

If you get any errors ( I got this one)

"F:\UDK\UDK-2013-07\Development\Src\Antimare\Classes\ATWeap_TestGun.uc(36) : Error, BEGIN OBJECT: The component name PoweredUpComponent is already used (if you want to override the component, don't specify a class)"

It can easily be fixed by adding "My" infront of the variable like I have done under.

"Begin Object Class=ParticleSystemComponent Name=MyPoweredUpComponent"


Testing your script:

Your script can now be found in UDK. ( Open Content Browser - Press Actor Classes(look on the top tabs) - Press Pickups/Weapon/UTWeaponPickupFactory and drag in out to your scene. 

Double click on the PickupFactory - and under UTWeapon Pickup Factory you will find your gun.








Changing our script:

Under I will explain a few links you can change to make your customgun. You can find everything under defaultproperties.

Name=FirstPersonMesh
SkeletalMesh: Change the weapon model. 

Name=PickUpMesh
SkeletalMesh: The mesh that will show up on the ground if dropped - or in the pickupfactory.

Custom Weapon Projectile 

Find WeaponProjectiles(0/1)=class'UTProj_LinkPlasma'

Whenever you see =class it means that is got it's own script. You can easily find the script in your
UDK/Development/Src/UTGame/Classes

Within this script ( Remember to rename the projectile script - same as you did with the weapon script)
you will find 

ProjFlightTemplate: Here can you paste your custom ParticleSystem for you weapon
ProjExplosionTemplate: Paste your impact ParticleSystem. This will play whenever the shoot hits a object.
Speed: Speed of the ParticleSystem

Damage: How much damage each shoot will do to the enemy
DamageRadius: How much explosive damage you and your enemy will take (if in range)
MomentumTransfer: How much momentum your character / your enemy will take when hit.
( This one can make some really cool gameplay, recommend to test it out)


( using ShockBall from the ShockRifle in this guide)
ComboDamage: Damage done if you hit your enemies shoot 
ComboRadius: Radius of the damage and momentum when you hit enemy shoot
ComboMomentumTransfer: The momentum you and your enemy will get if they are insade the radius.
ComboTemplate= ParticleSystem of your combo shoot. 


AmbientSound:  Sound of your ParticleSystem
ExplosionSound: This sound will play whenever your shoot collide with a object
ComboExplosionSound: Sound when you and your enemies shoot collide with each other.
ComboExplosionEffect: Class of your ComboExplosionEffect.


Custom Weapon Sounds:

WeaponFireSnd[0]: Left click fire ( Main fire)
WeaponFireSnd[1]: Right click fire ( Alt fire)

PickupSound: This sounds will play as soon as you walk over the gun / pick one up from the pickup factory.


No comments:

Post a Comment