<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Allar's AWESOME Blog</title>
	
	<link>http://forecourse.com</link>
	<description>Life as an unresolved external symbol.</description>
	<lastBuildDate>Wed, 17 Mar 2010 06:26:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AllarsAwesomeBlog" /><feedburner:info uri="allarsawesomeblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Introduction</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/-gzxQCGyjXA/</link>
		<comments>http://forecourse.com/2010/03/introduction/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 06:09:54 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[about]]></category>
		<category><![CDATA[allar]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[what]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=326</guid>
		<description><![CDATA[






Extended Audio Version
A .mp3 of me rambling about what I&#8217;m doing.
Brief Written Version
I am Michael Allar, and I am Lead Programmer for The Hunt, a game being developed under a student group at The Art Institute of Orange County by the name of queSPECK.
My goal here with my site is to create a tutorial series [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h3>Extended Audio Version</h3>
<p><a href="http://www.forecourse.com/unreal/UDKIntroduction/UDKIntroduction.mp3">A .mp3 of me rambling about what I&#8217;m doing.</a></p>
<h3>Brief Written Version</h3>
<p>I am Michael Allar, and I am Lead Programmer for The Hunt, a game being developed under a student group at The Art Institute of Orange County by the name of queSPECK.</p>
<p>My goal here with my site is to create a tutorial series that will show one how to start from scratch and to end up with a playable result, teaching them what they need to know along the way to implement their own designs.</p>
<p>I highly recommend using the February build when following these tutorials, as long the way you will migrate to March and any other future builds that may come out during this process. However you can start with what ever version you want, there just might be a few things you need to rework in some parts.</p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fintroduction%2F&amp;linkname=Introduction">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/pObmYvONh_tTU6t8MbgAK-KCRLM/0/da"><img src="http://feedads.g.doubleclick.net/~a/pObmYvONh_tTU6t8MbgAK-KCRLM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/pObmYvONh_tTU6t8MbgAK-KCRLM/1/da"><img src="http://feedads.g.doubleclick.net/~a/pObmYvONh_tTU6t8MbgAK-KCRLM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/-gzxQCGyjXA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKIntroduction/UDKIntroduction.mp3" length="3609972" type="audio/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/introduction/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Migrating From February to March</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/SMgNo710wYw/</link>
		<comments>http://forecourse.com/2010/03/migrating-from-february-to-march/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 05:36:45 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[february]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[GameInfo]]></category>
		<category><![CDATA[march]]></category>
		<category><![CDATA[migrating]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapon]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=320</guid>
		<description><![CDATA[
Video Version
Subject: Migrating From February to March
Skill Level: Beginner
Run-Time: 30 Minutes
Author: Michael Allar
Notes: Migrating our code base from Feb. to March.
Streaming:     720×480 1920×1080
Download:     Low-Res (117MB) Hi-Res (167MB)
Written Version
Subject: Migrating From February to March
Skill Level: Beginner
Author: Michael Allar
Notes: Migrating our code base from Feb. to March.
See video for an in-depth explanation. Sorry about the indentation, it seems like [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: Migrating From February to March<br />
Skill Level: Beginner<br />
Run-Time: 30 Minutes<br />
Author: Michael Allar<br />
Notes: Migrating our code base from Feb. to March.</p>
<p>Streaming:     <a href="http://www.forecourse.com/unreal/UDKFebToMarch420/UDKFebToMarch420.html" class="broken_link" >720×480</a> <a href="http://www.forecourse.com/unreal/UDKFebToMarch/UDKFebToMarch.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKFebToMarch480/UDKFebToMarch480.mp4">Low-Res (117MB)</a> <a href="http://www.forecourse.com/unreal/UDKFebToMarch/UDKFebToMarch.mp4" target="_blank">Hi-Res (167MB)</a></p>
<h2>Written Version</h2>
<p>Subject: Migrating From February to March<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: Migrating our code base from Feb. to March.</p>
<p>See video for an in-depth explanation. Sorry about the indentation, it seems like my indentation will not survive copy paste… D: I will create a written tutorial soon.</p>
<p><span id="more-320"></span></p>
<h3>UDKGame</h3>
<pre class="brush: csharp;">/*******************************************************************************
 UDKGame

 Creation date: 14/01/2010 13:55
 Copyright (c) 2010, Michael Allar

*******************************************************************************/

class UDKGame extends GameInfo
 config(UDKGame);

static event class&lt;GameInfo&gt; SetGameType(string MapName, string Options, string Portal)
{
 local string ThisMapPrefix;
 local int i,pos;
 local class&lt;GameInfo&gt; NewGameType;

 `log(&quot;We are setting our game type.&quot;);
 if (Left(MapName, 10) ~= &quot;HTFrontEnd&quot;)
 {
 return class'UDKGame';
 }
 `log(&quot;We are not HTFrontEnd&quot;);

 // strip the UEDPIE_ from the filename, if it exists (meaning this is a Play in Editor game)
 if (Left(MapName, 6) ~= &quot;UEDPIE&quot;)
 {
 MapName = Right(MapName, Len(MapName) - 6);
 }
 else if ( Left(MapName, 5) ~= &quot;UEDPC&quot; )
 {
 MapName = Right(MapName, Len(MapName) - 5);
 }
 else if (Left(MapName, 6) ~= &quot;UEDPS3&quot;)
 {
 MapName = Right(MapName, Len(MapName) - 6);
 }
 else if (Left(MapName, 6) ~= &quot;UED360&quot;)
 {
 MapName = Right(MapName, Len(MapName) - 6);
 }

 // replace self with appropriate gametype if no game specified
 pos = InStr(MapName,&quot;-&quot;);
 ThisMapPrefix = left(MapName,pos);

 // change game type
 for ( i=0; i&lt;Default.DefaultMapPrefixes.Length; i++ )
 {
 `log(&quot;Going through a iteration of DefaultMapPrefixes&quot;);
 if ( Default.DefaultMapPrefixes[i].Prefix ~= ThisMapPrefix )
 {
 NewGameType = class&lt;GameInfo&gt;(DynamicLoadObject(Default.DefaultMapPrefixes[i].GameType,class'Class'));
 if ( NewGameType != None )
 {
 return NewGameType;
 }
 }
 }

 return class'UDKGame';
}

defaultproperties
{
 DefaultPawnClass=class'UDKGame.HTPawn'
 PlayerControllerClass=class'UDKGame.HTPlayerController'

 HUDType=class'UDKGame.HTHUD'
}
</pre>
<h3>HTWeapon</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTWeapon

 Creation date: 08/03/2010 06:21
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTWeapon extends UDKWeapon;

/** Max ammo count */
var int MaxAmmoCount;

/** Holds the amount of ammo used for a given shot */
var array&lt;int&gt; ShotCost;

/** Offset from view center */
var(FirstPerson) vector    PlayerViewOffset;

simulated event ReplicatedEvent(name VarName)
{
 if ( VarName == 'AmmoCount' )
 {
 if ( !HasAnyAmmo() )
 {
 WeaponEmpty();
 }
 }
 else
 {
 Super.ReplicatedEvent(VarName);
 }
}

simulated function int GetAmmoCount()
{
 return AmmoCount;
}
 /*
 * Consumes some of the ammo
 */
function ConsumeAmmo( byte FireModeNum )
{
 // Subtract the Ammo
 AddAmmo(-ShotCost[FireModeNum]);
}

/**
 * This function is used to add ammo back to a weapon.  It's called from the Inventory Manager
 */
function int AddAmmo( int Amount )
{
 AmmoCount = Clamp(AmmoCount + Amount,0,MaxAmmoCount);
 return AmmoCount;
}

/**
 * Returns true if the ammo is maxed out
 */
simulated function bool AmmoMaxed(int mode)
{
 return (AmmoCount &gt;= MaxAmmoCount);
}

/**
 * This function checks to see if the weapon has any ammo available for a given fire mode.
 *
 * @param    FireModeNum        - The Fire Mode to Test For
 * @param    Amount            - [Optional] Check to see if this amount is available.  If 0 it will default to checking
 *                              for the ShotCost
 */
simulated function bool HasAmmo( byte FireModeNum, optional int Amount )
{
 if (Amount==0)
 return (AmmoCount &gt;= ShotCost[FireModeNum]);
 else
 return ( AmmoCount &gt;= Amount );
}

/**
 * returns true if this weapon has any ammo
 */
simulated function bool HasAnyAmmo()
{
 return ( ( AmmoCount &gt; 0 ) || (ShotCost[0]==0 &amp;&amp; ShotCost[1]==0) );
}

/**
 * This function retuns how much of the clip is empty.
 */
simulated function float DesireAmmo(bool bDetour)
{
 return (1.f - float(AmmoCount)/MaxAmmoCount);
}

/**
 * Returns true if the current ammo count is less than the default ammo count
 */
simulated function bool NeedAmmo()
{
 return ( AmmoCount &lt; Default.AmmoCount );
}

/**
 * Cheat Help function the loads out the weapon
 *
 * @param     bUseWeaponMax     - [Optional] If true, this function will load out the weapon
 *                              with the actual maximum, not 999
 */
simulated function Loaded(optional bool bUseWeaponMax)
{
 if (bUseWeaponMax)
 AmmoCount = MaxAmmoCount;
 else
 AmmoCount = 999;
}

/**
 * Called when the weapon runs out of ammo during firing
 */
simulated function WeaponEmpty()
{
 // If we were firing, stop
 if ( IsFiring() )
 {
 GotoState('Active');
 }

 if ( Instigator != none &amp;&amp; Instigator.IsLocallyControlled() )
 {
 Instigator.InvManager.SwitchToBestWeapon( true );
 }
}

/*********************************************************************************************
 * Ammunition / Inventory
 *********************************************************************************************/

function PrintScreenDebug(string debugText)
{
 local PlayerController PC;
 PC = PlayerController(Pawn(Owner).Controller);
 if (PC != None)
 PC.ClientMessage(&quot;HTWeapon: &quot; $ debugText);
}

simulated function AttachWeaponTo( SkeletalMeshComponent MeshCpnt, optional Name SocketName )
{
 local HTPawn HTP;

 HTP = HTPawn(Instigator);
 PrintScreenDebug(&quot;Attaching Weapon&quot;);
 // Attach 1st Person Muzzle Flashes, etc,
 if ( Instigator.IsFirstPerson() )
 {
 AttachComponent(Mesh);
 EnsureWeaponOverlayComponentLast();
 SetHidden(False);
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 PrintScreenDebug(&quot;First Person Weapon Attached&quot;);
 }
 else
 {
 SetHidden(True);
 if (HTP != None)
 {
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 }
 }
 //SetSkin(HTPawn(Instigator).ReplicatedBodyMaterial);
}

simulated event SetPosition(UDKPawn Holder)
{
 local vector DrawOffset, ViewOffset, FinalLocation;
 local rotator NewRotation, FinalRotation, SpecRotation;
 local PlayerController PC;
 local vector2D ViewportSize;
 local bool bIsWideScreen;
 local vector SpecViewLoc;

 if ( !Holder.IsFirstPerson() )
 return;

 Mesh.SetHidden(False);

 foreach LocalPlayerControllers(class'PlayerController', PC)
 {
 LocalPlayer(PC.Player).ViewportClient.GetViewportSize(ViewportSize);
 break;
 }
 bIsWideScreen = (ViewportSize.Y &gt; 0.f) &amp;&amp; (ViewportSize.X/ViewportSize.Y &gt; 1.7);

 Mesh.SetScale3D(default.Mesh.Scale3D);
 Mesh.SetRotation(default.Mesh.Rotation);

 ViewOffset = PlayerViewOffset;

 // Calculate the draw offset
 if ( Holder.Controller == None )
 {

 if ( DemoRecSpectator(PC) != None )
 {
 PC.GetPlayerViewPoint(SpecViewLoc, SpecRotation);
 DrawOffset = ViewOffset &gt;&gt; SpecRotation;
 //DrawOffset += UTPawn(Holder).WeaponBob(BobDamping, JumpDamping);
 FinalLocation = SpecViewLoc + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 // Add some rotation leading
 //SpecRotation.Yaw = LagRot(SpecRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //SpecRotation.Pitch = LagRot(SpecRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = SpecRotation;

 if ( bIsWideScreen )
 {
 //SpecRotation += WidescreenRotationOffset;
 }
 SetRotation(SpecRotation);
 return;
 }
 else
 {
 DrawOffset = (ViewOffset &gt;&gt; Holder.GetBaseAimRotation()) + HTPawn(Holder).GetEyeHeight() * vect(0,0,1);
 PrintScreenDebug(&quot;Setting DrawOffset to Holder Info&quot;);
 }
 }
 else
 {

 DrawOffset.Z = HTPawn(Holder).GetEyeHeight();
 //DrawOffset += HTPawn(Holder).WeaponBob(BobDamping, JumpDamping);

 if ( HTPlayerController(Holder.Controller) != None )
 {
 DrawOffset += HTPlayerController(Holder.Controller).ShakeOffset &gt;&gt; Holder.Controller.Rotation;
 }

 DrawOffset = DrawOffset + ( ViewOffset &gt;&gt; Holder.Controller.Rotation );
 }

 // Adjust it in the world
 FinalLocation = Holder.Location + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 NewRotation = (Holder.Controller == None) ? Holder.GetBaseAimRotation() : Holder.Controller.Rotation;

 // Add some rotation leading
 //if (Holder.Controller != None)
 //{
 //    FinalRotation.Yaw = LagRot(NewRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //    FinalRotation.Pitch = LagRot(NewRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //    FinalRotation.Roll = NewRotation.Roll;
 //}
 //else
 //{
 FinalRotation = NewRotation;
 //}
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = NewRotation;

 if ( bIsWideScreen )
 {
 //FinalRotation += WidescreenRotationOffset;
 }
 SetRotation(FinalRotation);
}

simulated state WeaponEquipping
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Weapon Equipping&quot;);
 AttachWeaponTo(Instigator.Mesh);
 Super.BeginState(PreviousStateName);
 }
}

simulated state Active
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Active&quot;);
 Super.BeginState(PreviousStateName);
 }
}

simulated state WeaponFiring
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Firing&quot;);
 Super.BeginState(PreviousStateName);
 }

 /**
 * We override BeginFire() so that we can check for zooming and/or empty weapons
 */

 simulated function BeginFire( Byte FireModeNum )
 {
 // No Ammo, then do a quick exit.
 if( !HasAmmo(FireModeNum) )
 {
 WeaponEmpty();
 return;
 }
 Global.BeginFire(FireModeNum);
 }
}

defaultproperties
{
 Begin Object Name=FirstPersonMesh
 DepthPriorityGroup=SDPG_Foreground
 bOnlyOwnerSee=true
 bOverrideAttachmentOwnerVisibility=true
 CastShadow=false
 bAllowAmbientOcclusion=false
 End Object
 Mesh=FirstPersonMesh

 Begin Object Name=PickupMesh
 bOnlyOwnerSee=false
 CastShadow=false
 bForceDirectLightMap=true
 bCastDynamicShadow=false
 CollideActors=false
 BlockRigidBody=false
 bUseAsOccluder=false
 MaxDrawDistance=6000
 bForceRefPose=1
 bUpdateSkelWhenNotRendered=false
 bIgnoreControllersWhenNotRendered=true
 bAcceptsStaticDecals=FALSE
 bAcceptsDynamicDecals=FALSE
 bAllowAmbientOcclusion=false
 End Object
 DroppedPickupMesh=PickupMesh
 PickupFactoryMesh=PickupMesh

 MessageClass=class'UTPickupMessage'
 DroppedPickupClass=class'UTDroppedPickup'

 FiringStatesArray(0)=WeaponFiring
 FiringStatesArray(1)=WeaponFiring

 WeaponFireTypes(0)=EWFT_InstantHit
 WeaponFireTypes(1)=EWFT_InstantHit

 WeaponProjectiles(0)=none
 WeaponProjectiles(1)=none

 FireInterval(0)=+0.3
 FireInterval(1)=+0.3

 Spread(0)=0.0
 Spread(1)=0.0

 ShotCost(0)=1
 ShotCost(1)=1

 AmmoCount=5
 MaxAmmoCount=5

 InstantHitDamage(0)=0.0
 InstantHitDamage(1)=0.0
 InstantHitMomentum(0)=0.0
 InstantHitMomentum(1)=0.0
 InstantHitDamageTypes(0)=class'DamageType'
 InstantHitDamageTypes(1)=class'DamageType'
 WeaponRange=22000

 ShouldFireOnRelease(0)=0
 ShouldFireOnRelease(1)=0

 DefaultAnimSpeed=0.9

 EquipTime=+0.45
 PutDownTime=+0.33
}</pre>
<h3>DefaultGame.ini</h3>
<pre class="brush: csharp;">[Engine.GameInfo]
DefaultGame=UDKGame.UDKGame
DefaultServerGame=UDKGame.UDKGame
PlayerControllerClassName=UDKGame.HTPlayerController
GameDifficulty=+1.0
MaxPlayers=32
DefaultMapPrefixes=(Prefix=&quot;HT&quot;,GameType=&quot;UDKGame.TheHuntGame&quot;)</pre>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fmigrating-from-february-to-march%2F&amp;linkname=Migrating%20From%20February%20to%20March">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/ifUfh3IZX_BVI1o5iqWRcafPdAY/0/da"><img src="http://feedads.g.doubleclick.net/~a/ifUfh3IZX_BVI1o5iqWRcafPdAY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ifUfh3IZX_BVI1o5iqWRcafPdAY/1/da"><img src="http://feedads.g.doubleclick.net/~a/ifUfh3IZX_BVI1o5iqWRcafPdAY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/SMgNo710wYw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/migrating-from-february-to-march/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKFebToMarch480/UDKFebToMarch480.mp4" length="119283998" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKFebToMarch/UDKFebToMarch.mp4" length="167395979" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/migrating-from-february-to-march/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Return from GDC 2010</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/MXX3X4BVba8/</link>
		<comments>http://forecourse.com/2010/03/return-from-gdc-2010/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:01:29 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Site]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[expo]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[GDC]]></category>
		<category><![CDATA[san francisco]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=316</guid>
		<description><![CDATA[I&#8217;ve just gotten back from the Game Developer&#8217;s Conference in San Francisco, and it was pretty amazing. I shall resume my tutorial series tomorrow (March 16th) so be welcome to post feedback and what I can do to make it better around here. I will post more about GDC as well when I am feeling [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1-->I&#8217;ve just gotten back from the Game Developer&#8217;s Conference in San Francisco, and it was pretty amazing. I shall resume my tutorial series tomorrow (March 16th) so be welcome to post feedback and what I can do to make it better around here. I will post more about GDC as well when I am feeling a bit better as I caught some sort of sore throat during my time in San Francisco. Until then, happy development!</p>
<p><a href="http://forecourse.com/wp-content/uploads/2010/03/0311100804_01.jpg#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="size-medium wp-image-317 alignleft" title="Michael Allar + Expo Pass" src="http://forecourse.com/wp-content/uploads/2010/03/0311100804_01-300x225.jpg" alt="" width="300" height="225" /></a></p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Freturn-from-gdc-2010%2F&amp;linkname=Return%20from%20GDC%202010">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/WD9C_FRCz0lQExeDLZOjwWS2VEg/0/da"><img src="http://feedads.g.doubleclick.net/~a/WD9C_FRCz0lQExeDLZOjwWS2VEg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WD9C_FRCz0lQExeDLZOjwWS2VEg/1/da"><img src="http://feedads.g.doubleclick.net/~a/WD9C_FRCz0lQExeDLZOjwWS2VEg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/MXX3X4BVba8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/return-from-gdc-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://forecourse.com/2010/03/return-from-gdc-2010/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>HTHUD: Part 1 – Building The Base Class + Displaying Ammo</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/I_aTdtHbV_8/</link>
		<comments>http://forecourse.com/2010/03/hthud-part-1-building-the-base-class-displaying-ammo/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:00:44 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[ammo]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[draw]]></category>
		<category><![CDATA[HTHUD]]></category>
		<category><![CDATA[HTWeapon]]></category>
		<category><![CDATA[HUD]]></category>
		<category><![CDATA[m16]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapons]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=308</guid>
		<description><![CDATA[
Video Version
Subject: HTHUD: Part 1 &#8211; Building The Base Class + Displaying Ammo
Skill Level: Beginner
Run-Time: 1 Hour and 30 Minutes
Author: Michael Allar
Notes: Creating a new HUD class and having it display our current weapons ammo.
Streaming:     720×480 1920×1080
Download:     Low-Res   (236MB) Hi-Res (337MB)
Written Version
Subject: HTHUD: Part 1 &#8211; Building The Base Class + Displaying Ammo
Skill [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: HTHUD: Part 1 &#8211; Building The Base Class + Displaying Ammo<br />
Skill Level: Beginner<br />
Run-Time: 1 Hour and 30 Minutes<br />
Author: Michael Allar<br />
Notes: Creating a new HUD class and having it display our current weapons ammo.</p>
<p>Streaming:     <a href="http://www.forecourse.com/unreal/UDKHTHUDPart1720/UDKHTHUDPart1720.html">720×480</a> <a href="http://www.forecourse.com/unreal/UDKHTHUDPart1/UDKHTHUDPart1.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKHTHUDPart1720/UDKHTHUDPart1720.mp4">Low-Res   (236MB)</a> <a href="http://www.forecourse.com/unreal/UDKHTHUDPart1/UDKHTHUDPart1.mp4" target="_blank">Hi-Res (337MB)</a></p>
<h2>Written Version</h2>
<p>Subject: HTHUD: Part 1 &#8211; Building The Base Class + Displaying Ammo<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: Creating a new HUD class and having it display our current weapons ammo.</p>
<p>See video for an in-depth explanation. Sorry about the indentation,  it seems like my indentation will not survive copy paste… D: I will create a written tutorial soon.</p>
<p><span id="more-308"></span></p>
<h3>HTHUD</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTHUD

 Creation date: 09/03/2010 05:04
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTHUD extends UDKHUD;

/** The Pawn that is currently owning this hud */
var Pawn PawnOwner;

/** Points to the UT Pawn.  Will be resolved if in a vehicle */
var HTPawn HTPawnOwner;

/** Cached reference to the another hud texture */
var const Texture2D HudTexture;

var linearcolor HudTint;

var bool bShowAmmo;
var vector2d AmmoPosition;
var TextureCoordinates AmmoBGCoords;

/** Resolution dependent HUD scaling factor */
var float HUDScaleX, HUDScaleY;
/** Holds the scaling factor given the current resolution.  This is calculated in PostRender() */
var float ResolutionScale, ResolutionScaleX;

/** The percentage of the view that should be considered safe */
var float SafeRegionPct;
/** Holds the full width and height of the viewport */
var float FullWidth, FullHeight;

/**
 * Perform any value precaching, and set up various safe regions
 *
 * NOTE: NO DRAWING should ever occur in PostRender.  Put all drawing code in DrawHud().
 */
event PostRender()
{
 PawnOwner = Pawn(PlayerOwner.ViewTarget);
 if ( PawnOwner == None )
 {
 PawnOwner = PlayerOwner.Pawn;
 }

 HTPawnOwner = HTPawn(PawnOwner);

 // draw any debug text in real-time
 PlayerOwner.DrawDebugTextList(Canvas,RenderDelta);

 HUDScaleX = Canvas.ClipX/1280;
 HUDScaleY = Canvas.ClipX/1280;

 ResolutionScaleX = Canvas.ClipX/1024;
 ResolutionScale = Canvas.ClipY/768;

 FullWidth = Canvas.ClipX;
 FullHeight = Canvas.ClipY;

 if ( bShowHud )
 {
 DrawHud();
 }

 // let iphone draw any always present overlays
 DrawInputOverlays();
}

/**
 * This is the main drawing pump.  It will determine which hud we need to draw (Game or PostGame).  Any drawing that should occur
 * regardless of the game state should go here.
 */
function DrawHUD()
{
 local float x,y,w,h;

 // Create the safe region
 w = FullWidth * SafeRegionPct;
 X = Canvas.OrgX + (Canvas.ClipX - w) * 0.5;

 // We have some extra logic for figuring out how things should be displayed
 // in split screen.

 h = FullHeight * SafeRegionPct;

 Y = Canvas.OrgY + (Canvas.ClipY - h) * 0.5;

 Canvas.OrgX = X;
 Canvas.OrgY = Y;
 Canvas.ClipX = w;
 Canvas.ClipY = h;
 Canvas.Reset(true);

 // Set up delta time
 RenderDelta = WorldInfo.TimeSeconds - LastHUDRenderTime;
 LastHUDRenderTime = WorldInfo.TimeSeconds;

 PlayerOwner.DrawHud( Self );
 if (bShowGameHUD)
 {
 DrawGameHud();
 }
}

function DrawGameHud()
{
 DrawLivingHud();
}

/**
 * Anything drawn in this function will be displayed ONLY when the player is living.
 */
function DrawLivingHud()
{
 local HTWeapon Weapon;

 // Manage the weapon.  NOTE: Vehicle weapons are managed by the vehicle
 // since they are integrated in to the vehicle health bar
 if( PawnOwner != none )
 {
 if ( bShowAmmo )
 {
 Weapon = HTWeapon(PawnOwner.Weapon);
 if ( Weapon != none )
 {
 DisplayAmmo(Weapon);
 }
 }
 }
}

function DisplayAmmo(HTWeapon Weapon)
{
 local vector2d POS;
 local string Amount;
 local int AmmoCount;

 // Resolve the position
 POS = ResolveHudPosition(AmmoPosition,AmmoBGCoords.UL,AmmoBGCoords.VL);

 // Figure out if we should be pulsing
 AmmoCount = Weapon.GetAmmoCount();

 // Draw the background
 Canvas.SetPos(POS.X,POS.Y);// - (AmmoBarOffsetY * ResolutionScale));
 Canvas.DrawColorizedTile(HudTexture, AmmoBGCoords.UL * ResolutionScale, AmmoBGCoords.VL * ResolutionScale, AmmoBGCoords.U, AmmoBGCoords.V, AmmoBGCoords.UL, AmmoBGCoords.VL, HudTint);

 // Draw the amount
 Amount = &quot;&quot;$AmmoCount;
 Canvas.DrawColor = WhiteColor;
 Canvas.DrawText(Amount,,3.0f,3.0f);
}

/**
 * Given a default screen position (at 1024x768) this will return the hud position at the current resolution.
 * NOTE: If the default position value is &lt; 0.0f then it will attempt to place the right/bottom face of
 * the &quot;widget&quot; at that offset from the ClipX/Y.
 *
 * @Param Position        The default position (in 1024x768 space)
 * @Param Width            How wide is this &quot;widget&quot; at 1024x768
 * @Param Height        How tall is this &quot;widget&quot; at 1024x768
 *
 * @returns the hud position
 */
function Vector2D ResolveHUDPosition(vector2D Position, float Width, float Height)
{
 local vector2D FinalPos;
 FinalPos.X = (Position.X &lt; 0) ? Canvas.ClipX - (Position.X * ResolutionScale) - (Width * ResolutionScale)  : Position.X * ResolutionScale;
 FinalPos.Y = (Position.Y &lt; 0) ? Canvas.ClipY - (Position.Y * ResolutionScale) - (Height * ResolutionScale) : Position.Y * ResolutionScale;

 return FinalPos;
}

defaultproperties
{
 HudTexture=Texture2D'HTUI.Textures.T_UI_HUD_BaseA'

 HudTint=(R=1.0f,G=1.0f,B=1.0f,A=1.0f)

 AmmoPosition=(X=0,Y=-1)
 AmmoBGCoords=(U=0,UL=76,V=0,VL=126)

 SafeRegionPct = 1.0f

 bShowAmmo=true
}</pre>
<h3>UDKGame</h3>
<p>Update your defaultproperties as shown:</p>
<pre class="brush: csharp;">defaultproperties
{
 DefaultPawnClass=class'UDKGame.HTPawn'
 PlayerControllerClass=class'UDKGame.HTPlayerController'
 HUDType=class'UDKGame.HTHUD'

 DefaultMapPrefixes(0)=(Prefix=&quot;HT&quot;,GameType=&quot;UDKGame.TheHuntGame&quot;)
}</pre>
<h3>T_UI_HUD_BaseA.psd</h3>
<p>Compressed into a .zip file.</p>
<p><a href="http://www.forecourse.com/unreal/T_UI_HUD_BaseA.zip" target="_blank">T_UI_HUD_BaseA.zip</a></p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fhthud-part-1-building-the-base-class-displaying-ammo%2F&amp;linkname=HTHUD%3A%20Part%201%20%26%238211%3B%20Building%20The%20Base%20Class%20%2B%20Displaying%20Ammo">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/rK3y91VlijIJBSbG7sA2Q-Jf_80/0/da"><img src="http://feedads.g.doubleclick.net/~a/rK3y91VlijIJBSbG7sA2Q-Jf_80/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/rK3y91VlijIJBSbG7sA2Q-Jf_80/1/da"><img src="http://feedads.g.doubleclick.net/~a/rK3y91VlijIJBSbG7sA2Q-Jf_80/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/I_aTdtHbV_8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/hthud-part-1-building-the-base-class-displaying-ammo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1720/UDKBuildingHTWeaponPart1720.mp4" length="109607532" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKHTHUDPart1/UDKHTHUDPart1.mp4" length="337266496" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKHTHUDPart1720/UDKHTHUDPart1720.mp4" length="236435451" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/hthud-part-1-building-the-base-class-displaying-ammo/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>HTWeapon: Part 1 – Adding Ammo</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/sNWDLqJy4TM/</link>
		<comments>http://forecourse.com/2010/03/htweapon-part-1-adding-ammo/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:14:26 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[ammo]]></category>
		<category><![CDATA[HTWeapon]]></category>
		<category><![CDATA[m16]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapons]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=298</guid>
		<description><![CDATA[
Video Version
Subject: HTWeapon: Part 1 &#8211; Adding Ammo
Skill Level: Beginner
Run-Time: 30 minutes
Author: Michael Allar
Notes: How to implement a very basic ammo system in our custom weapon class, taking code from UTWeapon.
Streaming:     720×480 1920×1080
Download:     Low-Res  (66MB) Hi-Res (200MB)
Written Version
Subject: HTWeapon: Part 1 &#8211; Adding Ammo
Skill Level: Beginner
Author: Michael Allar
Notes: How to implement a very basic [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: HTWeapon: Part 1 &#8211; Adding Ammo<br />
Skill Level: Beginner<br />
Run-Time: 30 minutes<br />
Author: Michael Allar<br />
Notes: How to implement a very basic ammo system in our custom weapon class, taking code from UTWeapon.</p>
<p>Streaming:     <a href="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1720/UDKBuildingHTWeaponPart1720.html">720×480</a> <a href="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1/UDKBuildingHTWeaponPart1.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1720/UDKBuildingHTWeaponPart1720.mp4">Low-Res  (66MB)</a> <a href="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1/UDKBuildingHTWeaponPart1.mp4" target="_blank">Hi-Res (200MB)</a></p>
<h2>Written Version</h2>
<p>Subject: HTWeapon: Part 1 &#8211; Adding Ammo<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: How to implement a very basic ammo system in our custom weapon  class, taking code from UTWeapon.</p>
<p>See video for an in-depth explanation. Sorry about the indentation, it seems like my indentation will not survive copy paste&#8230; D:</p>
<p><span id="more-298"></span></p>
<h3>HTWeapon</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTWeapon

 Creation date: 08/03/2010 06:21
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTWeapon extends UDKWeapon;

/** Current ammo count */
var repnotify int AmmoCount;

/** Max ammo count */
var int MaxAmmoCount;

/** Holds the amount of ammo used for a given shot */
var array&lt;int&gt; ShotCost;

/** Offset from view center */
var(FirstPerson) vector    PlayerViewOffset;

replication
{
 // Server-&gt;Client properties
 if ( bNetOwner )
 AmmoCount;
}

simulated event ReplicatedEvent(name VarName)
{
 if ( VarName == 'AmmoCount' )
 {
 if ( !HasAnyAmmo() )
 {
 WeaponEmpty();
 }
 }
 else
 {
 Super.ReplicatedEvent(VarName);
 }
}

simulated function int GetAmmoCount()
{
 return AmmoCount;
}
 /*
 * Consumes some of the ammo
 */
function ConsumeAmmo( byte FireModeNum )
{
 // Subtract the Ammo
 AddAmmo(-ShotCost[FireModeNum]);
}

/**
 * This function is used to add ammo back to a weapon.  It's called from the Inventory Manager
 */
function int AddAmmo( int Amount )
{
 AmmoCount = Clamp(AmmoCount + Amount,0,MaxAmmoCount);
 return AmmoCount;
}

/**
 * Returns true if the ammo is maxed out
 */
simulated function bool AmmoMaxed(int mode)
{
 return (AmmoCount &gt;= MaxAmmoCount);
}

/**
 * This function checks to see if the weapon has any ammo available for a given fire mode.
 *
 * @param    FireModeNum        - The Fire Mode to Test For
 * @param    Amount            - [Optional] Check to see if this amount is available.  If 0 it will default to checking
 *                              for the ShotCost
 */
simulated function bool HasAmmo( byte FireModeNum, optional int Amount )
{
 if (Amount==0)
 return (AmmoCount &gt;= ShotCost[FireModeNum]);
 else
 return ( AmmoCount &gt;= Amount );
}

/**
 * returns true if this weapon has any ammo
 */
simulated function bool HasAnyAmmo()
{
 return ( ( AmmoCount &gt; 0 ) || (ShotCost[0]==0 &amp;&amp; ShotCost[1]==0) );
}

/**
 * This function retuns how much of the clip is empty.
 */
simulated function float DesireAmmo(bool bDetour)
{
 return (1.f - float(AmmoCount)/MaxAmmoCount);
}

/**
 * Returns true if the current ammo count is less than the default ammo count
 */
simulated function bool NeedAmmo()
{
 return ( AmmoCount &lt; Default.AmmoCount );
}

/**
 * Cheat Help function the loads out the weapon
 *
 * @param     bUseWeaponMax     - [Optional] If true, this function will load out the weapon
 *                              with the actual maximum, not 999
 */
simulated function Loaded(optional bool bUseWeaponMax)
{
 if (bUseWeaponMax)
 AmmoCount = MaxAmmoCount;
 else
 AmmoCount = 999;
}

/**
 * Called when the weapon runs out of ammo during firing
 */
simulated function WeaponEmpty()
{
 // If we were firing, stop
 if ( IsFiring() )
 {
 GotoState('Active');
 }

 if ( Instigator != none &amp;&amp; Instigator.IsLocallyControlled() )
 {
 Instigator.InvManager.SwitchToBestWeapon( true );
 }
}

/*********************************************************************************************
 * Ammunition / Inventory
 *********************************************************************************************/

function PrintScreenDebug(string debugText)
{
 local PlayerController PC;
 PC = PlayerController(Pawn(Owner).Controller);
 if (PC != None)
 PC.ClientMessage(&quot;HTWeapon: &quot; $ debugText);
}

simulated function AttachWeaponTo( SkeletalMeshComponent MeshCpnt, optional Name SocketName )
{
 local HTPawn HTP;

 HTP = HTPawn(Instigator);
 PrintScreenDebug(&quot;Attaching Weapon&quot;);
 // Attach 1st Person Muzzle Flashes, etc,
 if ( Instigator.IsFirstPerson() )
 {
 AttachComponent(Mesh);
 EnsureWeaponOverlayComponentLast();
 SetHidden(False);
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 PrintScreenDebug(&quot;First Person Weapon Attached&quot;);
 }
 else
 {
 SetHidden(True);
 if (HTP != None)
 {
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 }
 }
 //SetSkin(HTPawn(Instigator).ReplicatedBodyMaterial);
}

simulated event SetPosition(UDKPawn Holder)
{
 local vector DrawOffset, ViewOffset, FinalLocation;
 local rotator NewRotation, FinalRotation, SpecRotation;
 local PlayerController PC;
 local vector2D ViewportSize;
 local bool bIsWideScreen;
 local vector SpecViewLoc;

 if ( !Holder.IsFirstPerson() )
 return;

 Mesh.SetHidden(False);

 foreach LocalPlayerControllers(class'PlayerController', PC)
 {
 LocalPlayer(PC.Player).ViewportClient.GetViewportSize(ViewportSize);
 break;
 }
 bIsWideScreen = (ViewportSize.Y &gt; 0.f) &amp;&amp; (ViewportSize.X/ViewportSize.Y &gt; 1.7);

 Mesh.SetScale3D(default.Mesh.Scale3D);
 Mesh.SetRotation(default.Mesh.Rotation);

 ViewOffset = PlayerViewOffset;

 // Calculate the draw offset
 if ( Holder.Controller == None )
 {

 if ( DemoRecSpectator(PC) != None )
 {
 PC.GetPlayerViewPoint(SpecViewLoc, SpecRotation);
 DrawOffset = ViewOffset &gt;&gt; SpecRotation;
 //DrawOffset += UTPawn(Holder).WeaponBob(BobDamping, JumpDamping);
 FinalLocation = SpecViewLoc + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 // Add some rotation leading
 //SpecRotation.Yaw = LagRot(SpecRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //SpecRotation.Pitch = LagRot(SpecRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = SpecRotation;

 if ( bIsWideScreen )
 {
 //SpecRotation += WidescreenRotationOffset;
 }
 SetRotation(SpecRotation);
 return;
 }
 else
 {
 DrawOffset = (ViewOffset &gt;&gt; Holder.GetBaseAimRotation()) + HTPawn(Holder).GetEyeHeight() * vect(0,0,1);
 PrintScreenDebug(&quot;Setting DrawOffset to Holder Info&quot;);
 }
 }
 else
 {

 DrawOffset.Z = HTPawn(Holder).GetEyeHeight();
 //DrawOffset += HTPawn(Holder).WeaponBob(BobDamping, JumpDamping);

 if ( HTPlayerController(Holder.Controller) != None )
 {
 DrawOffset += HTPlayerController(Holder.Controller).ShakeOffset &gt;&gt; Holder.Controller.Rotation;
 }

 DrawOffset = DrawOffset + ( ViewOffset &gt;&gt; Holder.Controller.Rotation );
 }

 // Adjust it in the world
 FinalLocation = Holder.Location + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 NewRotation = (Holder.Controller == None) ? Holder.GetBaseAimRotation() : Holder.Controller.Rotation;

 // Add some rotation leading
 //if (Holder.Controller != None)
 //{
 //    FinalRotation.Yaw = LagRot(NewRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //    FinalRotation.Pitch = LagRot(NewRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //    FinalRotation.Roll = NewRotation.Roll;
 //}
 //else
 //{
 FinalRotation = NewRotation;
 //}
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = NewRotation;

 if ( bIsWideScreen )
 {
 //FinalRotation += WidescreenRotationOffset;
 }
 SetRotation(FinalRotation);
}

simulated state WeaponEquipping
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Weapon Equipping&quot;);
 AttachWeaponTo(Instigator.Mesh);
 Super.BeginState(PreviousStateName);
 }
}

simulated state Active
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Active&quot;);
 Super.BeginState(PreviousStateName);
 }
}

simulated state WeaponFiring
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Firing&quot;);
 Super.BeginState(PreviousStateName);
 }

 /**
 * We override BeginFire() so that we can check for zooming and/or empty weapons
 */

 simulated function BeginFire( Byte FireModeNum )
 {
 // No Ammo, then do a quick exit.
 if( !HasAmmo(FireModeNum) )
 {
 WeaponEmpty();
 return;
 }
 Global.BeginFire(FireModeNum);
 }
}

defaultproperties
{
 Begin Object Name=FirstPersonMesh
 DepthPriorityGroup=SDPG_Foreground
 bOnlyOwnerSee=true
 bOverrideAttachmentOwnerVisibility=true
 CastShadow=false
 bAllowAmbientOcclusion=false
 End Object
 Mesh=FirstPersonMesh

 Begin Object Name=PickupMesh
 bOnlyOwnerSee=false
 CastShadow=false
 bForceDirectLightMap=true
 bCastDynamicShadow=false
 CollideActors=false
 BlockRigidBody=false
 bUseAsOccluder=false
 MaxDrawDistance=6000
 bForceRefPose=1
 bUpdateSkelWhenNotRendered=false
 bIgnoreControllersWhenNotRendered=true
 bAcceptsStaticDecals=FALSE
 bAcceptsDynamicDecals=FALSE
 bAllowAmbientOcclusion=false
 End Object
 DroppedPickupMesh=PickupMesh
 PickupFactoryMesh=PickupMesh

 MessageClass=class'UTPickupMessage'
 DroppedPickupClass=class'UTDroppedPickup'

 FiringStatesArray(0)=WeaponFiring
 FiringStatesArray(1)=WeaponFiring

 WeaponFireTypes(0)=EWFT_InstantHit
 WeaponFireTypes(1)=EWFT_InstantHit

 WeaponProjectiles(0)=none
 WeaponProjectiles(1)=none

 FireInterval(0)=+0.3
 FireInterval(1)=+0.3

 Spread(0)=0.0
 Spread(1)=0.0

 ShotCost(0)=1
 ShotCost(1)=1

 AmmoCount=5
 MaxAmmoCount=5

 InstantHitDamage(0)=0.0
 InstantHitDamage(1)=0.0
 InstantHitMomentum(0)=0.0
 InstantHitMomentum(1)=0.0
 InstantHitDamageTypes(0)=class'DamageType'
 InstantHitDamageTypes(1)=class'DamageType'
 WeaponRange=22000

 ShouldFireOnRelease(0)=0
 ShouldFireOnRelease(1)=0

 DefaultAnimSpeed=0.9

 EquipTime=+0.45
 PutDownTime=+0.33
}</pre>
<h3>HTWP_M16</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTWP_M16

 Creation date: 08/03/2010 06:48
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTWP_M16 extends HTWeapon;

defaultproperties
{
 // Weapon SkeletalMesh
 Begin Object Name=FirstPersonMesh
 SkeletalMesh=SkeletalMesh'ALWP_M16.Mesh.SK_WP_M16_1P'
 AnimSets(0)=AnimSet'ALWP_M16.Anims.K_WP_M16_1P'
 Scale=1.0
 FOV=60.0
 End Object

 // Pickup staticmesh
 Begin Object Name=PickupMesh
 SkeletalMesh=SkeletalMesh'ALWP_M16.Mesh.SK_WP_M16_3P'
 End Object

 PlayerViewOffset=(X=17,Y=10.0,Z=-8.0)
}</pre>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fhtweapon-part-1-adding-ammo%2F&amp;linkname=HTWeapon%3A%20Part%201%20%26%238211%3B%20Adding%20Ammo">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/qm-YK2RStAxK9KesYAPwLbTrILU/0/da"><img src="http://feedads.g.doubleclick.net/~a/qm-YK2RStAxK9KesYAPwLbTrILU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qm-YK2RStAxK9KesYAPwLbTrILU/1/da"><img src="http://feedads.g.doubleclick.net/~a/qm-YK2RStAxK9KesYAPwLbTrILU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/sNWDLqJy4TM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/htweapon-part-1-adding-ammo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1720/UDKBuildingHTWeaponPart1720.mp4" length="109607532" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKBuildingHTWeaponPart1/UDKBuildingHTWeaponPart1.mp4" length="138843416" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/htweapon-part-1-adding-ammo/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Beginning Your Game Part 4</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/9ZMmDcSWspU/</link>
		<comments>http://forecourse.com/2010/03/beginning-your-game-part-4/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 08:53:50 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[beginning]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[empty]]></category>
		<category><![CDATA[fresh]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[GameInfo]]></category>
		<category><![CDATA[scratch]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[UDKGame]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=291</guid>
		<description><![CDATA[
Video Version
Subject: Beginning Your Game Part 4
Skill Level: Beginner
Run-Time: 54 Minutes
Author: Michael Allar
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon
Streaming:     720×480 1920×1080
Download:     Low-Res (32MB) Hi-Res (200MB)
Written Version
Subject: Beginning Your Game Part 4
Skill Level: Beginner
Author: Michael Allar
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon
See the video for an in-depth explanation.

HTInventoryManager
/*******************************************************************************

 HTInventoryManager

 Creation date: 08/03/2010 07:03

 Lots of code stolen from Epic
*******************************************************************************/

class HTInventoryManager [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: Beginning Your Game Part 4<br />
Skill Level: Beginner<br />
Run-Time: 54 Minutes<br />
Author: Michael Allar<br />
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon</p>
<p>Streaming:     <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4720/UDKBeginningYourGamePart4720.html">720×480</a> <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4/UDKBeginningYourGamePart4.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4720/UDKBeginningYourGamePart4720.mp4">Low-Res (32MB)</a> <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4/UDKBeginningYourGamePart4.mp4" target="_blank">Hi-Res (200MB)</a></p>
<h2>Written Version</h2>
<p>Subject: Beginning Your Game Part 4<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon</p>
<p>See the video for an in-depth explanation.</p>
<p><span id="more-291"></span></p>
<h3>HTInventoryManager</h3>
<pre class="brush: csharp;">/*******************************************************************************

 HTInventoryManager

 Creation date: 08/03/2010 07:03

 Lots of code stolen from Epic
*******************************************************************************/

class HTInventoryManager extends InventoryManager
 config(Game);

/** Holds the last weapon used */
var Weapon PreviousWeapon;

simulated function GetWeaponList(out array&lt;HTWeapon&gt; WeaponList, optional bool bNoEmpty)
{
 local HTWeapon Weap;

 ForEach InventoryActors( class'HTWeapon', Weap )
 {
 if ( !bNoEmpty || Weap.HasAnyAmmo())
 {
 WeaponList.Insert(0,1);
 WeaponList[0] = Weap;
 }
 }
}
/**
 * Accessor for the server to begin a weapon switch on the client.
 *
 * @param    DesiredWeapon        The Weapon to switch to
 */

reliable client function ClientSetCurrentWeapon(Weapon DesiredWeapon)
{
 SetPendingWeapon(DesiredWeapon);
}

simulated function Inventory CreateInventory(class&lt;Inventory&gt; NewInventoryItemClass, optional bool bDoNotActivate)
{
 if (Role==ROLE_Authority)
 {
 return Super.CreateInventory(NewInventoryItemClass, bDoNotActivate);
 }
 return none;
}
/**
 * Handle AutoSwitching to a weapon
 */
simulated function bool AddInventory( Inventory NewItem, optional bool bDoNotActivate )
{
 local bool bResult;

 if (Role == ROLE_Authority)
 {
 bResult = super.AddInventory(NewItem, bDoNotActivate);
 }
 return bResult;
}

simulated function DiscardInventory()
{
 local Vehicle V;

 if (Role == ROLE_Authority)
 {
 Super.DiscardInventory();

 V = Vehicle(Owner);
 if (V != None &amp;&amp; V.Driver != None &amp;&amp; V.Driver.InvManager != None)
 {
 V.Driver.InvManager.DiscardInventory();
 }
 }
}

simulated function RemoveFromInventory(Inventory ItemToRemove)
{
 if (Role==ROLE_Authority)
 {
 Super.RemoveFromInventory(ItemToRemove);
 }
}
/**
 * Scans the inventory looking for any of type InvClass.  If it finds it it returns it, other
 * it returns none.
 */
function Inventory HasInventoryOfClass(class&lt;Inventory&gt; InvClass)
{
 local inventory inv;

 inv = InventoryChain;
 while(inv!=none)
 {
 if (Inv.Class==InvClass)
 return Inv;

 Inv = Inv.Inventory;
 }
 return none;
}

/**
 * Store the last used weapon for later
 */
simulated function ChangedWeapon()
{
 PreviousWeapon = Instigator.Weapon;
 Super.ChangedWeapon();
}

simulated function SwitchToPreviousWeapon()
{
 if ( PreviousWeapon!=none &amp;&amp; PreviousWeapon != Pawn(Owner).Weapon )
 {
 PreviousWeapon.ClientWeaponSet(false);
 }
}

defaultproperties
{
 bMustHoldWeapon=true
 PendingFire(0)=0
 PendingFire(1)=0
}
</pre>
<h3>HTInventory</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTInventory

 Creation date: 08/03/2010 07:06
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTInventory extends Inventory;</pre>
<h3>HTWeapon</h3>
<pre class="brush: csharp;">/*******************************************************************************
 HTWeapon

 Creation date: 08/03/2010 06:21
 Copyright (c) 2010, Allar

*******************************************************************************/

class HTWeapon extends UDKWeapon;

/** Current ammo count */
var repnotify int AmmoCount;

/** Max ammo count */
var int MaxAmmoCount;

/** Holds the amount of ammo used for a given shot */
var array&lt;int&gt; ShotCost;

/** Offset from view center */
var(FirstPerson) vector    PlayerViewOffset;

replication
{
 // Server-&gt;Client properties
 if ( bNetOwner )
 AmmoCount;
}

simulated event ReplicatedEvent(name VarName)
{
 if ( VarName == 'AmmoCount' )
 {
 if ( !HasAnyAmmo() )
 {
 WeaponEmpty();
 }
 }
 else
 {
 Super.ReplicatedEvent(VarName);
 }
}

simulated function int GetAmmoCount()
{
 return AmmoCount;
}
 /*
 * Consumes some of the ammo
 */
function ConsumeAmmo( byte FireModeNum )
{
 // Subtract the Ammo
 AddAmmo(-ShotCost[FireModeNum]);
}

/**
 * This function is used to add ammo back to a weapon.  It's called from the Inventory Manager
 */
function int AddAmmo( int Amount )
{
 AmmoCount = Clamp(AmmoCount + Amount,0,MaxAmmoCount);
 return AmmoCount;
}

/**
 * Returns true if the ammo is maxed out
 */
simulated function bool AmmoMaxed(int mode)
{
 return (AmmoCount &gt;= MaxAmmoCount);
}

/**
 * This function checks to see if the weapon has any ammo available for a given fire mode.
 *
 * @param    FireModeNum        - The Fire Mode to Test For
 * @param    Amount            - [Optional] Check to see if this amount is available.  If 0 it will default to checking
 *                              for the ShotCost
 */
simulated function bool HasAmmo( byte FireModeNum, optional int Amount )
{
 if (Amount==0)
 return (AmmoCount &gt;= ShotCost[FireModeNum]);
 else
 return ( AmmoCount &gt;= Amount );
}

/**
 * returns true if this weapon has any ammo
 */
simulated function bool HasAnyAmmo()
{
 return ( ( AmmoCount &gt; 0 ) || (ShotCost[0]==0 &amp;&amp; ShotCost[1]==0) );
}

/**
 * This function retuns how much of the clip is empty.
 */
simulated function float DesireAmmo(bool bDetour)
{
 return (1.f - float(AmmoCount)/MaxAmmoCount);
}

/**
 * Returns true if the current ammo count is less than the default ammo count
 */
simulated function bool NeedAmmo()
{
 return ( AmmoCount &lt; Default.AmmoCount );
}

/**
 * Cheat Help function the loads out the weapon
 *
 * @param     bUseWeaponMax     - [Optional] If true, this function will load out the weapon
 *                              with the actual maximum, not 999
 */
simulated function Loaded(optional bool bUseWeaponMax)
{
 if (bUseWeaponMax)
 AmmoCount = MaxAmmoCount;
 else
 AmmoCount = 999;
}

/**
 * Called when the weapon runs out of ammo during firing
 */
simulated function WeaponEmpty()
{
 // If we were firing, stop
 if ( IsFiring() )
 {
 GotoState('Active');
 }

 if ( Instigator != none &amp;&amp; Instigator.IsLocallyControlled() )
 {
 Instigator.InvManager.SwitchToBestWeapon( true );
 }
}

/*********************************************************************************************
 * Ammunition / Inventory
 *********************************************************************************************/

function PrintScreenDebug(string debugText)
{
 local PlayerController PC;
 PC = PlayerController(Pawn(Owner).Controller);
 if (PC != None)
 PC.ClientMessage(&quot;HTWeapon: &quot; $ debugText);
}

simulated function AttachWeaponTo( SkeletalMeshComponent MeshCpnt, optional Name SocketName )
{
 local HTPawn HTP;

 HTP = HTPawn(Instigator);
 PrintScreenDebug(&quot;Attaching Weapon&quot;);
 // Attach 1st Person Muzzle Flashes, etc,
 if ( Instigator.IsFirstPerson() )
 {
 AttachComponent(Mesh);
 EnsureWeaponOverlayComponentLast();
 SetHidden(False);
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 PrintScreenDebug(&quot;First Person Weapon Attached&quot;);
 }
 else
 {
 SetHidden(True);
 if (HTP != None)
 {
 Mesh.SetLightEnvironment(HTP.LightEnvironment);
 }
 }
 //SetSkin(HTPawn(Instigator).ReplicatedBodyMaterial);
}

simulated event SetPosition(UDKPawn Holder)
{
 local vector DrawOffset, ViewOffset, FinalLocation;
 local rotator NewRotation, FinalRotation, SpecRotation;
 local PlayerController PC;
 local vector2D ViewportSize;
 local bool bIsWideScreen;
 local vector SpecViewLoc;

 if ( !Holder.IsFirstPerson() )
 return;

 Mesh.SetHidden(False);

 foreach LocalPlayerControllers(class'PlayerController', PC)
 {
 LocalPlayer(PC.Player).ViewportClient.GetViewportSize(ViewportSize);
 break;
 }
 bIsWideScreen = (ViewportSize.Y &gt; 0.f) &amp;&amp; (ViewportSize.X/ViewportSize.Y &gt; 1.7);

 Mesh.SetScale3D(default.Mesh.Scale3D);
 Mesh.SetRotation(default.Mesh.Rotation);

 ViewOffset = PlayerViewOffset;

 // Calculate the draw offset
 if ( Holder.Controller == None )
 {

 if ( DemoRecSpectator(PC) != None )
 {
 PC.GetPlayerViewPoint(SpecViewLoc, SpecRotation);
 DrawOffset = ViewOffset &gt;&gt; SpecRotation;
 //DrawOffset += UTPawn(Holder).WeaponBob(BobDamping, JumpDamping);
 FinalLocation = SpecViewLoc + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 // Add some rotation leading
 //SpecRotation.Yaw = LagRot(SpecRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //SpecRotation.Pitch = LagRot(SpecRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = SpecRotation;

 if ( bIsWideScreen )
 {
 //SpecRotation += WidescreenRotationOffset;
 }
 SetRotation(SpecRotation);
 return;
 }
 else
 {
 DrawOffset = (ViewOffset &gt;&gt; Holder.GetBaseAimRotation()) + HTPawn(Holder).GetEyeHeight() * vect(0,0,1);
 PrintScreenDebug(&quot;Setting DrawOffset to Holder Info&quot;);
 }
 }
 else
 {

 DrawOffset.Z = HTPawn(Holder).GetEyeHeight();
 //DrawOffset += HTPawn(Holder).WeaponBob(BobDamping, JumpDamping);

 if ( HTPlayerController(Holder.Controller) != None )
 {
 DrawOffset += HTPlayerController(Holder.Controller).ShakeOffset &gt;&gt; Holder.Controller.Rotation;
 }

 DrawOffset = DrawOffset + ( ViewOffset &gt;&gt; Holder.Controller.Rotation );
 }

 // Adjust it in the world
 FinalLocation = Holder.Location + DrawOffset;
 SetLocation(FinalLocation);
 SetBase(Holder);

 NewRotation = (Holder.Controller == None) ? Holder.GetBaseAimRotation() : Holder.Controller.Rotation;

 // Add some rotation leading
 //if (Holder.Controller != None)
 //{
 //    FinalRotation.Yaw = LagRot(NewRotation.Yaw &amp; 65535, LastRotation.Yaw &amp; 65535, MaxYawLag, 0);
 //    FinalRotation.Pitch = LagRot(NewRotation.Pitch &amp; 65535, LastRotation.Pitch &amp; 65535, MaxPitchLag, 1);
 //    FinalRotation.Roll = NewRotation.Roll;
 //}
 //else
 //{
 FinalRotation = NewRotation;
 //}
 //LastRotUpdate = WorldInfo.TimeSeconds;
 //LastRotation = NewRotation;

 if ( bIsWideScreen )
 {
 //FinalRotation += WidescreenRotationOffset;
 }
 SetRotation(FinalRotation);
}

simulated state WeaponEquipping
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Weapon Equipping&quot;);
 AttachWeaponTo(Instigator.Mesh);
 Super.BeginState(PreviousStateName);
 }
}

simulated state Active
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Active&quot;);
 Super.BeginState(PreviousStateName);
 }
}

simulated state WeaponFiring
{
 simulated event BeginState(Name PreviousStateName)
 {
 PrintScreenDebug(&quot;Firing&quot;);
 Super.BeginState(PreviousStateName);
 }

 /**
 * We override BeginFire() so that we can check for zooming and/or empty weapons
 */

 simulated function BeginFire( Byte FireModeNum )
 {
 // No Ammo, then do a quick exit.
 if( !HasAmmo(FireModeNum) )
 {
 WeaponEmpty();
 return;
 }
 Global.BeginFire(FireModeNum);
 }
}

defaultproperties
{
 Begin Object Name=FirstPersonMesh
 DepthPriorityGroup=SDPG_Foreground
 bOnlyOwnerSee=true
 bOverrideAttachmentOwnerVisibility=true
 CastShadow=false
 bAllowAmbientOcclusion=false
 End Object
 Mesh=FirstPersonMesh

 Begin Object Name=PickupMesh
 bOnlyOwnerSee=false
 CastShadow=false
 bForceDirectLightMap=true
 bCastDynamicShadow=false
 CollideActors=false
 BlockRigidBody=false
 bUseAsOccluder=false
 MaxDrawDistance=6000
 bForceRefPose=1
 bUpdateSkelWhenNotRendered=false
 bIgnoreControllersWhenNotRendered=true
 bAcceptsStaticDecals=FALSE
 bAcceptsDynamicDecals=FALSE
 bAllowAmbientOcclusion=false
 End Object
 DroppedPickupMesh=PickupMesh
 PickupFactoryMesh=PickupMesh

 MessageClass=class'UTPickupMessage'
 DroppedPickupClass=class'UTDroppedPickup'

 FiringStatesArray(0)=WeaponFiring
 FiringStatesArray(1)=WeaponFiring

 WeaponFireTypes(0)=EWFT_InstantHit
 WeaponFireTypes(1)=EWFT_InstantHit

 WeaponProjectiles(0)=none
 WeaponProjectiles(1)=none

 FireInterval(0)=+0.3
 FireInterval(1)=+0.3

 Spread(0)=0.0
 Spread(1)=0.0

 ShotCost(0)=1
 ShotCost(1)=1

 AmmoCount=5
 MaxAmmoCount=5

 InstantHitDamage(0)=0.0
 InstantHitDamage(1)=0.0
 InstantHitMomentum(0)=0.0
 InstantHitMomentum(1)=0.0
 InstantHitDamageTypes(0)=class'DamageType'
 InstantHitDamageTypes(1)=class'DamageType'
 WeaponRange=22000

 ShouldFireOnRelease(0)=0
 ShouldFireOnRelease(1)=0

 DefaultAnimSpeed=0.9

 EquipTime=+0.45
 PutDownTime=+0.33
}</pre>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fbeginning-your-game-part-4%2F&amp;linkname=Beginning%20Your%20Game%20Part%204">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/I2ESLpabiicXYwmflijj99prjDQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/I2ESLpabiicXYwmflijj99prjDQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/I2ESLpabiicXYwmflijj99prjDQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/I2ESLpabiicXYwmflijj99prjDQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/9ZMmDcSWspU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/beginning-your-game-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4720/UDKBeginningYourGamePart4720.mp4" length="148162923" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKBeginningYourGamePart4/UDKBeginningYourGamePart4.mp4" length="198995753" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/beginning-your-game-part-4/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Beginning Your Game Part 3</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/5ynv4xqauco/</link>
		<comments>http://forecourse.com/2010/03/beginning-your-game-part-3/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 18:37:00 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[beginning]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[empty]]></category>
		<category><![CDATA[fresh]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[GameInfo]]></category>
		<category><![CDATA[scratch]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[UDKGame]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=279</guid>
		<description><![CDATA[
Video Version
Subject: Beginning Your Game Part 3
Skill Level: Beginner
Run-Time: 16 Minutes
Author: Michael Allar
Notes: The project I&#8217;m working on as I&#8217;m creating this documentation requires the classes we&#8217;ve made to be based off higher level classes. These were the changes made.
Streaming:     720×480 1920×1080
Download:     Low-Res (32MB) Hi-Res (72MB)
Written Version
Subject: Beginning Your Game Part 3
Skill Level: Beginner
Author: Michael Allar
Notes: The [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: Beginning Your Game Part 3<br />
Skill Level: Beginner<br />
Run-Time: 16 Minutes<br />
Author: Michael Allar<br />
Notes: The project I&#8217;m working on as I&#8217;m creating this documentation requires the classes we&#8217;ve made to be based off higher level classes. These were the changes made.</p>
<p>Streaming:     <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3720/UDKBeginningYourGamePart3720.html">720×480</a> <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3a/UDKBeginningYourGamePart3.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3720/UDKBeginningYourGamePart3720.mp4">Low-Res (32MB)</a> <a href="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3a/UDKBeginningYourGamePart3.mp4" target="_blank">Hi-Res (72MB)</a></p>
<h2>Written Version</h2>
<p>Subject: Beginning Your Game Part 3<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: The project I&#8217;m working on as I&#8217;m creating this documentation requires the classes we&#8217;ve made to be based off higher level classes. These were the changes made.</p>
<p>In order to make these changes, you must be using the February build or later of UDK.</p>
<p><span id="more-279"></span></p>
<h4>Why Is There A Part 3?</h4>
<p>I am the Lead Programmer for a student ran project at The Art Institute of Orange County called The Hunt. It is a standalone game using Unreal Engine 3 being developed with the Unreal Development Kit. I am creating these tutorials as I progress in development of The Hunt and we&#8217;ve recently had a need to base our code off of higher level classes within the engine. Our goal is to stay away from as much UT code as possible without rewriting too much of everything. Instead of extending UTGame, UTPlayerController, and UTPawn, we will be extending GameInfo, UDKPlayerController, and UDKPawn.</p>
<h3>UDKGame now extends GameInfo</h3>
<pre class="brush: csharp;">/*******************************************************************************
	UDKGame

	Creation date: 14/01/2010 13:55
	Copyright (c) 2010, Michael Allar, Epic

*******************************************************************************/

class UDKGame extends GameInfo
	config(UDKGame);

struct GameTypePrefix
{
	var string Prefix;
	var string GameType;
};

var array&lt;GameTypePrefix&gt; DefaultMapPrefixes;

static event class&lt;GameInfo&gt; SetGameType(string MapName, string Options, string Portal)
{
	local string ThisMapPrefix;
	local int i,pos;
	local class&lt;GameInfo&gt; NewGameType;

	if (Left(MapName, 10) ~= &quot;HTFrontEnd&quot;)
	{
		return class'UDKGame';
	}

	// strip the UEDPIE_ from the filename, if it exists (meaning this is a Play in Editor game)
	if (Left(MapName, 6) ~= &quot;UEDPIE&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}
	else if ( Left(MapName, 5) ~= &quot;UEDPC&quot; )
	{
		MapName = Right(MapName, Len(MapName) - 5);
	}
	else if (Left(MapName, 6) ~= &quot;UEDPS3&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}
	else if (Left(MapName, 6) ~= &quot;UED360&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}

	// replace self with appropriate gametype if no game specified
	pos = InStr(MapName,&quot;-&quot;);
	ThisMapPrefix = left(MapName,pos);

	// change game type
	for ( i=0; i&lt;Default.DefaultMapPrefixes.Length; i++ )
	{
		if ( Default.DefaultMapPrefixes[i].Prefix ~= ThisMapPrefix )
		{
			NewGameType = class&lt;GameInfo&gt;(DynamicLoadObject(Default.DefaultMapPrefixes[i].GameType,class'Class'));
			if ( NewGameType != None )
			{
				return NewGameType;
			}
		}
	}

	return class'UDKGame';
}

defaultproperties
{
	DefaultPawnClass=class'UDKGame.HTPawn'
	PlayerControllerClass=class'UDKGame.HTPlayerController'
	DefaultMapPrefixes(0)=(Prefix=&quot;HT&quot;,GameType=&quot;UDKGame.TheHuntGame&quot;)
}
</pre>
<div>You will see that the main change here is the struct GameTypePrefix, var array&lt;GameTypePrefix&gt; DefaultMapPrefixes;, and the event  SetGameType. Because we are now basing UDKGame of of GameInfo instead of UTGame, we have to restore the map prefix functionality that is present in UTGame but is missing in GameInfo.</div>
<div>
<pre class="brush: csharp;">struct GameTypePrefix
{
     var string Prefix;
     var string GameType;
};
</pre>
</div>
<div>This declares a struct for a class that holds two strings, Prefix and GameType. A struct is essentially a set of variables in a variable or &#8220;structure&#8221;. Every instance of GameTypePrefix has a Prefix of GameType, which allows us to make an organized array of this data. This may make more sense when we see how it is used.</div>
<div>
<pre class="brush: csharp;">var array&lt;GameTypePrefix&gt; DefaultMapPrefixes;</pre>
</div>
<div>This declares an array of our struct called DefaultMapPrefixes. An array can be thought of as a collection of objects that you can add, remove, or edit the objects within. DefaultMapPrefixes will hold all of our default map prefixes for our different map names and game types. We will assign these in the default properties block at the end of the class.</div>
<div>
<pre class="brush: csharp;">static event class&lt;GameInfo&gt; SetGameType(string MapName, string Options, string Portal)
{
	local string ThisMapPrefix;
	local int i,pos;
	local class&lt;GameInfo&gt; NewGameType;

	if (Left(MapName, 10) ~= &quot;HTFrontEnd&quot;)
	{
		return class'UDKGame';
	}</pre>
</div>
<div>This is an event. Events are usually called automatically from other code when an event triggers. In this case, when the engine loads the UDKGame class it calls this event to see if we should set the game type to a different GameInfo class. It is given three strings, MapName, Options, and Portal. The only one we will use in our logic is MapName. We then have three lines of code declaring local variables. local variables are the same as variables we have been using before (var) except they only exist in the function they are declared in (also known as scope). The string ThisMapPrefix will be used to store the map prefix of the currently loaded map or MapName. &#8220;i&#8221; is used as an iterator for a for loop we will be running later, while pos is an integer that stores the location of a &#8220;-&#8221; in the map name if one exists (which we will calculate later). NewGameType is a variable of class GameInfo that we will be using to return the new GameInfo class we will switch to.</div>
<div>Our first if statement is checking to see if the first 10 characters from the left of MapName are a case-insensitive match (~=) to &#8220;HTFrontEnd&#8221;, and if so, it will return the class &#8216;UDKGame&#8217; causing the GameInfo class we are loading into to be UDKGame. Because we are already in UDKGame, no game type will be switched.</div>
<div>
<pre class="brush: csharp;">	// strip the UEDPIE_ from the filename, if it exists (meaning this is a Play in Editor game)
	if (Left(MapName, 6) ~= &quot;UEDPIE&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}
	else if ( Left(MapName, 5) ~= &quot;UEDPC&quot; )
	{
		MapName = Right(MapName, Len(MapName) - 5);
	}
	else if (Left(MapName, 6) ~= &quot;UEDPS3&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}
	else if (Left(MapName, 6) ~= &quot;UED360&quot;)
	{
		MapName = Right(MapName, Len(MapName) - 6);
	}</pre>
</div>
<div>Just as Epic&#8217;s comment states, these if statements check to see if our MapName contains a prefix that is added on automatically by the UDK Editor when we use the &#8220;Play in Editor&#8221; feature. If an editor prefix exists, we reassign MapName to be the the right most characters of the original mapname, ignoring the left-hand editor prefix.</div>
<div>
<pre class="brush: csharp;">	// replace self with appropriate gametype if no game specified
	pos = InStr(MapName,&quot;-&quot;);
	ThisMapPrefix = left(MapName,pos);</pre>
</div>
<div>This code searches our MapName for a &#8220;-&#8221; and stores the position of the first &#8220;-&#8221; character it finds into our variable &#8220;pos&#8221;. We then assign ThisMapPrefix to the left side of our MapName ending at the &#8220;-&#8221; character, causing the prefix of our map to only be stored. Example: If the MapName is HT-Hole1, it will first find the &#8220;-&#8221; character and then store 2 in pos as the &#8220;-&#8221; is character 2. (The first character of a string is always character zero). We then grab the left of the MapName from the beginning of the string up to the 2nd character (being the &#8220;-&#8221;), causing ThisMapPrefix to have &#8220;HT&#8221; assigned to it.</div>
<div>
<pre class="brush: csharp;">	// change game type
	for ( i=0; i&lt;Default.DefaultMapPrefixes.Length; i++ )
	{
		if ( Default.DefaultMapPrefixes[i].Prefix ~= ThisMapPrefix )
		{
			NewGameType = class&lt;GameInfo&gt;(DynamicLoadObject(Default.DefaultMapPrefixes[i].GameType,class'Class'));
			if ( NewGameType != None )
			{
				return NewGameType;
			}
		}
	}</pre>
</div>
<div>This is a for loop. A for loop essentially loops a code block while changing a variable every loop until a condition is no longer true. This is where our i variable comes into play (i being short for iterator). We start the loop by making i = 0, and we give the loop a condition of  i&lt;Default.DefaultMapPrefixes.Length. Default.DefaultMapPrefixes refers to our default value of DefaultMapPrefixes which we assign to in the DefaultProperties code block later on in this class. It contains all the map prefixes for our game. Default.DefaultMapPrefixes.Length is the length of the array, or how many prefixes are in DefaultMapPrefixes. Every time this for loop loops, it will continue to loop as long as our iterator is less than the number of prefixes in our array. The &#8220;i++&#8221; in our for loop tells the loop to increment i by 1 every time it loops.</div>
<div>Our if statement is checking to see if the &#8220;ith&#8221; object of DefaultMapPrefixes is a case-insensitive (~=) match to our map prefix of our map. Arrays are kind of like strings in that the first object in an array has an &#8216;index&#8217; of 0, just like the first character of a string is character 0. To access an object in an array, you suffix the array with square brackets [ ] with the index of the object inside the brackets. In this case it is i, our loop iterator. Every time we loop this code block, i is increased by one, thus moving to the next object in the array. If our array has 1 object in it, that first object has an index of 0, so our loop will loop once. After it loops once, i will be 1 which is not less than the number of objects in our array, which is 1; thus the loop will stop. If we had two objects in our array, the loop will run the code block twice with i being 0 and 1, stopping at 2; which works because the second object of an array has an index of 1 because our first object has an index of 0.</div>
<div>If it is a match, the next line of code is a bit tricky. What we are doing here is loading an object by its asset name which is stored as a string &#8220;GameType&#8221;. Our DefaultMapPrefixes is an array of the GameTypePrefix struct, so every object in the array has two strings, Prefix and GameType. We can access that string by referencing DefaultMapPrefixes[i].GameType where i is the index of the object we are comparing to in our loop. This string is the fully qualified name of a GameInfo class, such as UDKGame.UDKGame or later UDKGame.TheHuntGame. UTGame.UTDeathmatch would also work here. We load it in as a &#8220;class&#8221; instead of an instance because we are looking for the actual class of the GameInfo we want to switch to, not an instance of it. Because DynamicLoadObject returns a generic Object, we have to do whats called type-casting in order to turn it into a GameInfo class. Type-casting allows us to store an object in a variable thats designed to hold another object if the two objects are compatible. We can store a UDKGame.UDKGame in a GameInfo class because UDKGame derives from GameInfo. We can not however type-cast an Actor into GameInfo because Actor is not a sub-class of GameInfo, but instead is a parent of it. Finally, this newly loaded and type-casted object is stored in NewGameType. Even though if we load a UDKGame.UDKGame class and type cast it as a GameInfo class, it will still remain a UDKGame class with all its unique properties, but it will just be stored as a GameInfo class.</div>
<div>The second if statement checks to see if NewGameType does not equal None, which means that we successfully converted our newly loaded object into a GameInfo class. If for some reason we could not load the object or type-casting failed, NewGameType would not be assigned to anything (None) and therefore would not be a valid thing to return, as we can&#8217;t change the game mode to &#8220;None&#8221;. If NewGameType was assigned a value, we then return it, which causes the engine to set our new game type to whatever game type matched our prefix that we assigned in DefaultMapPrefixes.</div>
<div>
<pre class="brush: csharp;">	return class'UDKGame';
}</pre>
</div>
<div>This last bit of code will return &#8220;UDKGame&#8221; if our loop fails to return a new game type, causing us not to switch game modes because we are already in UDKGame. The last bracket closes the SetGameType event.</div>
<div>
<pre class="brush: csharp;">defaultproperties
{
	DefaultPawnClass=class'UDKGame.HTPawn'
	PlayerControllerClass=class'UDKGame.HTPlayerController'
	DefaultMapPrefixes(0)=(Prefix=&quot;HT&quot;,GameType=&quot;UDKGame.TheHuntGame&quot;)
}</pre>
</div>
<div>This is our defaultproperties box, which is pretty much the same as before. We assign our HT prefix with the GameType UDKGame.TheHuntGame to the first object of DefaultMapPrefixes, so that if our map has a prefix of HT it will load UDKGame.TheHuntGame instead.</div>
<p>{var string Prefix;var string GameType;};</p>
<h3>HTPawn now extends UDKPawn</h3>
<p>HTPawn now has a defaultproperties block identical to UTPawn, with the UTPawn specific properties removed. <a href="http://www.forecourse.com/unreal/HTPawn.zip" target="_blank">It is really long so here is a link to the script instead.</a></p>
<h3>HTPlayerController now extends UDKPlayerController</h3>
<pre class="brush: csharp;">/*******************************************************************************
HTPlayerController
Creation date: 14/01/2010 14:31
Copyright (c) 2010, Michael Allar
*******************************************************************************/
class HTPlayerController extends UDKPlayerController
     config(UDKGame);</pre>
<div>No added functionality here, just inherits from UDKPlayerController instead.</div>
<h3>TheHuntGame is a second GameInfo class that extends UDKGame</h3>
<p>So that we can use UDKGame as a generic GameInfo class for things like front-ends while having the majority of our game code in a subclass of it.</p>
<pre class="brush: csharp;">/*******************************************************************************
	TheHuntGame

	Creation date: 19/01/2010 22:24
	Copyright (c) 2010, Michael Allar

*******************************************************************************/

class TheHuntGame extends UDKGame;

var array&lt; class&lt;Inventory&gt; &gt; DefaultInventory;

event PlayerController Login(string Portal, string Options, const UniqueNetID UniqueID, out string ErrorMessage)
{
	local PlayerController PC;
	PC = super.Login(Portal, Options, UniqueID, ErrorMessage);
	ChangeName(PC, &quot;New Player&quot;, true);
    return PC;
}

function AddDefaultInventory( pawn PlayerPawn )
{
	local int i;

	for (i=0; i&lt;DefaultInventory.Length; i++)
	{
		// Ensure we don't give duplicate items
		if (PlayerPawn.FindInventoryType( DefaultInventory[i] ) == None)
		{
			// Only activate the first weapon
			PlayerPawn.CreateInventory(DefaultInventory[i], (i &gt; 0));
		}
	}

	PlayerPawn.AddDefaultInventory();
}

defaultproperties
{
	DefaultPawnClass=class'UDKGame.HTPawn'
	PlayerControllerClass=class'UDKGame.HTPlayerController'

	ConsolePlayerControllerClass=class'UTGame.UTConsolePlayerController'

	PlayerReplicationInfoClass=class'UTGame.UTPlayerReplicationInfo'
	GameReplicationInfoClass=class'UTGame.UTGameReplicationInfo'

	//DefaultInventory(0)=class'UDKGame.HTWP_LittleBang'

	bRestartLevel=False
	bDelayedStart=False
	bUseSeamlessTravel=true

}
</pre>
<h3>Thats all the changes made.</h3>
<p>Now you are ready to continue to set up your game!</p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fbeginning-your-game-part-3%2F&amp;linkname=Beginning%20Your%20Game%20Part%203">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/60WhQRwVCyuatdEmPTK_vRm1Dcc/0/da"><img src="http://feedads.g.doubleclick.net/~a/60WhQRwVCyuatdEmPTK_vRm1Dcc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/60WhQRwVCyuatdEmPTK_vRm1Dcc/1/da"><img src="http://feedads.g.doubleclick.net/~a/60WhQRwVCyuatdEmPTK_vRm1Dcc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/5ynv4xqauco" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/beginning-your-game-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKGameInfoSmall/UDKGameInfoSmall.mp4" length="66954108" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKGameInfo/UDKGameInfo.mp4" length="214678112" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3720/UDKBeginningYourGamePart3720.mp4" length="32936900" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKBeginningYourGamePart3a/UDKBeginningYourGamePart3.mp4" length="72166173" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/beginning-your-game-part-3/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Adding an M16: Part 2.5 – Dummy Rigging</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/TQUjTVpRPVM/</link>
		<comments>http://forecourse.com/2010/03/adding-an-m16-part-3-dummy-rigging/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 08:44:17 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[3ds max]]></category>
		<category><![CDATA[allar]]></category>
		<category><![CDATA[m16]]></category>
		<category><![CDATA[rigging]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapons]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=270</guid>
		<description><![CDATA[
Video Version
Subject: Adding an M16: Part 2.5 – Dummy Rigging
Skill Level: Beginner
Run-Time: 10 minutes
Author: Michael Allar
Notes: Rigging a temporary M16 slug model to use for testing purposes using dummy objects.
Streaming:     720×480 1920×1080
Download:     Low-Res (17MB) Hi-Res (35MB)
Click here to continue to Part 3:  Preparing Model For Implementaton

Share/Save
]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: Adding an M16: Part 2.5 – Dummy Rigging<br />
Skill Level: Beginner<br />
Run-Time: 10 minutes<br />
Author: Michael Allar<br />
Notes: Rigging a temporary M16 slug model to use for testing purposes using dummy objects.</p>
<p>Streaming:     <a title="Dummy Rigging" href="http://www.forecourse.com/unreal/UDKM16DummyRigging720/UDKM16DummyRigging720.html" target="_blank">720×480</a> <a title="Geometry Rigging" href="http://www.forecourse.com/unreal/UDKM16DummyRigging/UDKM16DummyRigging.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKM16DummyRigging720/UDKM16DummyRigging720.mp4">Low-Res (17MB)</a> <a href="http://www.forecourse.com/unreal/UDKM16DummyRigging/UDKM16DummyRigging.mp4" target="_blank">Hi-Res (35MB)</a></p>
<p>Click here to continue to Part 3:  Preparing Model For Implementaton</p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fadding-an-m16-part-3-dummy-rigging%2F&amp;linkname=Adding%20an%20M16%3A%20Part%202.5%20%E2%80%93%20Dummy%20Rigging">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/dqBDklSURsRMVoOH1n5W58uctcY/0/da"><img src="http://feedads.g.doubleclick.net/~a/dqBDklSURsRMVoOH1n5W58uctcY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dqBDklSURsRMVoOH1n5W58uctcY/1/da"><img src="http://feedads.g.doubleclick.net/~a/dqBDklSURsRMVoOH1n5W58uctcY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/TQUjTVpRPVM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/adding-an-m16-part-3-dummy-rigging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKM16DummyRigging720/UDKM16DummyRigging720.mp4" length="17895790" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKM16DummyRigging/UDKM16DummyRigging.mp4" length="35885836" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/adding-an-m16-part-3-dummy-rigging/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Adding an M16: Part 2 – Geometry Rigging</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/KYlu0w2_GBs/</link>
		<comments>http://forecourse.com/2010/03/adding-an-m16-part-2-geometry-rigging/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 08:20:51 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[3ds max]]></category>
		<category><![CDATA[allar]]></category>
		<category><![CDATA[m16]]></category>
		<category><![CDATA[rigging]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapons]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=258</guid>
		<description><![CDATA[
Important Note:
During the video, I mention that all weapons point down the Y axis. I was basing this knowledge off of the Shock Rifle, which turns out is coded to be rotated to be facing down the X axis like the Rocket Launcher. Your model can face down any axis in 3DS Max, but make [...]]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Important Note:</h2>
<p><strong>During the video, I mention that all weapons point down the Y axis. I was basing this knowledge off of the Shock Rifle, which turns out is coded to be rotated to be facing down the X axis like the Rocket Launcher. Your model can face down any axis in 3DS Max, but make sure that after you import it that it faces down the X axis using the Rot Origin properties. You can leave it facing in the Y axis if you want, as adjusting the rotation in the weapon&#8217;s code is also really easy to do too and I will go over how to do so in the code part of this tutorial series.</strong></p>
<h2>Video Version</h2>
<p>Subject: Adding an M16: Part 2 – Geometry Rigging<br />
Skill Level: Beginner<br />
Run-Time: 21 minutes<br />
Author: Michael Allar<br />
Notes: Rigging a temporary M16 slug model to use for testing purposes.</p>
<p>Streaming:     <a title="Geometry Rigging" href="http://www.forecourse.com/unreal/UDKM16GeomRigging720/UDKM16GeomRigging720.html" target="_blank">720×480</a> <a title="Geometry Rigging" href="http://www.forecourse.com/unreal/UDKM16GeomRigging/UDKM16GeomRigging.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/UDKM16GeomRigging720/UDKM16GeomRigging720.mp4">Low-Res (47MB)</a> <a href="http://www.forecourse.com/unreal/UDKM16GeomRigging/UDKM16GeomRigging.mp4" target="_blank">Hi-Res (84MB)</a></p>
<p><a href="http://forecourse.com/2010/03/adding-an-m16-part-3-dummy-rigging/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_self">Click here to continue to Part 2.5:  Dummy Rigging (Optional)</a></p>
<p>Click here to continue to Part 3:  Preparing Model For Implementation</p>
<h2>Written Version</h2>
<p>Subject: Adding an M16: Part 2 – Geometry Rigging<br />
Skill Level: Beginner<br />
Author: Michael Allar<br />
Notes: Rigging a temporary M16 slug model to use for testing purposes.<br />
Prerequisites: UDK, 3DS Max, ActorX</p>
<p><span id="more-258"></span></p>
<h3>Making Your Model To Scale (In 3DS Max)</h3>
<ol>
<li>Orientate the weapon so that it it points down the negative Y axis, with top facing positive Z. Y will be flipped when importing into UDK.</li>
<li>Place the M16 at origin so that origin is at the weapons vertical center, horizontal center, and that its shifted forward or backward so the stock on the weapon is on origin or a bit behind it. This just makes first person view positioning a bit easier.</li>
<li>Export your model as a .ASE (ASCII Scene Export)</li>
<li>Import into Unreal and drop it into a level and see how the scaling works out.</li>
<li>Go back into Max, scale, reposition, and re-export until the scaling is as desired.</li>
</ol>
<h3>Rigging Your Model Using Its Own Geometry (In 3DS Max)</h3>
<p>Skeletal meshes can be imported from 3DS Max using geometry as their bones or by using actual bones, dummy objects, etc. The advantages of using geometry to rig are it is faster to do so, and all you have to worry about is the pivot points for each piece of geometry. The downside is that each piece of geometry can only be manipulated by one bone, being itself. This part goes over how to use geometry as rigging, however there is an optional tutorial on how to rig using dummy objects in 3DS Max as well.</p>
<ol>
<li>You should have one piece of geometry that will serve as the root node of the model. In this case, I used the main body of the M16.</li>
<li>Use &#8220;Select and Link&#8221; to link objects to their parents. In this case, I only had to link my trigger to the main body.</li>
</ol>
<h3>Installing ActorX</h3>
<p>ActorX is a plugin by Epic for 3DS Max, Maya, and XSI to export skeletal meshes for use with the Unreal Engine. There is a copy of the plugin to install inside your UDK installation under Binaries\ActorX. Install the plugin for your 3d package.</p>
<ol>
<li>For 3DS Max, grab the plugin from the Max folder that corresponds to the version of 3DS Max you are using and place the .DLU file into your Max installation directory in the &#8220;stdplugins&#8221; folder.</li>
<li>Customize -&gt; Plug-in Manager&#8230;</li>
<li>Right-click anywhere in the Plug-in Manager and choose Load New Plugin&#8230;</li>
<li>Open ActorX.dlu</li>
<li>Open the ActorX UI by clicking the Utilities tab on the right (hammer) and then by clicking More&#8230; Select ActorX and then click OK.</li>
</ol>
<div id="attachment_259" class="wp-caption aligncenter" style="width: 306px"><a href="http://forecourse.com/wp-content/uploads/2010/03/MaxMoreActorX.jpg#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="size-medium wp-image-259" title="MaxMoreActorX" src="http://forecourse.com/wp-content/uploads/2010/03/MaxMoreActorX-296x300.jpg" alt="" width="296" height="300" /></a>
<p class="wp-caption-text">Bringing up the ActorX UI</p>
</div>
<h3>Exporting as a Skeletal Mesh (.PSK)</h3>
<ol>
<li>Choose a path and filename for your mesh.</li>
<li>Make your settings the same in the next picture:
<p style="text-align: center;">
<p><a href="http://forecourse.com/wp-content/uploads/2010/03/ActorXSettings.jpg#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="aligncenter size-full wp-image-260" title="ActorXSettings" src="http://forecourse.com/wp-content/uploads/2010/03/ActorXSettings.jpg" alt="" width="161" height="783" /></a></li>
<li>If you do not have your mesh textured, uncheck &#8220;all textured&#8221;.</li>
<li>Click Save mesh/refpose.</li>
</ol>
<h3>Importing Your Skeletal Mesh</h3>
<ol>
<li>Open your Content Browser</li>
<li>Import your file into a package of your choice.</li>
<li>Make sure your model is pointing down the X axis.
<ol>
<li>Open up the Skeletal Mesh Viewer by double clicking on your asset</li>
</ol>
</li>
</ol>
<p>Under the Mesh tab, adjust the Rot Origin properties until it does.</p>
<div id="attachment_261" class="wp-caption aligncenter" style="width: 310px"><a href="http://forecourse.com/wp-content/uploads/2010/03/M16Orientation.jpg#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="size-medium wp-image-261" title="M16Orientation" src="http://forecourse.com/wp-content/uploads/2010/03/M16Orientation-300x222.jpg" alt="" width="300" height="222" /></a>
<p class="wp-caption-text">Where to set the orientation for your model.</p>
</div>
<p><a href="http://forecourse.com/2010/03/adding-an-m16-part-3-dummy-rigging/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_self">Click here to continue to Part 2.5:  Dummy Rigging (Optional)</a></p>
<p>Click here to continue to Part 3:  Preparing Model For Implementation</p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fadding-an-m16-part-2-geometry-rigging%2F&amp;linkname=Adding%20an%20M16%3A%20Part%202%20%E2%80%93%20Geometry%20Rigging">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/uj5J3g3K2p60JW9h3anvtLsF4IE/0/da"><img src="http://feedads.g.doubleclick.net/~a/uj5J3g3K2p60JW9h3anvtLsF4IE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/uj5J3g3K2p60JW9h3anvtLsF4IE/1/da"><img src="http://feedads.g.doubleclick.net/~a/uj5J3g3K2p60JW9h3anvtLsF4IE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/KYlu0w2_GBs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/adding-an-m16-part-2-geometry-rigging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/UDKM16GeomRigging720/UDKM16GeomRigging720.mp4" length="47859062" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/UDKM16GeomRigging/UDKM16GeomRigging.mp4" length="84682288" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/adding-an-m16-part-2-geometry-rigging/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
		<item>
		<title>Adding an M16: Part 1 – Modeling</title>
		<link>http://feedproxy.google.com/~r/AllarsAwesomeBlog/~3/QLvD7Q306yU/</link>
		<comments>http://forecourse.com/2010/03/adding-an-m16-part-1-modeling/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 07:21:26 +0000</pubDate>
		<dc:creator>Allar</dc:creator>
				<category><![CDATA[Unreal]]></category>
		<category><![CDATA[3ds max]]></category>
		<category><![CDATA[allar]]></category>
		<category><![CDATA[m16]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[udk]]></category>
		<category><![CDATA[weapons]]></category>

		<guid isPermaLink="false">http://forecourse.com/?p=256</guid>
		<description><![CDATA[
Video Version
Subject: Adding an M16: Part 1 &#8211; Modeling
Skill Level: Beginner
Run-Time: 21 minutes
Author: Michael Allar
Notes: A temporary M16 slug model to use for testing purposes.
Streaming:     720×480 1920×1080
Download:     Low-Res (54MB) Hi-Res (94MB)
Click here to continue to Part 2: Rigging

Share/Save
]]></description>
			<content:encoded><![CDATA[<p><!--CusAds1--><br />
<h2>Video Version</h2>
<p>Subject: Adding an M16: Part 1 &#8211; Modeling<br />
Skill Level: Beginner<br />
Run-Time: 21 minutes<br />
Author: Michael Allar<br />
Notes: A temporary M16 slug model to use for testing purposes.</p>
<p>Streaming:     <a title="Modeling an M16" href="http://www.forecourse.com/unreal/ModelingM16720/ModelingM16720.html" target="_blank">720×480</a> <a href="http://www.forecourse.com/unreal/M16Modeling/M16Modeling.html" target="_blank">1920×1080</a></p>
<p>Download:     <a href="http://www.forecourse.com/unreal/ModelingM16720/ModelingM16720.mp4">Low-Res (54MB)</a> <a href="http://www.forecourse.com/unreal/M16Modeling/M16Modeling.mp4" target="_blank">Hi-Res (94MB)</a></p>
<p><a href="http://forecourse.com/2010/03/adding-an-m16-part-2-geometry-rigging/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_self">Click here to continue to Part 2: Rigging</a></p>
<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fforecourse.com%2F2010%2F03%2Fadding-an-m16-part-1-modeling%2F&amp;linkname=Adding%20an%20M16%3A%20Part%201%20%26%238211%3B%20Modeling">Share/Save</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/HHt_excGiwbrs_23k-bNbX6nRs0/0/da"><img src="http://feedads.g.doubleclick.net/~a/HHt_excGiwbrs_23k-bNbX6nRs0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HHt_excGiwbrs_23k-bNbX6nRs0/1/da"><img src="http://feedads.g.doubleclick.net/~a/HHt_excGiwbrs_23k-bNbX6nRs0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AllarsAwesomeBlog/~4/QLvD7Q306yU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://forecourse.com/2010/03/adding-an-m16-part-1-modeling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.forecourse.com/unreal/ModelingM16720/ModelingM16720.mp4" length="54132759" type="video/mpeg" />
<enclosure url="http://www.forecourse.com/unreal/M16Modeling/M16Modeling.mp4" length="94497367" type="video/mpeg" />
		<feedburner:origLink>http://forecourse.com/2010/03/adding-an-m16-part-1-modeling/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</feedburner:origLink></item>
	</channel>
</rss>
