PDA

View Full Version : I hit one, and all follow?



Edward
09-14-2003, 09:16 AM
Hi!
I have a COG here for JK MP, and when I hit one light, all lights with this COG do the same.


# Bump Light
#
# By Edward and help from DSLS_DeathSythe
#===============
flags=0x240
symbols
#---------------
message activated
message damaged
message trigger
message timer

thing light mask=0x408
thing x

keyframe bump

int is_busy=0 local
int bump_trig=1 local
#---------------
end
#===============
code
#---------------
startup:
//-Clear the IS_BUSY...
is_busy = 0;
ThingLight(light, 0, 0.01);
return;
#---------------
activated:
//-Check to see if the cog is busy...
if(is_busy == 1)
return;
//-Make sure it was the light...
if(GetSenderRef() != light)
return;
SendTrigger(-1, bump_trig, 0, 0, 0, 0);
return;
#---------------
damaged:
//-Check to see if the cog is busy...
if(is_busy == 1)
return;
//-Make sure it was the light...
if(GetSenderRef() != light)
return;
SendTrigger(-1, bump_trig, 0, 0, 0, 0);
return;
#---------------
trigger:
//-Make sure that its the right trigger...
if(GetSourceRef() != bump_trig)
return;
//-Check to see if the cog is busy...
if(is_busy == 1)
return;
//-Make the cog busy and set a timer that is as
//-long as the bump keyframe...
is_busy = 1;
SetTimerEx(GetKeyLen(bump), 1, 0, 0);
//-Play key and turn the light on...
PlayKey(light, bump, 1, 0x2);
ThingLight(x, 1, 0.9);
SetTimerEx(1.0, 2, 0, 0);
return;
#---------------
timer:
//-Clear the IS_BUSY...
if(GetSenderID() == 1)
{
is_busy = 0;
return;
}
//-Turn light off...
else
if(GetSenderID() == 2)
ThingLight(x, 0, 1.1);
return;
#===============
end

Please help me to do so that if I hit one light, only that one will move.

/Edward

DSLS_DeathSythe
09-14-2003, 11:30 AM
int bump_trig=1 local

you need to take out the local so that you can change the bump_trig int in jed.
it needs to be a different number each time you use the cog in your level and it also needs to be different from any other triggers in any other cogs you have in your level.
if the bump_trig is the same for all the cogs then activating one will trigger all of them.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited September 14, 2003).]

Edward
09-14-2003, 12:51 PM
Thank you!
------------------
"If you so much as utter one syllable I'll hunt you down and gut you like a fish!
If you'd like to fax me press the star key..." - Grinch

[This message has been edited by Edward (edited September 14, 2003).]