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 → SyncThing not ghost
SyncThing not ghost
2002-03-28, 7:26 AM #1
I am trying to syncronize some moving crates that are created with

CreateThing(THETEMPLATE, GHOSTTHING);

I am trying to use SyncThingPos. But once my things are created, I'm not sure how to insert the proper thing number. I know the thing number of the ghost where the object is created, but that doesnt seem right. Also what kinda cog flags if any would be necessary? Any help would be, um, helpful.
2002-03-28, 8:17 AM #2
you could try:
crate = CreateThing(template, ghostthing);
SyncThingPos(crate);
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-03-28, 8:47 AM #3
Or better yet,


Syncthingpos(Creatething(Type, Ghost));

 

Always nice to save a few variables... [http://forums.massassi.net/html/wink.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-03-28, 11:05 AM #4
nice, but slower...gladly, COG is not so speed dependent.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-28, 2:54 PM #5
Eh, GBK, doesn't that seem a bit useless? The thing would be created at the same pos on all comps. So there's no need to try to sync it right away.

------------------
Author of the Jedi Knight DataMaster.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-03-28, 3:26 PM #6
I should've been more specific when i posted the question. Here is the cog that controls the exploding crate. The cog is in the template. Im trying to make it ALSO continually sync the crate. As is the crates blow up after a minute or if significantly damaged...but their location isnt being syncronized
(Another cog creates them at the ghost positions)

flags=0x80

symbols

message created
message damaged
message timer
message pulse

material 00t_5.mat

template barrel_exp=+xtank4_exp local
int barrel local

flex barrelhealth local


end

# ========================================================================================

code

created:
SetThingUserData(GetSenderRef(), 35); // set the initial user data (i.e. "health")
barrel = GetSenderRef();
SetPulse: (0.05);
{
SetTimerEx(60.0, barrel, 0, 0); // prepare to kill the barrel in 60 second
Return;
}

Return;

damaged:
barrel = GetSenderRef();
damage = GetParam(0);
barrelhealth = GetThingUserData(barrel);

if(GetParam(1) == 1) Return; // barrel won't be damaged by damage type impact

if(barrelhealth <= damage) // is this enough damage to kill the barrel ?
{
SetTimerEx(0.5, barrel, 0, 0); // prepare to kill the barrel in 0.5 second
Return;
}

SetThingUserData(barrel, barrelhealth - damage);
Return;
# ............................................................................................

timer:
KillTimerEx(GetSenderId());
CreateThing(barrel_exp, GetSenderId()); // create an explosion
DestroyThing(GetSenderId()); // Destroy the barrel
Return;

Pulse:
barrel = GetSenderRef();
SyncThingPos(barrel);
Return;
2002-03-30, 10:43 AM #7
Does that run? You've got some bugs in that cog. Most notably the SetPulse: (0.05).

Try this:

Code:
# barrelblow.cog
#
# Manage a barrel's hull and blow it up when damaged enough.
#
# [SM + GD]
#======================================================================#
flags=0x80
#======================================================================#
symbols

message	created
message	damaged
message	timer
message	pulse

template	barrel_exp=+xtank4_exp	local
thing		barrel					local
int		type						local
flex		damage					local
flex		barrelHealth				local

end
#======================================================================#
code
#--------------------------------------------------------------------
created:
	barrel = GetSenderRef();
	SetThingUserData(barrel, 35);
	SetTimerEx(60, barrel, GetThingSignature(barrel), 0);
	SetThingPulse(barrel, 0.05);

Return;
#--------------------------------------------------------------------
damaged:
	barrel = GetSenderRef();
	damage = GetParam(0);
	type = GetParam(1);
	barrelHealth = GetThingUserData(barrel);

	if(type == 0x1) Return;
	else if(barrelHealth <= damage) SetTimerEx(0.5, barrel, GetThingSignature(barrel), 0);
	else SetThingUserData(barrel, barrelHealth - damage);

Return;
#--------------------------------------------------------------------
timer:
	barrel = GetSenderID();
	if(GetThingSignature(barrel) != GetParam(0)) Return;
	CreateThing(barrel_exp, GetSenderID());
	DestroyThing(GetSenderID());

Return;
#--------------------------------------------------------------------
pulse:
	barrel = GetSenderRef();
	SyncThingPos(barrel);

Return;
#--------------------------------------------------------------------
end


OK, I fixed the errors I saw. Your SetThingPos() didn't work because there is no sender of a pulse message started by SetPulse(). You have to use SetThingPulse().

That should do it. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the Jedi Knight DataMaster.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-04-05, 8:28 AM #8
Thanks for checking that cog. My internet has been out for a week and Im just now reading this thread. JEdi Outcast has been a bit of distraction anyway. I'll try out the cog with those changes.

↑ Up to the top!