Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Syncing problem
Syncing problem
2001-04-17, 4:22 PM #1
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=== #
Team Battle.
2001-04-18, 6:56 AM #2
uh-uh... you need to use flags... ( 404 )

------------------
Best file compression around: 'DEL *.*' = 100% compression
--
Also, visit my homepage, the Cave
WHAT?
2001-04-18, 6:58 AM #3
Code:
# ===BoF=== ### JK Counterstrike Cog Script## ACTOR_HOSTAGE.COG## Hostage actor cog for JK CS TC## [Dormouse -- LapsusLinguae@juno.com]#      [http://dormouse.cjb.net/]
flags=404
# # === #  symbols#---#message	startupmessage createdmessage	pulsemessage activatedmessage touchedmessage killedtemplate	hostage_tpl=hostage	localthing		hostageStart=179thing		hostage		localsector		sectorRescue=109int		isReleased=0	localint		isRescued=0	localint		isMobile=0	localthing		player		local#---#  end#===#  code#---#startup [http://forums.massassi.net/html/tongue.gif]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=== #

Should work...

------------------
Best file compression around: 'DEL *.*' = 100% compression
--
Also, visit my homepage, the Cave
WHAT?
2001-04-18, 9:50 AM #4
No, use :
Code:
flags=0x240

PS What happened to the TeamBattle Webpage???
------------------
I am the EDITING FANATIC!!! RUN IN FEAR!!!My witty, everchanging comments shall be your BANE!

[This message has been edited by scott_karana (edited April 18, 2001).]
Hey, I'm here! But who cares?
2001-04-18, 9:51 AM #5
0x240
Not ox240

------------------
Together we stand.
Divided we fall.
2001-04-18, 11:35 PM #6
Ok. Thanks for taking the time to reply.

First off TB TC's web page is now www.jkteambattle.8m.com

Secondly I tried all the flags I was given. But it seemed to work with 0x404. But there's a catch. The hostage is synced until a player clicks "use" on him (or tells him to follow him" and then they become hidiously unsynced. Does anyone have a solution for this?

Thanks yet again.
Team Battle.
2001-04-18, 11:44 PM #7
Encrypted cog...no breaking lines.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-21, 10:44 AM #8
Sorry Hideki?
Please anyone help, I really need this [http://forums.massassi.net/html/frown.gif]
Team Battle.
2001-04-21, 5:50 PM #9
PLEASE... anyone? The person that tells me how to fix it gets... umm... a cookie... I dont, but please?
Team Battle.
2001-04-22, 6:20 PM #10
LoL! I wonder besides the symbols section... Do you really need like breaks? Any at all? [http://forums.massassi.net/html/wink.gif]


Quote:
<font face="Verdana, Arial" size="2">Originally posted by Hideki:
Encrypted cog...no breaking lines.

</font>

- Wisdom is 99% experience, 1% knowledge. -
2001-04-23, 6:24 AM #11
Line breaks aren't necessary. In my smaller cogs I don't bother, in larger ones I like to include them so that it is clearly visible where each message is.

------------------
Together we stand.
Divided we fall.
2001-04-23, 8:42 AM #12
The first # comments out the whole cog... [http://forums.massassi.net/html/frown.gif]

------------------
http://millennium.massassi.net/ - Millennium
2001-04-23, 1:26 PM #13
Ahhhhhh... I know nothing about cog... someone explain it REALLY simple for me [http://forums.massassi.net/html/frown.gif]
Team Battle.

↑ Up to the top!