Tuesday, January 25, 2005

I've only gone and done it!
Yes folks my C++ days are already at an end as I wave to UnrealScript from a distance. It works, My log file soon becoms fat and juicy with player locations taken every second.

class Watcher extends mutator;

var() int counter;

event PreBeginPlay()
{
counter=0;
SetTimer(1.0,true);
}

function ModifyPlayer(Pawn Other)
{

counter=counter+1;
Log( "spawn = " $ counter);
Log("spawnxloc =" $Other.Location.X);
Log("spawnyloc =" $Other.Location.Y);
Log("spawnzloc =" $Other.Location.Z);

Super.ModifyPlayer(Other);

}

function Timer()
{
local Controller C;

for (C = Level.ControllerList; C != None; C = C.NextController)
{
Log("movingxloc = " $C.Pawn.Location.X);
Log("movingyloc = " $C.Pawn.Location.Y);
Log("movingzloc = " $C.Pawn.Location.Z);
}
}

defaultproperties
{
FriendlyName="Watcher"
Description="log spawn number and location. Log location of player every sec too."
}

Thats it! its done, and my fabulous log file says...

ScriptLog: spawn = 8
ScriptLog: spawnxloc =10584.06
ScriptLog: spawnyloc =-1247.03
ScriptLog: spawnzloc =-2341.07
ScriptLog: START MATCH
ScriptLog: movingxloc = 10584.06
ScriptLog: movingyloc = -1247.03
ScriptLog: movingzloc = -2349.84
ScriptLog: movingxloc = -3194.79
ScriptLog: movingyloc = -954.90
ScriptLog: movingzloc = -2334.80
ScriptLog: movingxloc = 9929.67
ScriptLog: movingyloc = 824.73
ScriptLog: movingzloc = -2328.44
ScriptLog: movingxloc = -3391.96
ScriptLog: movingyloc = 956.43
ScriptLog: movingzloc = -2349.81
ScriptLog: movingxloc = 10113.85
ScriptLog: movingyloc = -1097.91
ScriptLog: movingzloc = -2349.88

and occasionally says...

Warning: Watcher CTF-FaceClassic.Watcher (Function Watcher.Watcher.Timer:0046) Accessed None 'Pawn'
ScriptLog: movingxloc = 0.00
Warning: Watcher CTF-FaceClassic.Watcher (Function Watcher.Watcher.Timer:0077) Accessed None 'Pawn'
ScriptLog: movingyloc = 0.00
Warning: Watcher CTF-FaceClassic.Watcher (Function Watcher.Watcher.Timer:00A8) Accessed None 'Pawn'
ScriptLog: movingzloc = 0.00

but I think I'll just ignore it when it does that (it only happens once or twice, and I cant blame it for getting a bit confused)

anyway, heres a little piccy of my moving lego car



ttfn

0 Comments:

Post a Comment

<< Home