Posted by Nightmare on November 21, 1998 at 23:44:30:
This cog is supposed to move the "target" throught it's frames to "lastframe" at the activation of a switch. If it reaches "lastframe" or is damaged, it is supposed to retur to the starting position. My problem is that I can't seem to get the activated message when I have the damage mask set on the "target". waitforstop(target) doesn't work either. Can anyone suggest a remedy? # Jedi Knight Cog Script symbols message activated thing target mask=0x408 template explode sound flysound surface switch int working=0 local flex speed end # ======================================================================================== code activated: if(GetSenderRef() == target) return; if(working==1) return; SetWallCel(switch, 1); MoveToFrame(target, 1, speed); targetsnd = PlaySoundThing(flysound, target, 10.0, -1, -1, 0x41); return; } return; # ======================================================================================== arrived: if(GetSenderRef() == target) if(currentframe == 0) return; if(currentframe == lastframe) currentframe=currentframe + 1; return; damaged: if(GetSenderRef() == target) if(working == 0) return; dummy = CreateThing(explode, target); SetWallCel(switch, 0); StopSound(targetsnd, 0); TeleportThing(target, genpos); currentframe=0; return; } return; end
#
# shooting_range.cog
#
# 11/21/98 Nightmare
message arrived
message damaged
thing genpos nolink
sound click
int currentframe=0 local
int dummy local
int targetsnd local
int lastframe
{
working=1;
PlaySoundPos(click, SurfaceCenter(switch), 1.0, -1, -1, 0);
{
currentframe = GetCurFrame(redtarget);
{
SetWallCel(switch, 0);
PlaySoundPos(click, SurfaceCenter(switch), 1.0, -1, -1, 0);
StopSound(targetsnd, 0);
TeleportThing(target, genpos);
SkipToFrame(target, 0, speed);
currentframe=0;
working=0;
return;
}
MoveToFrame(target, currentframe, speed);
}
# ========================================================================================
{
PlaySoundPos(click, SurfaceCenter(switch), 1.0, -1, -1, 0);
SkipToFrame(target, 0, speed);
working=0;