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 → cel changing
cel changing
2003-01-24, 4:31 PM #1
Greetings.
Below is a cog Saber Master helped write. I added a line where it changes the Material cell for a console 3do. Well, the problem is that it only changes the material cel on the server. Any ideas would be appreciated. Thanks.

Code:
# serverclient.cog
#
# Server side cog that affects all clients. When the switch or console is activated,
# the server will create things that appear on all client computers. These things
# will then by kept in sync by their class cogs.
#
# [SM + GD]
#==============================================================#
symbols

surface   switch

thing     console		mask=0xfff
thing     pos0                nolink
thing     pos1                nolink
thing     pos2                nolink
thing     pos3                nolink
thing     pos4                nolink
thing     pos5                nolink

int       i			local
int      x			local
int       locked=0	local
material  mat

flex      rate=0.01
flex      delay=61

template  thingTpl

sound     on_snd=set_hi2.wav
sound     off_snd=lgclick1.wav

message   activated
message   damaged

end
#==============================================================#
code
#------------------------------------------------------
damaged:

activated:
	if(locked == 1) Return;
	locked = 1;
	SetWallCel(switch, 1);
	SetMaterialCel(mat, 1);
	PlaySoundPos(on_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
		for(i = 0; i <= 5; i = i + 1)
		{
			SetThingParent(CreateThing(thingTpl, pos0), GetSourceRef());
			Sleep(rate);
		}
	Sleep(delay);
	SetWallCel(switch, 0);
	SetMaterialCel(mat, 0);
	PlaySoundPos(off_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
	locked = 0;

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



[This message has been edited by GBK (edited January 25, 2003).]
2003-01-24, 6:00 PM #2
Must be a new fab. This is the second cog that I've seen that was helped with by SM. I really miss him. [http://forums.massassi.net/html/frown.gif] I really don't know why that doesn't work. I'm not really keen on MP and syncing, but from what I remember that should do it.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-01-24, 6:38 PM #3
I don't see why SetMaterialCel() wouldn't sync over MP, I use it a couple times myself and it works. (to my knowledge) Then again it looks like you're using MotS with that SetThingParent() you've got in there.

At any rate, the only logical solution is to switch it over to use triggers, like this:

Code:
# serverclient.cog
#
# Server side cog that affects all clients. When the switch or console is activated,
# the server will create things that appear on all client computers. These things
# will then by kept in sync by their class cogs.
#
# [SM + GD] [Triggered - HR]
#
#==============================================================#
symbols

surface   switch

thing     console		mask=0xfff
thing     pos0                nolink
thing     pos1                nolink
thing     pos2                nolink
thing     pos3                nolink
thing     pos4                nolink
thing     pos5                nolink

int       i			local
int      x			local
int       locked=0	local
material  mat

flex      rate=0.01
flex      delay=61

template  thingTpl

sound     on_snd=set_hi2.wav
sound     off_snd=lgclick1.wav

message   activated
message   damaged
message   trigger

end
#==============================================================#
code
#------------------------------------------------------
damaged:

activated:
	if(locked == 1) Return;
	locked = 1;
	SetWallCel(switch, 1);
	SendTrigger(-1, 40000, 1, -1, -1, -1);
	PlaySoundPos(on_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
		for(i = 0; i <= 5; i = i + 1)
		{
			SetThingParent(CreateThing(thingTpl, pos0), GetSourceRef());
			Sleep(rate);
		}
	Sleep(delay);
	SetWallCel(switch, 0);
	SendTrigger(-1, 40000, 0, -1, -1, -1);
	PlaySoundPos(off_snd, GetSurfaceCenter(switch), 1, 5, 10, 0);
	locked = 0;

Return;

#------------------------------------------------------

trigger:

	if(GetSourceRef()==40000) SetMaterialCel(mat, GetParam(0));

return;

#------------------------------------------------------

end
-Hell Raiser
2003-01-24, 7:14 PM #4
Thanks. I'll give that a try. This is JK, by the way. And the cog does seem to work with that verb. I didnt know that it was for MotS only? Though, I've been wonering why parsec doesnt recognize the SetThingParent verb.
2003-01-24, 8:04 PM #5
SetThingParent() isn't a cog verb at all in JK.exe (god I wish it was tho) so it kinda ignores it.
-Hell Raiser
2003-01-25, 7:59 AM #6
Ok Mr. Smarty-Pants. Then tell me why it works on my copy of Jedi Knight?
2003-01-25, 8:32 AM #7
WTF? Only Mots has a "Setthingparent". JK has no such verb. [http://forums.massassi.net/html/confused.gif]
And when the moment is right, I'm gonna fly a kite.
2003-01-25, 9:19 AM #8
Well why doesnt the cog crash then? I dont know who here is being honest with me, but for what its worth I do appreciate the advice. Although the advice HellRaiser gives me, and has given before, is always slightly wrong...just slight enough to give someone who didnt know better a massive head-ache. (on purpose or not I do not know)
2003-01-25, 9:21 AM #9
The Cog doesn't crash because you're using correct syntax. Go ahead and use SetThingParent, and then use GetThingParent to see if it works. [http://forums.massassi.net/html/tongue.gif]
-Hell Raiser
2003-01-25, 3:50 PM #10
Well maybe you can bicker with Saber Master about this,... my question was unrelated to that aspect of the cog. It syncs the things that are created just fine.

Putting the trigger in the same cog as the SendTrigger is an EXCELLENT idea, by the way.

↑ Up to the top!