Posted by Calvin on October 19, 1998 at 16:46:57:
My health check works, but the vector checks don't. Help?
# Jedi Knight Cog Script
#
# boxing_camera.cog
#
# Toggles by activation
# Known issues: The player can still turn and look around while the camera is on and even be moved away from the switch, despite efforts to fix this on my part.
#
# 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