Re: Making enemy AI radio in for backup


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

Posted by Aristeus on January 30, 1998 at 16:16:45:

In Reply to: Re: Making enemy AI radio in for backup posted by Stealth on January 30, 1998 at 10:25:18:

> One suggestion though

> Remove the Sleep(2.0) and replace it with SetTimer()and add the timer: event and message.

> When Sleep() is used it puts the cog into a funny state in which you can loose the values of previously saved variables.Basicly it halts the cog.

> Using the SetTimer() verb is much safer as cog control is not lost. And only requires a few more lines of code.
>
I like that. I didn't know sleep froze the cog. I thought it just froze that
particular message section. Oh well, to use the timer command instead, add:
"message timer" to the symbols section, and change pulse to be as follows:
pulse:
// Don't trigger the call unless the player has been spotted.
if(HasLOS(comtrp, player))
{
SetPulse(0);
SetTimerEx(2.0, 0, 0, 0);
}
return;

Now add the timer section as follows(right after pulse should work fine):
timer:
//Check to see that trooper is still alive.
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;

Like Stealth said, just a few more lines. I'd use SetTimer, but I don't
know the syntax. I know SetTimerEx, and so this should work, since it's
only sending the timer message to itself. Thanks for the homework comment,
Stealth, I take that as a compliment. :) It's even funnier because an hour
ago I enrolled in two college courses: C++ and assembly language...and it
was JK that got me interested. Weird.



Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


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