Re: Big ol' COG problem


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

Posted by Stealth on January 26, 1998 at 10:00:01:

In Reply to: Big ol' COG problem posted by Pax on January 25, 1998 at 16:25:31:

> I put together this cog from the COG made with the tutorial and elev_switch2. What it's suppose to be is a single 3do trapdoor with 4 switches. You hit one switch, it opens the trapdoor, waits a few seconds, then closes and resets the switches. Instead, it opens the trapdoor, closes it, doesn't reset the switches, and it keeps make open/close/moving sounds all at once.
> This is the final piece of a MP level I'm about to release, so if someone could give me some help, it'd be greatly appreciated.
> Here's the COG:

Try this..

note you should use activated: in place of activate.
Also you`ll have to use 4 switches with this code.

If this is a door mounted in a wall you really should remove the adjoins and reattach them too. Specialy for MP.It helps eliminate Hom and speeds up frame rates.


# Jedi Knight Cog Script
#
# 00_trapdoor.cog
#
# Works like a 2 stop elevator with up to 4 switches (only one trapdoor)
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================

symbols

message timer
message activated
message arrived

surface call0 linkid=1
surface call1 linkid=1
surface call2 linkid=1
surface call3 linkid=1

thing elevator desc=elevator_object

float sleeptime=2.0
float speed=4.0
sound wav0=lvrclik1.wav

end

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

code

activated:
if (GetCurFrame(elevator) !=0 )return; //ignore switch if elevator not at frame 0
if (GetSenderId() == 1) // if a switch is pressed
{
SetWallCel(call0,1);
SetWallCel(call1,1);
SetWallCel(call2,1);
SetWallCel(call3,1);
PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
MoveToFrame(elevator, 1, speed);
return;
}
# ........................................................................................

arrived:
If IsMoving(elevator)==1)return; //make sure elevator is stopped
if (GetCurFrame(elevator) == 1) // if elevator is at frame 1
{
SetTimer(sleeptime);
setwallcel(call0,0);
setwallcel(call1,0);
setwallcel(call2,0);
setwallcel(call3,0);
PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
return;
}
# ........................................................................................

timer:
MoveToFrame(elevator, 0, speed);
return;

end




Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


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