Ohh...my god... I'm stupid.. that's probably it...
# Jedi Knight Cog Script
#
# Doorswitch2.COG
#
# Doors handled by switch with floor changes.
#
# [CYW & YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing door0 linkid=1
thing door1 linkid=1
thing door2 linkid=1
thing door3 linkid=1
surface switch0 linkid=2
surface switch1 linkid=2
surface floor linkid=2
flex movespeed=8.0
flex sleeptime=2.0
flex lightvalue=0.5
sound onSound=set_hi2.wav local
sound offSound=lgclick1.wav local
sound locksound=df_door2-3.wav local
int doorsector local
int numdoors=0 local
int doorstatus=0 local
int movestatus=0 local
int garbage=-1 local
int dummy=0 local
message startup
message activated
message arrived
message blocked
end
# ========================================================================================
code
startup:
if(door0 >= 0) numdoors = numdoors + 1;
if(door1 >= 0) numdoors = numdoors + 1;
if(door2 >= 0) numdoors = numdoors + 1;
if(door3 >= 0) numdoors = numdoors + 1;
doorsector = GetThingSector(door0);
SectorAdjoins(doorsector, 0);
SectorLight(doorsector, lightvalue, 0.0); // add some light to door sector
return;
# ........................................................................................
activated:
if (GetSenderId() == 1)
{
dummy=PlaySoundLocal(locksound, 1, 0, 0);
}
else if (GetSenderId() == 2)
{
call checkstatus;
if (movestatus) return;
if (doorstatus == 0) // all pieces are at frame 0
{
garbage = PlaySoundThing(onSound, door0, 0.6, -1, -1, 0); // play activate sound
garbage = setwallcel(switch0, 1);
if (switch1 >= 0) garbage = setwallcel(switch1, 1);
sectoradjoins(doorsector, 1);
call open_doors;
}
}
return;
# ........................................................................................
arrived:
call checkstatus;
if(movestatus) return;
if(doorstatus == numdoors)
{ // all pieces are at frame 1
sleep(sleeptime);
call close_doors;
}
else if(doorstatus == 0)
{ // all pieces are at frame 0
garbage = PlaySoundThing(offSound, door0, 0.6, -1, -1, 0); // play deactivate sound
garbage = setwallcel(switch0, 0);
if(switch1 >= 0) garbage = setwallcel(switch1, 0);
sectoradjoins(doorsector, 0);
}
return;
# ........................................................................................
blocked:
call open_doors;
return;
# ........................................................................................
open_doors:
movetoframe(door0, 1, movespeed);
SetAdjoinFlags(floor, 0x7);
SetSurfaceFlags(floor,0x1001);
if (door1 >= 0) movetoframe(door1, 1, movespeed);
if (door2 >= 0) movetoframe(door2, 1, movespeed);
if (door3 >= 0) movetoframe(door3, 1, movespeed);
return;
close_doors:
movetoframe(door0, 0, movespeed);
SetAdjoinFlags(floor, 0x5);
SetSurfaceFlags(floor,0x1005);
if (door1 >= 0) movetoframe(door1, 0, movespeed);
if (door2 >= 0) movetoframe(door2, 0, movespeed);
if (door3 >= 0) movetoframe(door3, 0, movespeed);
return;
checkstatus:
movestatus = ismoving(door0);
if (door1 >= 0) movestatus = movestatus + ismoving(door1);
if (door2 >= 0) movestatus = movestatus + ismoving(door2);
if (door3 >= 0) movestatus = movestatus + ismoving(door3);
doorstatus = getcurframe(door0);
if (door1 >= 0) doorstatus = doorstatus + getcurframe(door1);
if (door2 >= 0) doorstatus = doorstatus + getcurframe(door2);
if (door3 >= 0) doorstatus = doorstatus + getcurframe(door3);
return;
end
this is the code without the getthingframe or whatever, but i'm late for school right now, so I can't add that in. I'll do it when I get back.
------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....