Wednesday, October 23, 2013

How to make a custom weapon in UDK pt 2

The fastest way to get your own custom weapon is to extend what Epic have already put in place. Extending a weapon already in game is by far the best way to get started in this case we're using the Shock Rifle 'UTWeap_ShockRifle' class, In the previous post I named my shotgun model 'cw_weapon05' and imported it into my 'CWWeapons' package so the path to the skeletal mesh is 'CWWeapons.Mesh.cw_weapon05' taking a look at the CW_TestGun.uc class below shows that we only need to override the mesh, attachment class and pickup mesh.

//CW_TestGun.uc

class CW_TestGun extends UTWeap_ShockRifle;


defaultproperties
{

// Weapon SkeletalMesh
Begin Object Name=FirstPersonMesh
SkeletalMesh=SkeletalMesh'CWWeapons.Mesh.cw_weapon05'
AnimSets(0)=AnimSet'WP_ShockRifle.Anim.K_WP_ShockRifle_1P_Base'
Animations=MeshSequenceA
Rotation=(Yaw=-16384)
FOV=60.0
End Object

AttachmentClass=class'Cheesewhisk.CWAttachment_TestGun'

Begin Object Name=PickupMesh
SkeletalMesh=SkeletalMesh'CWWeapons.Mesh.cw_weapon05'
End Object
}


//CWAttachment_TestGun.uc

class CWAttachment_TestGun extends UTAttachment_ShockRifle;

defaultproperties
{
Begin Object Name=SkeletalMeshComponent0
SkeletalMesh=SkeletalMesh'CWWeapons.Mesh.cw_weapon05'
End Object

}


No comments:

Post a Comment