Friday, October 25, 2013

How to create a custom HUD in UDK

UTGFxHudWrapper is the wrapper that deals with the Unreal Script side of the movie or movies ie checks if they are loaded, toggles visibility etc and stores the Class of the MinimapHUDClass in it's Default properties:

MinimapHUDClass=class'GFxMinimapHUD'

GFxMinimapHud on the other hand is the Unreal script that delves deeper into the Flash movie itself:

    TeamStatsMC = GetVariableObject("_root.teamStats");
    PlayerStatsMC = GetVariableObject("_root.playerStats");
    PlayerStatsMC.GotoAndStopI(3);
It also stores the reference to the actual Gfx movie you want to use in it's Default properties:

 MovieInfo=SwfMovie'UDKHud.udk_hud'
To create your own HUD simply extend these two classes and point to your own custom gfx movie

//CWHud .uc
class CWHud extends UTGFxHUDWrapper;
defaultproperties
{

MinimapHUDClass=class'CWMinimapHUD'
}
//CWMinimapHUD.uc
class CWMinimapHUD extends GFxMinimapHud;
defaultproperties
{
MovieInfo=SwfMovie'CWHud_UI.CWHud'
}
The HUD is instantiated inside the PlayerController Class:
//CWPlayerController .uc
CWPlayerController extends UTPlayerController; 

reliable client function ClientSetHUD(class<HUD> newHUDType)
{
if(myHUD != none)
{
myHUD.Destroy();
}
myHUD = spawn(class'CWHud', self);
}

Custom flying vehicle scripts

Here's the scripts from Teglegs's flying code for reference.

I don't have a model to hand but as udkc is dead I wanted to post this for prosperity, that and it's the best plug n play script I've come across.


CWTegVehicle_Heli.uc

CWTegVehicle_Heli_Content.uc

CWTegVehicleFactory_Heli.uc

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

}


How to make a custom weapon in UDK

As always these are my notes and not in anyway the best way to do this. Purely the way I have done.
First off you need a gun model, I tried downloading a few free ones but as always you end up spending more time trying to crowbar whatever you find into shape, than you may have done modelling from scratch.

I created a very rudimentary shotgun shape in 3dsMax from a cylinder. Once you have this you need to add a Skin modifier to the mesh then add to this two bones. The bones will be identified in UnrealScript so if you are going to write your own then they can be whatever you want but if you're reading this then I guess we follow Epics lead.

The first bone wants to be the root bone and will ideally be inside the handle of the weapon (think of it as where the players right hand will be) the second will be along the barrel (players left hand)

These will need to be named 'b_gun_root' and 'b_gun_lefthand' Rig the bones so that all vertices are weighted completely to the 'b_gun_root' bone and none weighted to the 'b_gun_lefthand'

Following this add an Unwrap UVW and export the whole thing out as a .fbx file then go into UDK and import the fbx file into your package.


  1. Create / download 3d model
  2. Add Skin modifier
  3. Add 'b_gun_root' bone weighted to 1
  4. Add 'b_gun_lefthand' bone weighted to 0
  5. Add Unwrap UVW
  6. Export as fbx
  7. Import into custom package in UDK 





Tuesday, October 22, 2013

How to rig if you can't weight

Oh for the humanity, how many times will I forget that the weight tool in 3dsMax 2012 is bugged and requires a patch?

Well I guess that's the whole point of making these notes.

Lexluthernumber1 is still by far the best resource for in depth useful how to's for instance when all you want to know is where to stick your bone.