Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Really cool cog ...that doesn't work
Really cool cog ...that doesn't work
2002-05-24, 5:57 AM #1
[http://forums.massassi.net/html/frown.gif]

For some reason, all the resistors randomly jumped into the water in the harbour, and killing one had no effect whatsoever on the others.

I'm thinking it's a problem with my For command? should I call a message (see the annotated 'call evil' that I cut out)??? Help, please!

Code:
# Rites of Xanthus TC Cog Script
#
# NOTREASON.COG
# 5.24.02
# -by Lord_Grismath (GrismathDynasty@Hotmail.com)
#
# Description
# 
#   The Resistor AI has been modified to, when killed
# by the player, send a message to this COG, which will
# in turn cause up to 9 other rebels in the defined area
# to turn on the player.
#
#   Especially realistic because only people who are present
# will react.
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message	startup
message	killed

thing		res00
thing		res01
thing		res02
thing		res03
thing		res04
thing		res05
thing		res06
thing		res07
thing		res08
thing		res09

thing		player		local

flex		rval		local

int		traitor=0	local

int		I=1		local

AI		peace
AI		hostile

sound    	manaSnd=ForceFieldHit01.WAV local
sound		evil01
sound		evil02
sound		evil03

end

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

code

startup:
player = GetLocalPlayerThing();
return;

# ........................................................................................


killed:

killer = GetSourceRef();

For(I=0;I<10;I=I+1) {

if(GetSenderRef=res0) {

   // Player killed a FRIENDLY resistor. >:[
   if (player == killer)
   {
	PlaySoundLocal(manaSnd, 1, 0, 4);
	ChangeInv( player, 72, 1.0 );
	SetInv(player, 14, 0);


// *GASP* You murderer!

if(traitor = 0) {

traitor = 1;
rval = Rand();
if (rval < 0.05) {
	print("What? I shall avenge thee!");
	PlaySoundLocal(evil1, 1, 0.0, 0x0);
} else if (rval <0.10) {
	print("Fiend! How darest thou kill thy allies!");
	PlaySoundLocal(evil2, 1, 0.0, 0x0);
} else if (rval <0.15) {
	print("Traitor! Thou shalt pay for this!");
	PlaySoundLocal(evil3, 1, 0.0, 0x0);
}

// Chaaaaaaarge!!!!

// Call evil;

AISetClass(res0, hostile);
AISetMoveThing(res0, player);

} } }

return;

# ........................................................................................

# ........................................................................................

end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-05-24, 6:26 AM #2
Just a few problems I see;

Invalid conditionals. Should be "If(Getsomething() == This)" Never forget the second =.


Screwey arrays. Your array is messed up. Variables should be labled "BlahX", NOT "BlahXX". Count from zero...

Command errors. Getsenderref needs parenthesis, "Getsenderref()".

Undefined variables. 'Killer' is undefined.


BTW, PARSEC catches all of these errors... Do yourself a favor and download it...



------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-05-24, 11:10 AM #3
Quote:
<font face="Verdana, Arial" size="2">
BTW, PARSEC catches all of these errors... Do yourself a favor and download it...
</font>


ARGH! Why does eveyone keep saying that? hehe... :P I concede, I'll do it... sometime.

Thanks for the help, GBK, I'll give it a try.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!