The COG in pre tags. Readable this time


[ Follow Ups ] [ Post Followup ] [ The Massassi Temple Message Board ]

Posted by Farrax on October 08, 1998 at 12:09:38:

In Reply to: Outsmarted by my cog posted by Nightmare on October 08, 1998 at 10:55:29:

# 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




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ The Massassi Temple Message Board ]