Cog help, CK...


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]

Posted by Osan`gar on March 15, 1998 at 20:45:31:

Ok, I've been about to scream for the past week over this cog that I am developing. When I began, I thought I could pop it out in no time. I knew that I would find a couple of bugs in the first version of it, and I did, but there is one bug that has been consistent throughout. Well, during development, I switched the cog around because I realized that it was doing the reverse of what I expected to happen. It has continued to work in this manner. The problem is, I don't understand why it is doing this! I have went over this cog along with Pele who I asked to look it over as well, and neither one of us has figured out why this cog is doing what it is doing. I am going to include it below for you to take a look at CK. I'll add comments to illustrate my point and tell you what I believe should be happening.

symbols

surface switch linkid=1
surface switch0
surface glassfloor1 nolink,desc=glassfloor1
surface glassfloor2 nolink,desc=glassfloor2
flex time_on=10.0 desc=time_on
flex delay=5.0 desc=delay

int trap_is_on=0 local
int gl_sound local

sound buttnsnd=Activate04.wav local

message startup
message activated

end

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

code

startup:
SetWallCel(switch0, 0);

Return;

# ........................................................................................

activated:
if (trap_is_on == 1) Return;

else if (GetWallCel(switch0) == 0)
{
trap_is_on = 1;
Print("Floor Dissolved");
PlaySoundPos(butnsound, SurfaceCenter(switch0), 1, -1, -1, 0);
SetWallCel(switch0, 1);
SetFaceGeoMode(glassfloor1, 0);
SetFaceGeoMode(glassfloor2, 0);
SetFaceLightMode(glassfloor1, 3);
SetFaceLightMode(glassfloor2, 3);

ClearAdjoinFlags(glassfloor1, 0x16); //take away passable flags and other flags that go along with it

ClearAdjoinFlags(glassfloor2, 0x16);
SetAdjoinFlags(glassfloor1, 0x402); //render past adjoin, non passable
SetAdjoinFlags(glassfloor2, 0x402);
SetSurfaceFlags(glassfloor1, 0x12); //floor and impassable

SectorLight(switch0, 1.0, 0.0);

Sleep(time_on); // Let the trap active

SectorLight(switch0, 0.0, 0.0);

SetFaceGeoMode(glassfloor1, 4);
SetFaceGeoMode(glassfloor2, 4);
SetFaceLightMode(glassfloor1, 0);
SetFaceLightMode(glassfloor2, 0);
ClearAdjoinFlags(glassfloor1, 402); //clear render past adjoin and nonpassable

ClearAdjoinFlags(glassfloor2, 402);
SetAdjoinFlags(glassfloor1, 0x16); //render past adjoin, does not block sound, passable

SetAdjoinFlags(glassfloor2, 0x16);
ClearSurfaceFlags(glassfloor1, 0x12); //clear floor
SetSurfaceFlags(glassfloor1, 0x1);

Sleep(delay);

trap_is_on = 0;
SetWallCel(switch0, 0);
}

Return;

end

Ok, what I am trying to do is have a glass floor. When the player activates the switch, the floor disappears. After a few moments, the floor reappears. When I activate the switch, the floor disappears, but when it reactivates, it remains passable and gives the skating effect when it is walked on. Why is this cog acting in this way? It seems as though the cog should be reversed, but the first part works for some reason! Help me CogKing, you're my only hope!



Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]