PDA

View Full Version : Really cool cog ...that doesn't work



Lord_Grismath
05-24-2002, 08:57 AM
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!



# 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[I]) {

// 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[I], hostile);
AISetMoveThing(res0[I], player);

} } }

return;

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

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

end

gbk
05-24-2002, 09:26 AM
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 (http://www.tbns.net/GBK/ol/index.htm).

Lord_Grismath
05-24-2002, 02:10 PM
<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.