Hello, everyone. For some reason my 02_patrol cog, which had worked perfectly up to this point is now experiencing weird errors... the movers cease to detect the player if they see him, but the cutscene still plays if you enter the omq sectors, which are just places that should be off-limits. Also, the cutscene still doesn't kill the player on detection, but if that doesn't work, I can just send a message to another cog that can kill the player.
Code:
# Jedi Knight Cog Script
#
# GISMATH.COG
#
#
symbols
message user1
message pulse
message arrived
message timer
message entered
message activated
sector omq0
sector omq1
sector omq2
sector killall
thing player local
thing truckcam
thing mover
thing mover1
thing mnode
thing mnode1
thing m1node
thing m1node1
flex movespeed=1
flex movespeed1=1
flex pivotdelay=1
flex pivotdelay1=1
flex range=2
flex range1=2
int point=0 local
int point1=0 local
int just=0 local
int just1=0 local
int spot=0 local
flex fov=0.9
flex fov1=0.9
flex maxdist=2
flex maxdist1=2
thing truckcam
thing truck
sound pget
sound bget
sound detect
sound spy
sound bang
int music local
end
# ========================================================================================
code
user1:
AIClearMode(mover, 0x1004);
AIClearMode(mover1, 0x1004);
SetPulse(0.05);
AISetLookPos(mover, GetThingPos(mnode));
AISetMoveThing(mover, mnode);
AISetMovespeed(mover, movespeed);
AISetLookPos(mover1, GetThingPos(m1node));
AISetMoveThing(mover1, m1node);
AISetMovespeed(mover1, movespeed);
music=playsoundlocal(spy, 1, 0, 0x1);
Return;
# ........................................................................................
Activated:
if(GetSenderRef()==truck) {
StopSound(music, 0.5);
DestroyThing(mover);
DestroyThing(mover1);
}
Return;
# ........................................................................................
Entered:
if(GetSenderRef()==omq0) Call Spotted;
if(GetSenderRef()==omq1) Call Spotted;
if(GetSenderRef()==omq2) Call Spotted;
if(GetSenderRef()==killall) {
SetPulse(0.0);
}
Return;
# ........................................................................................
Pulse:
player = FirstThingInView(mover, fov, maxdist, 0x400);
while(player != -1) {
if(HasLOS(mover, player) && (VectorDist(GetThingPos(player), GetThingPos(mover)) <= maxdist) && !(GetThingFlags(player) & 0x200) && (player == GetLocalPlayerThing()))
{
call Spotted;
}
player = NextThingInView();
}
player = FirstThingInView(mover1, fov1, maxdist1, 0x400);
while(player != -1) {
if(HasLOS(mover1, player) && (VectorDist(GetThingPos(player), GetThingPos(mover1)) <= maxdist) && !(GetThingFlags(player) & 0x200) && (player == GetLocalPlayerThing()))
{
call Spotted;
}
player = NextThingInView();
}
Return;
# ........................................................................................
Arrived:
If(GetSenderRef() == mover && !just)
{
just = 1;
SetTimerEx(pivotdelay + range*Rand(), 0, 0, 0);
}
If(GetSenderRef() == mover1 && !just1)
{
just1 = 1;
SetTimerEx(pivotdelay1 + range1*Rand(), 1, 0, 0);
}
Return;
# ........................................................................................
Timer:
If(GetSenderID() == 0)
{
just = 0;
point = 1 - point;
AISetLookPos(mover, GetThingPos(mnode[point]));
AISetMoveThing(mover, mnode[point]);
}
If(GetSenderID() == 1)
{
just1 = 0;
point1 = 1 - point1;
AISetLookPos(mover1, GetThingPos(m1node[point1]));
AISetMoveThing(mover1, m1node[point1]);
}
Return;
Spotted:
if(spot==0) {
spot=1;
playsoundlocal(detect, 1, 0, 0x0);
player=GetLocalPlayerThing();
SetActorFlags(player, 0xa00000);
StopThing(player);
TeleportThing(mover, mnode);
TeleportThing(mover1, m1node1);
SetCameraFocus(0, truckcam);
SetCurrentCamera(0);
Sleep(0.5);
AISetLookPos(mover1, GetThingPos(player));
Print("PETER: GET HIM!");
PlaySoundLocal(pget, .7, 0, 0x0);
AISetLookPos(mover, GetThingPos(player));
Sleep(1.5);
Print("BERNARD: Yeah! Get him! ...oh");
Print("");
Print("");
Print("");
Print("");
PlaySoundLocal(bget, .7, 0, 0x0);
Sleep(1.5);
SetCurrentCamera(1);
PlaySoundLocal(bang, 1, 0, 0x0);
ClearActorFlags(player, 0xa00000);
DamageThing(player, 999, 0x0, player);
}
Return;
end
