I know I've posted this before, but as yet I have found nor recieved any fix for it.
What happens is the hostage is synced until a player activates him. So if you push him round without activating him then both computers see him in the same place.
When the user activates on him the hostage on his computer follows him. But then another computer will only see in the place he was before he was activated.
Each user can kill each others hostage. I'm guessing its got something to do with a certian flag dormouse has used, not sure. Any help would be greatly appreciated!
What happens is the hostage is synced until a player activates him. So if you push him round without activating him then both computers see him in the same place.
When the user activates on him the hostage on his computer follows him. But then another computer will only see in the place he was before he was activated.
Each user can kill each others hostage. I'm guessing its got something to do with a certian flag dormouse has used, not sure. Any help would be greatly appreciated!
Code:
# ===BoF=== #
#
# JK Team Battle Cog Script
#
# ACTOR_HOSTAGE.COG
#
# Hostage actor cog for JK TB TC
#
# [Dormouse -- LapsusLinguae@juno.com]
# [http://dormouse.cjb.net/]
#
# === #
flags=0x404
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 = CreateThingNR(hostage_tpl , hostageStart);
if(isMulti())
{
SetActorFlags(hostage , 0x40000);
isMobile = 0;
isReleased = 0;
isRescued = 0;
}
return;
#---#
created:
SetPulse(0.1);
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)
{
AISetLookPos(hostage , GetThingPos(player));
AISetMovePos(hostage , GetThingPos(player));
SyncThingPos(hostage);
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)
[/edit]![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)