This is a collection of notes for using the Turret project from the Mastering Unreal Script Book Chapter 11 in the Unreal Development Kit(UDK). The original text was made for the Unreal Tournament 3(UT3) editor. The chapter for the book can be found on the UDN website here. The Turret skeletal mesh found in the TurretContent.upk package downloaded from UDN is flawed in that the Turret joints are not aligned properly and the particle system that shows damage is missing. The "DM-CH_11_Turret.ut3" map file uses static meshes from UT3 that are not available in the UDK, so I threw together a map made with UDK static meshes. It's not pretty, but it works. The new turret mesh uses a random material I found in the UDK packages, so it's not pretty either.
This process was used on the UDK October 2010 beta release installed to drive C.
Create the folder for the uc class files here - C:\UDK\UDK-2010-10\Development\Src\MasteringUnrealScript\Classes
Copy TurretContent.upk to the preexisting folder here - C:\UDK\UDK-2010-10\UDKGame\Content\TestPackages\MasteringUnreal
Copy the sample chapter 11 map to C:\UDK\UDK-2010-10\UDKGame\Content\Maps and rename the extension from ut3 to udk or better yet use the map supplied on this page.
The following steps are based on a forum post on the UDN here.
Before each compile I delete the u file - C:\UDK\UDK-2010-10\UDKGame\Unpublished\CookedPC\Script\MasteringUnrealScript.u because I don't think there is anything in Unreal Frontend that automatically deletes the old u files from any previous compiles.
I'm using ConTEXT so I set it up for hard tabs, tab space=4 and smart tabs off for a better experience.
I added -log to the shortcut so i could see the log as it is written: D:\UDK\UDK-2010-10\Binaries\UDKLift.exe editor -log. This way I can use a command like `log("This will add a line to the log output"); in the script to debug it.
Tutorial 11.8 step 10:
change TurretRotRate=128000 to MaxTurretRotRate=128000
Tutorial 11.8 step 5: change
DestroyedEffect=ParticleSystemComponent1 to DestroyEffect=ParticleSystemComponent1
Tutorial 11.12 step 4: change
FClamp(1-Float(TurretHealth)/Float(MaxTurretHealth)),0.0,1.0)
to
FClamp(1-(Float(TurretHealth)/Float(MaxTurretHealth)),0.0,1.0)
Add MinTurretRotRate=8192 to the default properties. This
line is missing from the web text.
I made the following change to the Defend state, because I was getting divide by zero errors:
//RotationAlpha = FClamp(ElapsedTime / TotalInterpTime,0.0,1.0);
if(TotalInterpTime == 0)
RotationAlpha = 1.0;
else
RotationAlpha = FClamp(ElapsedTime / TotalInterpTime,0.0,1.0);
Default properties change to use the new skeletal mesh:
//SkeletalMesh=SkeletalMesh'TurretContent.TurretMesh'
SkeletalMesh=SkeletalMesh'TurretContent.TurretActor'
Tutorial 11.8 step 7, Change to use sounds available in UDK:
TurretSounds={(
//FireSound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_FireCue',
//DamageSound=SoundCue'A_Weapon_Stinger.Weapons.A_Weapon_Stinger_FireImpactCue',
//SpinUpSound=SoundCue'A_Vehicle_Turret.Cue.AxonTurret_PowerUpCue',
//WakeSound=SoundCue'A_Vehicle_Turret.Cue.A_Turret_TrackStart01Cue',
//SleepSound=SoundCue'A_Vehicle_Turret.Cue.A_Turret_TrackStop01Cue',
//DeathSound=SoundCue'A_Vehicle_Turret.Cue.AxonTurret_PowerDownCue'
FireSound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_FireCue',
DamageSound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_ImpactCue',
SpinUpSound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_RaiseCue',
WakeSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Start',
SleepSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Stop',
DeathSound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_LowerCue'
)}
TurretEmitters={(
DamageEmitter=ParticleSystem'TurretContent.P_TurretDamage',
//MuzzleFlashEmitter=ParticleSystem'WP_Stinger.Particles.P_Stinger_3P_MF_Alt_Fire',
//DestroyEmitter=ParticleSystem'FX_VehicleExplosions.Effects.P_FX_VehicleDeathExplosion',
//DamageEmitter=ParticleSystem'Envy_Effects.Vehicle_Damage.P_Vehicle_Damage_1_Scorpion',
MuzzleFlashEmitter=ParticleSystem'VH_Scorpion.Effects.PS_Scorpion_Gun_MuzzleFlash_Red',
DestroyEmitter=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near',
DamageEmitterParamName=DamageParticles
)}
And that's it. It should be possible to follow the original tutorial using the information and downloads on this page.
I plan to setup ConTEXT to compile the scripts for the next project since manually deleting the u file is an inconvenient step.