This process was used on the UDK October 2010 beta release installed to drive C.
Note that the script files here haven't been cleaned up. There are a lot of extra comments and I commented out lines instead of cutting and pasting when the tutorial called for it.
Create the folder for the uc class files here - C:\UDK\UDK-2010-10\Development\Src\MasteringUnrealScript\Classes
Copy Chapter_06_Functions.upk to the preexisting folder - C:\UDK\UDK-2010-10\UDKGame\Content\TestPackages\MasteringUnreal
Copy the sample chapter 6 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.
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.
A major obstacle to doing the mastering Unreal Script Chapter 6
tutorial is that desired rotation has changed since UT3.
From the Actor Class:
/**
* PLEASE NOTE DesiredRotation is removed
* This DesiredRotation is moved to Pawn to remove redundant
variables usage. (i.e. between Pawn and Controller)
* Pawn now handles all DesiredRotation and it is only one place.
* All Actor's DesiredRotation won't work anymore - Use RotationRate
to control Actor's rotation
**/
Tutorial 6.1 step 2. Change class
AmbientCreature extends Actor; to class AmbientCreature extends
Pawn;
Tutorial 6.2 step 6. Created an extra
class variable line to be used in place of the DesiredRotation from
UT3.
var Rotator MyDesiredRotation;
Tutorial 6.4 step 3. add a line bCollideActors=False so fish don't collide with each other
Tutorial 6.4 step 4. change Physics=PHYS_Projectile
to Physics=PHYS_Flying and add a line WalkingPhysics=PHYS_None.
I don't know if the WalkingPhysics part is needed or not and
PHYS_Swimming might work in place of Flying but it may also drown
the fish. I haven't tested so it's unkown to me.
Tutorial 6.5 step 7. Change
DesiredRotation to MyDesiredRotation
Tutorial 6.5 step 5 and 6. Change
DesiredRotation to MyDesiredRotation
Tutorial 6.9 step 3 - copy from web page
gave mystery error, error went away after manually typing the line
The next set of changes are in the form of a tutorial between Tutorial 6.9 and Tutorial 6.10
Reference information from the Pawn class:
/** DesiredRotation related function **/
/** SetDesiredRotation function
* @param TargetDesiredRotation: DesiredRotation you want
* @param InLockDesiredRotation: I'd like to lock up DesiredRotation,
please nobody else can touch it until I say it's done
* @param InUnlockWhenReached: When you lock, set this to TRUE if you
want it to be auto Unlock when reached desired rotation
* @param InterpolationTime: Give interpolation time to get to the
desired rotation - Ignore default RotationRate, but use this to get
there
* @return TRUE if properly set, otherwise, return FALSE
**/
//native final function bool SetDesiredRotation(Rotator
TargetDesiredRotation, bool InLockDesiredRotation=FALSE, bool
InUnlockWhenReached=FALSE, FLOAT InterpolationTime=-1.f, bool
bResetRotationRate=TRUE);
1. New function variables for the
SetDesiredRotation function. InLockDesiredRotation,
InUnlockWhenReached and InterpolationTime are used in the pawn's
SetDesiredRotation function.
cosang and angbet are used to store the cosine of the angle and the
angle between the current rotation and the new desired rotation.
local bool InLockDesiredRotation;
local bool InUnlockWhenReached;
local FLOAT InterpolationTime;
local float cosang, angbet;
The next set of steps are added before the SetTimer call
2. Get the angle between the old and new directions
of the ambient creature. First use the dot function to find the
cosine of the angle between the two directions, then use the acos
function to get the actual angle in radians. The
DesiredRotation is used as the old direction. The Rotation
variable might be better here.
Finally, convert the angle from radians to unreal rotation units
removing any negative value with the abs function.
1 PI radian == 32768 unreal rotation units == 180 degrees
cosang = Normal(Vector(DesiredRotation)) dot
Normal(DestNode.Location - Location);
angbet = Acos(cosang);
angbet = abs((32762/PI)*Acos(cosang));
3. Set the rotation time interval using the angle
and the yaw rotation rate. Maybe some sort of average for yaw, roll
and pitch rotation rates could be used here.
InterpolationTime=angbet/RotationRate.Yaw;
4. Locking is needed for the ambient creature code
to maintain control of the desired rotation, otherwise the fish will
rotate back to their original orientations after achieving the
desired rotation.
Start by unlocking the DesiredRotation from the previous call to the
function. False==unlock
LockDesiredRotation(False);
5. Setup lock arguments for the desired rotation
function. Set so that the call locks the desired rotation and does
not unlock it when it has reached it's target orientation.
InLockDesiredRotation=TRUE; get ready to lock
on the next call
InUnlockWhenReached=FALSE; don't unlock when reach the target
rotation
6. Now set the desired rotation. SetTimer will
still be the last line of this function. This line goes just before
it.
SetDesiredRotation(MyDesiredRotation,
InLockDesiredRotation, InUnlockWhenReached, InterpolationTime );
<<<< End of Tutorial>>>>
Tutorial 6.11 step 4. - made min and max
bigger so I could see from a distance what the fish were doing more
easily.
MinSize=0.1
MaxSize=0.25
Tutorial 6.12 step 6. - changed
Super(Actor).PostBeginPlay(); to Super(Pawn).PostBeginPlay(); from
Pawn instead of Actor class
Tutorial 6.14 step 7. - bad quotes on
the web page change ClearTimer(‘SetRandDest’); to ClearTimer('SetRandDest');
And that's it. It should be possible to follow the original tutorial using the information and downloads on this page.