Posted by Stealth on February 24, 1998 at 03:41:00:
In Reply to: Cog Probs... yet again... posted by GMS_SLUG on February 23, 1998 at 21:07:23:
> The cog is supposed to release a group of thermal detonators down a shaft when a person enters a sector unless they've found and deactivated the switch that controls the trap beforehand. What keeps happening though, is that it just won't roll out any thermals...
The int symbol deactivated is spelt wrong compared to what it`s spelt in the code so it won`t work..
I made a couple other minor changes.. as noted below.
# Jedi Knight Cog Script
#
# thermaltrap.cog
#
# Releases a round of thermals when player enters sector, unless the trap has
# been deactivated beforehand by a switch.
#
# [SLUG]
#
# (c) Slug enterprises 1998. Any similarity to any cog, living or dead is
# purely coincidental. (or due to the fact that this is a hi-jacked version
# of m2.dettrap.cog)
# ========================================================================================symbols
message activated ## changed to activated from activate
message entered
surface switch linkid=0 desc=switch ### added linkid=0
sector shootsector linkid=1 desc=shootsectorthing tdg1 nolink,desc=tdg1
thing tdg2 nolink,desc=tdg2
thing tdg3 nolink,desc=tdg3
thing tdg4 nolink,desc=tdg4int rounds=2 desc=rounds
flex rate=0.1 desc=rate
flex delay=3.0 desc=delayint firing=0 local
int cur_round=0 local
int dummy local
int deactivaed=0 local ### misspelt should be deactivated or change the spelling in the code section to match :-)template proj_tpl=+grenade2 local
sound on_snd=set_hi2.wav local
sound off_snd=lgclick1.wav localend
# ========================================================================================
code
activated:
If (GetSenderId()==0) // ensures only the switch deactivates it
{
deactivated = 1; // Deactivate the trap
}
return;entered:
if(GetSenderID() == 1)
{
if(firing == 1) Return;
if(deactivated == 1) Return; // If deactivated, exit the activation codefiring = 1;
dummy = SetWallCel(switch, 1);
dummy = PlaySoundPos(on_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0);
// these "dummy=" are not neededcur_round = 0;
while(cur_round < rounds)
{
dummy = CreateThing(proj_tpl, tdg1);
Sleep(rate);
dummy = CreateThing(proj_tpl, tdg2);
Sleep(rate);
dummy = CreateThing(proj_tpl, tdg3);
Sleep(rate);
dummy = CreateThing(proj_tpl, tdg4);
Sleep(rate);cur_round = cur_round + 1;
}Sleep(delay);
dummy = SetWallCel(switch, 0);
dummy = PlaySoundPos(off_snd, SurfaceCenter(switch), 1.0, 5.0, 10.0, 0);
firing = 0;
Return;
// these "dummy=" are not needed
end> Any help would, of course, be greatly appreciated..