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 kind of door
New kind of door
2003-02-18, 9:58 AM #1
I'm making this door that dissapears when you click on it. The dissapering part works and the reapering part too but when it reaperes, it is not solid like before. You can walk through it. Could someone help me with this cog.

Code:
#A dissapering door cog

symbols

surface		side1
surface		side2

int		act=0			local
int		delay=3

int		geo			local
int		adjoin			local
int		surface			local
int		face			local

message		activated
message		timer


end
##########################################################################
code

activated:

	if (act == 0)
	 {
	 	act = 1;
	 }
	else
	 {
	 	return;
	 }

	geo=GetFaceGeoMode(side1);
	adjoin=GetAdjoinFlags(side1);
	surface=GetSurfaceFlags(side1);
	face=GetFaceType(side1);

	SetFaceGeoMode(side1, 0x0);
	SetFaceGeoMode(side2, 0x0);

	SetAdjoinFlags(side1, 0x7);
	SetAdjoinFlags(side2, 0x7);

	SetSurfaceFlags(side1, 0x0);
	SetSurfaceFlags(side2, 0x0);

	SetFaceType(side1, 0x0);
	SetFaceType(side2, 0x0);

	SetTimer(delay);

return;

timer:

	SetFaceGeoMode(side1, geo);
	SetFaceGeoMode(side2, geo);

	SetAdjoinFlags(side1, adjoin);
	SetAdjoinFlags(side2, adjoin);

	SetSurfaceFlags(side1, surface);
	SetSurfaceFlags(side2, surface);

	SetFaceType(side1, face);
	SetFaceType(side2, face);

return;
end


------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-18, 10:11 AM #2
Ok ok i dont want to sound like i know everything, cause i admit i know very little about cog But could it have something to do with SetThingFlags?i noticed that line is not in there but maybe it is not needed. it would also help to give contructive criticism about my comment if i am wrong instead of "wtf are you talking about and saying how stupid i am" I AM after all LEARNING .

------------------
2003-02-18, 10:12 AM #3
if i may ask what is the door for ? If it is for what i think it is i might have some actually USEfull advice

------------------
2003-02-18, 10:44 AM #4
Code:
#A dissapering door cog

symbols

surface side1
surface side2

int act=0 local
int delay=3

int geo local
int adjoin local
int surfaceFlags local
int face local

message activated
message timer


end
##########################################################################
code

activated:

if (act != 0) Stop;
act = 1;

geo = GetFaceGeoMode(side1);
adjoin = GetAdjoinFlags(side1);
surfaceFlags = GetSurfaceFlags(side1);
face = GetFaceType(side1);

SetFaceGeoMode(side1, 0x0);
SetFaceGeoMode(side2, 0x0);

Clearadjoinflags(Side1, adjoin);
Clearadjoinflags(Side2, adjoin);

SetAdjoinFlags(side1, 0x7);
SetAdjoinFlags(side2, 0x7);

ClearSurfaceFlags(side1, surfaceFlags);
ClearSurfaceFlags(side2, surfaceFlags);

ClearFaceType(side1, Face);
ClearFaceType(side2, Face);

SetTimer(delay);

return;

timer:

SetFaceGeoMode(side1, geo);
SetFaceGeoMode(side2, geo);

Clearadjoinflags(Side1, 0x7);
Clearadjoinflags(Side2, 0x7);

SetAdjoinFlags(side1, adjoin);
SetAdjoinFlags(side2, adjoin);

SetSurfaceFlags(side1, surfaceFlags);
SetSurfaceFlags(side2, surfaceFlags);

SetFaceType(side1, face);
SetFaceType(side2, face);

act = 0;
return;
end


------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-18, 2:36 PM #5
That cog helped me. I didn't know you had to clear the flags for the adjoins. sskakarot51, the SetThingFlag wouldn't work because I'm using a wall, not a 3do thing. I'm just using this as an easer and neater alternitive to the everyday 3do door. I'm still not the best at this cog thing eather but I think it's fun. have fun with your cogging and leveling.

------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-18, 4:10 PM #6
Meh, cogging isnt learned overnight. It takes time, but its worth it. After learning cog, youll find it easier to move on to other, more powerful programming languages.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-02-18, 4:13 PM #7
If you plan on working in the computer science field, you should learn to make your code readable and use comments... do it early while you can...

