I need the knight to patrol from one ghost to another, ina  function that can be turned on and off, but without disrupting the flames:
        
                
                
                    
                
            Code:
        
    # 03_sneaky.cog
# [Grismath]
# 5.27.04
#
# NEW: 8.29.04: Loop through all surfaces to find ones
#  with a custom flag, then set those to geo4, and
#  scroll them down.
#
#  Thanks go to LKOH_SniperWolf for the rain code.
#
#=====================================================#
symbols
message	entered
thing		player		local
sector		outside
thing		windowcam
thing		knight
thing		torch0
thing		torch1
thing		torch2
thing		light0
thing		light1
thing		light2
template	flame
thing		viewcam
thing		telewindow
material	rainmat
flex     animRate
int      numSurfs    local
int      i           local
int		rainstat=0	local
int		lt0=1	local
int		lt1=1	local
int		lt2=1	local
vector		slidevec
flex		slidespeed
end
#=======================================================#
code
#--------------------------------------------------------
user0:
SetPulse(0.5);
return;
#--------------------------------------------------------
activated:
if(GetSenderRef()==torch0) {
lt0=0;
SetThingLight(light0, 0.0);
}
if(GetSenderRef()==torch1) {
lt1=0;
SetThingLight(light1, 0.0);
}
if(GetSenderRef()==torch2) {
lt2=0;
SetThingLight(light2, 0.0);
}
if(lt0==1 && lt1==1 && lt2==1 && warg==0) {
warg=1;
SetActorFlags(player, 0xa00000);
// Stop patrol
SetCameraFocus(0, viewcam);
Print("SOLDIER: The flames died... that's odd.");
Sleep(2.0);
PlaySoundLocal(thunder, 1, 0, 0x0);
TeleportThing(knight, telewindow);
Sleep(1.0);
SetCameraFocus(0, windowcam);
rainstat=1;
numSurfs = GetSurfaceCount();
for(i = 0; i < numSurfs; i = i + 1){
    if(GetSurfaceMat(i) == rainmat) {
	SetFaceGeoMode(i,0x4);
	slidewall(i, slidevec, slidespeed);
    }
}
Sleep(1.0);
Print("SOLDIER: Ah, that explains it.");
Sleep(2.0);
SetCameraFocus(0, advcam);
ClearActorFlags(player, 0xa00000);
}
return;
#--------------------------------------------------------
pulse:
if(rainstat==1) {
 return;
} else {
if(lt0==1) CreateThing(flame, light0);
if(lt1==1) CreateThing(flame, light1);
if(lt2==1) CreateThing(flame, light2);
// patroller move
}
return;
#--------------------------------------------------------
entered:
if(GetSenderRef()==outside && wraa==0) {
wraa=1;
SetActorFlags(player, 0xa00000);
SetCameraFocus(0, windowcam);
Print("INSIDE: Knave, why durst thou abandon thy post?");
Sleep(2.0);
AISetMovePos(knight, GetThingPos(telewindow));
Sleep(1.0);
Print("SOLDIER: My apologies, sir, it shall not happen again.");
Sleep(2.5);
Print("INSIDE: See to it that is does not.");
Sleep(2.0);
SetCameraFocus(0, advcam);
ClearActorFlags(player, 0xa00000);
// Begin patrol sequence
}
if(GetSenderRef()==path0 && lt0==1) {
if(GetThingSector(knight)==left || GetThingSector(knight)==right) {
// Copy this for the other two path parts
SetActorFlags(player, 0xa00000);
// Stop Patrol
SetCameraFocus(0, windowcam);
Print("SOLDER: Sir!  Someone approaches!");
Sleep(2.0);
SetCameraFocus(0, viewcam);
Sleep(1.0);
ClearActorFlags(player, 0xa00000);
DamageThing(player, 999, 0x1, player);
}
}
if(GetSenderRef()==path1 && lt1==1) {
if(GetThingSector(knight)==left || GetThingSector(knight)==right) {
SetActorFlags(player, 0xa00000);
Print("SOLDER: Sir!  Someone approaches!");
Sleep(2.0);
ClearActorFlags(player, 0xa00000);
DamageThing(player, 999, 0x1, player);
}
}
if(GetSenderRef()==path2 && lt2==1) {
if(GetThingSector(knight)==left || GetThingSector(knight)==right) {
SetActorFlags(player, 0xa00000);
Print("SOLDER: Sir!  Someone approaches!");
Sleep(2.0);
ClearActorFlags(player, 0xa00000);
DamageThing(player, 999, 0x1, player);
}
}
return;
#--------------------------------------------------------
end