Re: Making enemy AI radio in for backup


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]

Posted by Aristeus on January 30, 1998 at 05:09:38:

In Reply to: Making enemy AI radio in for backup posted by GMS_SLUG on January 29, 1998 at 22:21:06:

> I'm making a level, and I what I want to happen is if an AI notices you, and he isn't killed within a second or so he (supposedly) radios in for backup.... at that point enemygenerators throughout the level start spewing out enemies..... I don't have much experience with cogs so a vague answer won't do me much good... any help would be GREATLY appreciated.....

> Thnx in advance.
Here goes an attempt. I'm not sure exactly how 'nolink' works,
and some other things are fuzzy, but I'll try, and I welcome any
comments/corrections.

First, set up your 00_generator.cogs(or whichever generator you will
use) and your initial trooper who will call for backup in JED.

Once that's done, you can add 00_rbackup.cog(below) to the
##COG SCRIPTS## section of your level .jkl file. Increase the
"World Scripts" number by 1.

Add the next line to the ## COG placement## section, and increase
the "World Cogs" number by 1:

cog#: 00_rbackup.cog comtrpthing# scan1sector# backup1cog#

Cog# is just whatever number is assigned to THIS cog under the
## COG placement ## section.

comtrpthing# is the number of this particular trooper under the
## Thing placement ## section.

scan1sector# is the number of the sector you want to use as the
trigger for this cog. "Entered" messages when the player
enters other sections will not set off the cog.

backup1cog# is the number of the generator cog you want to activate
under the ## COG placement ## section.

You may add addtional sectors or generators to the cog, but so far
as I can figure it out, the args after 00_rbackup.cog are read into
it in order, so if you added sector scan2 and generators backup2 and
backup3, your line would look like this:

Cog#: 00_rbackup.cog thing# sc1sect# sc2sect# bk1cog# bk2cog# bk3cog#
(had to abbreviate due to length, but you get the idea).

So here's the cog I made to do the job. I haven't been able to test
it, so don't jump into implementing it until someone with more
knowledge has a chance to critique my message.

# Jedi Knight Cog Script
#
# 00_RBACKUP.COG
#
# Trooper Calls for Backup if not killed within 2 sec. of player
# arrival.
#
# [TCB]
#
# ========================================================================================

symbols

message killed
message entered
message pulse

thing comtrp mask=-1

#You'll need to increase the number of sectors if there's more
#than one way the player could get here.
sector scan1

#Add another generator line for each generator position.
cog backup1

thing player nolink local
int deadtrp local
int radio local
sound helpme=(your own .wav) local

end

# ========================================================================================

code

entered:

//Disregard the whole cog if message alredy sent or trooper dead.
if (deadtrp == 1) return;
if (radio == 1) return;

player = GetLocalPlayerThing();
// Don't start unless "entered" was sent by this sector.
if(GetThingSector(player) == scan1)
{
SetPulse(0.5);
}

return;


killed:

if (deadtrp == 1) return;

if (GetSenderRef() == comtrp)
{
deadtrp = 1;
}

return;

pulse:
// Don't trigger the call unless the player has been spotted.
if(HasLOS(comtrp, player))
{
SetPulse(0);
Sleep (2.0);
//Trooper may have died during sleep, so check.
if(deadtrp == 1) return;
radio = 1;
PlaySoundThing(helpme, comtrp, 1.5, 10.0, -1, 0x10080);
//Send the User0(activation) message to 00_generator.
SendMessage(backup1, User0);
}
return;

end
---------------------------------------------------------------
I hope I got this done correctly. The thing# and sector# works fine,
but I haven't tried calling another cog before, so I'm not sure
about that. Hope this is a fairly reasonable start, though.

I don't know of a "Send backup" type .wav in JK, so I think
you'll have to do your own. Fortunately, ST voices aren't the
hardest things in the world to create. Just record over a CB or
a scratchy telephone connection.

Also, be sure that the activation message is the correct one for
whichever generator cog you're using. If it isn't User0, it's not
going to work unless you put the correct message in.

-Aristeus.


Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]