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 → New Multicelled Mat cog needed.
New Multicelled Mat cog needed.
2004-10-08, 11:55 PM #1
I know there is already a mat animation cog on the JK cd, but I was needing something a little different. From my LIGHT knowledge of cogging, I'm pretty sure this is possible but don't know how to do it myself. What I need is a cog that makes a 2 celled mat continually change cells at random intrivals, and for random lenghts of time, as if a switch was malfunctioning.
||||||||||||||||||||
2004-10-09, 5:30 AM #2
I was unshure weather you wanted all surfaces of that mat change or just one... so i made both cogs!


Code for surface changer:
Code:
#	JK cog script
#
#	PJ_surfchange.cog
#
#	randomly changes one surface to one of two cells
#
#	Note:	the time flex is the maximum delay before it switches.
#
#	[PJB]

symbols
message	startup
message	timer
flex	time=5
int	onoff=0	local
surface	flasher
end

code
startup:
settimer(rand()*time);
return;

timer:
if(onoff==0) 
{
	setSurfaceCel(flasher,1);
	onoff=1;
	settimer(rand()*time);
	return;
}
if(onoff==1) 
{
	onoff=0;
	setSurfaceCel(flasher,0);
	settimer(rand()*time);
	return;
}
return;
end


Code for mat changer:
Code:
#	JK cog script
#
#	PJ_matchange.cog
#
#	randomly changes all mats of one texture to one of two cells
#
#	Note:	the time flex is the maximum delay before it switches.
#
#	[PJB]

symbols
message	startup
message	timer
flex	time=5
int	onoff=0	local
material	flasher
end

code
startup:
settimer(rand()*time);
return;

timer:
if(onoff==0) 
{
	setmaterialCel(flasher,1);
	onoff=1;
	settimer(rand()*time);
	return;
}
if(onoff==1) 
{
	onoff=0;
	setmaterialCel(flasher,0);
	settimer(rand()*time);
	return;
}
return;
end
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-10-09, 11:08 AM #3
great.. thanks... I guess by decreasing the "time = 5" area.. it will make the max time stayed on 1 cell less, right?
||||||||||||||||||||
2004-10-09, 11:31 AM #4
well i dont quite understand what you said.

but lets say time was 1, then the maximum time on one frame would be 1, the minimum is allways 0
if the time = 10, then it will wait for a maximum of 10 seconds, and at the curuent it will only be a max of 5 seconds per frame.

but theres allways the possiblity it will change after 0000.1 seconds. thats why its random :P
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-10-09, 1:35 PM #5
yep.. that's what I was asking.. thanks
||||||||||||||||||||

↑ Up to the top!