Ok here's the cog for the hostage for Team Battle TC. Unfortunatly the hostage is not synced. He appears in different locations on the host's computer, and on the clients. Any help would be greatly appreciated.
Code:
# ===BoF=== #
#
# JK Counterstrike Cog Script
#
# ACTOR_HOSTAGE.COG
#
# Hostage actor cog for JK CS TC
#
# [Dormouse -- LapsusLinguae@juno.com]
# [http://dormouse.cjb.net/]
#
# === #
symbols
#---#
message startup
message created
message pulse
message activated
message touched
message killed
template hostage_tpl=hostage local
thing hostageStart=179
thing hostage local
sector sectorRescue=109
int isReleased=0 local
int isRescued=0 local
int isMobile=0 local
thing player local
#---#
end
#===#
code
#---#
startup:
player = GetLocalPlayerThing();
hostage = CreateThing(hostage_tpl , hostageStart);
if(isMulti())
{
SetActorFlags(hostage , 0x40000);
isMobile = 0;
isReleased = 0;
isRescued = 0;
}
return;
#---#
created:
SetPulse(0.5);
if(!isMulti())
{
hostage = GetSenderRef();
SetActorFlags(hostage , 0x40000);
isMobile = 0;
}
return;
#---#
pulse:
AISetMode(hostage , 0x2009);
AISetMoveSpeed(hostage , 3);
AISetLookPos(hostage , GetThingPos(player));
AISetMovePos(hostage , GetThingPos(player));
SyncThingPos(hostage);
if(GetThingSector(hostage) == sectorRescue)
{
print("-=HOSTAGE RESCUED!=-");
SetActorFlags(hostage , 0x40000);
StopThing(hostage);
ClearAIMode(hostage , 0x2009);
SetPulse(0);
isRescued=1;
ChangeInv(player , 152 , 500);
}
return;
#---#
activated:
if(isRescued) return;
if(isMobile == 0)
{
ClearActorFlags(hostage , 0x40000);
isMobile = 1;
if(isReleased == 0)
{
jkStringClear();
jkStringConcatAsciiString("Marty says: 'Ok, '");
jkStringConcatPlayerName(player);
jkStringConcatAsciiString(". I'm Right behind you!'");
jkStringOutput(player , -1);
jkStringClear();
isReleased = 1;
}
return;
}
else if(isMobile == 1)
{
Print("You Say: 'STAY THERE!'");
SetActorFlags(hostage , 0x40000);
isMobile = 0;
return;
}
return;
#---#
touched:
if((GetSourceRef() == player) || (GetSenderRef() == player)) StopThing(hostage);
return;
#---#
killed:
jkStringClear();
jkStringConcatAsciiString("-=HOSTAGE KILLED BY: ");
jkStringConcatPlayerName(GetSourceRef());
jkStringConcatAsciiString("!=-");
jkStringOutput(-3 , -1);
jkStringClear();
return;
#---#
end
# ===EoF=== #
layer = GetLocalPlayerThing();hostage = CreateThing(hostage_tpl , hostageStart);if(isMulti()){ SetActorFlags(hostage , 0x40000); isMobile = 0; isReleased = 0; isRescued = 0;}return;#---#created:SetPulse(0.5);if(!isMulti()){ hostage = GetSenderRef(); SetActorFlags(hostage , 0x40000); isMobile = 0;}return;#---#pulse: AISetMode(hostage , 0x2009);AISetMoveSpeed(hostage , 3);AISetLookPos(hostage , GetThingPos(player));AISetMovePos(hostage , GetThingPos(player));SyncThingPos(hostage);if(GetThingSector(hostage) == sectorRescue){ print("-=HOSTAGE RESCUED!=-"); SetActorFlags(hostage , 0x40000); StopThing(hostage); ClearAIMode(hostage , 0x2009); SetPulse(0); isRescued=1; ChangeInv(player , 152 , 500);}return;#---# activated:if(isRescued) return;if(isMobile == 0){ ClearActorFlags(hostage , 0x40000); isMobile = 1; if(isReleased == 0) { jkStringClear(); jkStringConcatAsciiString("Marty says: 'Ok, '"); jkStringConcatPlayerName(player); jkStringConcatAsciiString(". I'm Right behind you!'"); jkStringOutput(player , -1); jkStringClear(); isReleased = 1; } return;}else if(isMobile == 1){ Print("You Say: 'STAY THERE!'"); SetActorFlags(hostage , 0x40000); isMobile = 0; return;}return;#---#touched:if((GetSourceRef() == player) || (GetSenderRef() == player)) StopThing(hostage);return;#---#killed:jkStringClear();jkStringConcatAsciiString("-=HOSTAGE KILLED BY: ");jkStringConcatPlayerName(GetSourceRef());jkStringConcatAsciiString("!=-");jkStringOutput(-3 , -1);jkStringClear();return;#---# end# ===EoF=== #![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)