*Glares at a certain person*

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-02-18, 5:16 PM #8
I got that cog to work, for awhile. I tried to put some other effects in it and now it doesn't work again. It won't even do anything. I was trying to get it to flash quickly. I'm not sure I used the right way to do this but I could use some help.

Code:
#A dissapering door cog

symbols

surface		side1
surface		side2

int		act=0			local
int		delay=3

int		geo			local
int		adjoin			local
int		surface			local
int		face			local
flex		light			local

message		activated
message		timer

end
##########################################################################
code

activated:

	if (act == 0)
	 {
	 	act = 1;
	 }
	else
	 {
	 	return;
	 }

	light=GetSurfaceLight(side1);
	light=GetSurfaceLight(side2);

	SetSurfaceLight(side1, 1, .001);
	SetSurfaceLight(side2, 1, .001);

	geo=GetFaceGeoMode(side1);
	adjoin=GetAdjoinFlags(side1);
	surface=GetSurfaceFlags(side1);
	face=GetFaceType(side1);


	SetFaceGeoMode(side1, 0x0);
	SetFaceGeoMode(side2, 0x0);

	SetAdjoinFlags(side1, 0x7);
	SetAdjoinFlags(side2, 0x7);

	SetSurfaceFlags(side1, 0x0);
	SetSurfaceFlags(side2, 0x0);

	SetFaceType(side1, 0x0);
	SetFaceType(side2, 0x0);

	SetTimer(delay);

return;

timer:

	SetFaceGeoMode(side1, geo);
	SetFaceGeoMode(side2, geo);

	Clearadjoinflags(side1, 0x7);
	Clearadjoinflags(side2, 0x7);

	SetAdjoinFlags(side1, adjoin);
	SetAdjoinFlags(side2, adjoin);

	SetSurfaceFlags(side1, surface);
	SetSurfaceFlags(side2, surface);

	SetFaceType(side1, face);
	SetFaceType(side2, face);

	SetSurfaceLight(side1, light, .001);
	SetSurfaceLight(side2, light, .001);

	act = 0

return;
end


you can see that I used the clear flag idea. That worked fine untill I put the surface light stuff in.

------------------
see me at: http://www.geocities.com/star_trekguy/
2003-02-18, 10:58 PM #9
Your problem is the "act = 0" bit at the end, it needs a semicolon ( ;). Add one, and it should solve the problem.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');

[This message has been edited by GBK (edited February 19, 2003).]
And when the moment is right, I'm gonna fly a kite.
2003-02-19, 6:04 AM #10
And thus,

Code:
#A disappearing door cog

symbols

surface		side1
surface		side2

int		act=0			local
int		delay=3

int		geo			local
int		adjoin			local
int		surface			local
int		face			local
flex		light			local

message		activated
message		timer

end
##########################################################################
code

activated:

	if (act == 0)
	 {
	 	act = 1;
	 }
	else
	 {
	 	return;
	 }

	light=GetSurfaceLight(side1);
	light=GetSurfaceLight(side2);

	SetSurfaceLight(side1, 1, .001);
	SetSurfaceLight(side2, 1, .001);

	geo=GetFaceGeoMode(side1);
	adjoin=GetAdjoinFlags(side1);
	surface=GetSurfaceFlags(side1);
	face=GetFaceType(side1);


	SetFaceGeoMode(side1, 0x0);
	SetFaceGeoMode(side2, 0x0);

	SetAdjoinFlags(side1, 0x7);
	SetAdjoinFlags(side2, 0x7);

	SetSurfaceFlags(side1, 0x0);
	SetSurfaceFlags(side2, 0x0);

	SetFaceType(side1, 0x0);
	SetFaceType(side2, 0x0);

	SetTimer(delay);

return;

timer:

	SetFaceGeoMode(side1, geo);
	SetFaceGeoMode(side2, geo);

	Clearadjoinflags(side1, 0x7);
	Clearadjoinflags(side2, 0x7);

	SetAdjoinFlags(side1, adjoin);
	SetAdjoinFlags(side2, adjoin);

	SetSurfaceFlags(side1, surface);
	SetSurfaceFlags(side2, surface);

	SetFaceType(side1, face);
	SetFaceType(side2, face);

	SetSurfaceLight(side1, light, .001);
	SetSurfaceLight(side2, light, .001);

	act = 0;

return;
end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!