Posted by Calvin on September 23, 1998 at 14:11:54:
The "ToggleCam" cog I submitted earlier was admittedly buggy, and I have my own MP level to use it in, so I've been working on it. Unfortunately, my vector checks ain't working. I know the GetThingHealth() check works, but my GetThingLVec() and GetThingPos() checks are not. Can anyone see anything wrong with this code - maybe some erroneous usage of vector variables or a really stupid syntax error? Or will this be one of those questions that noone answers?
# Jedi Knight Cog Script
#
# boxing_camera.cog
#
# Toggles by activation
#
# Calvin - 9/14/98
# This Cog is not supported by LucasArts Entertainment Co.flags=0x240
symbols
message activated
message startup
message pulsesound beep=beep2.wav
surface surface linkid=1
thing thing linkid=1
thing camera
thing me local
int inuse=0 local
int currentcamera local
int mehealth local
vector mepos local
vector melook localend
# ========================================================================================
code
startup:
me=GetLocalPlayerThing();
return;activated:
if (GetSenderID()==1)
{
if (inuse==0)
{
// start the camera
inuse=1;
SetPulse(0.5);
mepos=GetThingPos(me);
mehealth=GetThingHealth(me);
melook=GetThingLVec(me);
SetActorFlags(me, 0x840000);
StopThing(me);
// Fix our "don't work in external view" bug...
currentcamera=GetCurrentCamera();
SetCurrentCamera(0);
SetCameraFocus(0, camera);
PlaySoundLocal(beep, 1, 0, 132);
return;
}
if (inuse==1)
{
call cleanup;
return;
}
}pulse:
if (GetThingPos(me)!=mepos) //did we move?
{
call cleanup;
return;
}
if (GetThingHealth(me)!=mehealth && GetThingHealth(me) > 0) //were we hurt?
{
call cleanup;
return;
}
if (GetThingLVec(me)!=melook) //did we look away?
{
call cleanup;
return;
}
return;cleanup:
// clean up our mess
inuse=0;
SetPulse(0);
ClearActorFlags(me, 0x840000);
SetCameraFocus(0, me);
SetCurrentCamera(currentcamera);
return;# ........................................................................................
end