Posted by Nightmare on October 08, 1998 at 10:55:29:
I've been going over and over this cog for the longest time, but I can't find what I did wrong. There must be a syntax error or something because it doesn't load at all. CogWriter didn't find anything wrong, but there must be something wrong or it would work. So if anyone sees anything wrong with this code, please let me know.
Thanks,
Nightmare
# Jedi Knight Cog Script
#
# bomber2.cog
#
# A cog to control a TIE Bomber and it's bombs
#
# 10/4/98 Nightmare
#
# This cog is not made or supported in any way by LEC
symbols
message entered
message arrived
message pulse
message timer
message activated
message damaged
message reset
thing bomber linkid=7 // the bomber
thing genpos
thing console linkid=1 // a thing console that can be used to trigger the run when activated
template tiebomb // the template for the bombs
template bomberboom=+tieb_exp
template smoke=+heavysmoke
vector vel0 // the velocity for the bombs
// sector triggersector linkid=4
surface switch linkid=2
sound enginewhine
sound beep
flex firerate
flex speed
int delay
int startframe
int endframe
int lastframe
int health=120
int bmrsnd local
int working local
int damage local
int dummy local
int bombing local
int waiting local
int curframe local
int gotoframe local
end
#======================================================================
code
#======================================================================
arrived:
if(GetSenderID() != 7) return;
curframe=curframe+1;
if(curframe == lastframe)
{
curframe=-1;
call reset;
}
if(curframe >lastframe)
{
gotoframe=curframe + 1;
MoveToFrame(bomber, gotoframe, bomberspeed);
return;
if(curframe==startframe)
{
bombing=1;
SetPulse(firerate);
}
if(curframe==endframe)
{
SetPulse(0);
bombing=0;
}
return;
}
return;
#======================================================================
pulse:
if(waiting==1)
{
SetPulse(0);
return;
}
CreateThingAtPos(tiebomb, GetThingSector(bomber), GetThingPos(bomber), vel0);
return;
#======================================================================
// entered:
activated:
if(GetSenderID() == 7) return;
if(GetSenderID() < 3)
{
working=1;
waiting=0;
if(GetSenderID() == 2)
{
PlaySoundPos(beep, SurfaceCenter(switch), 1.0, -1, -1, 0);
SetWallCel(switch, 1);
}
if(GetSenderID() == 1)
{
PlaySoundThing(beep, console, 1.0, -1, -1, 0);
}
bmrsnd = PlaySoundThing(enginewhine, bomber, 10.0, -1, -1, 0x41);
SkipToFrame(bomber, 0, speed);
curframe=0;
return;
#======================================================================
damaged:
if(waiting==1) return;
if(getsenderid()==bomber)
{
dummy=CreateThing(smoke, bomber);
damage=getparam(0);
health=health-damage;
if(health>0) return;
dummy=CreateThing(bomberboom, bomber);
call reset;
return;
}
return;
#======================================================================
timer:
working=0;
return;
#======================================================================
reset:
if(bombing==1)
{
SetPulse(0);
bombing=0;
}
StopSound(bmrsnd, 0);
TeleportThing(bomber, genpos);
SetTimer(delay);
waiting=1;
return;
#======================================================================
end