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 → Lockable Doors
Lockable Doors
2002-12-24, 8:47 AM #1
OK, I know there are dozens, but I need a cog which will prevent a normal door (openable by the spacebar) to be opened (by flicking a switch). I also need a cog which controls a thing between positions by a switch (when it is pressed, moves to the next frame, and when at the last frame, moves back to the first.)

Thanks. Full credit too!

[This message has been edited by TK v3 (edited December 24, 2002).]
We're three million years into deep space. Where the smeg did I get a traffic cone?

<font face="Verdana, Arial" size="2">Originally posted by Avenger:
I'm more worried about the waffle intake. That's a lot of waffles.</font>
2002-12-24, 9:46 AM #2
I'll do it backwards. *turns around*
Code:
# Jedi Knight Cog Script
#
# Lockable door that moves the "dead bolt"
#
# [DP]
#

symbols

thing         door
thing         deadbolt
surface       switch
sound         soundon
sound         soundoff
sound         locksound
flex          movespeed
flex          sleeptime

message       startup
message       activated
message       arrived

end

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

code

Startup:
   SectorAdjoins(GetThingSector(door), 0);
   Return;

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

Activated:
   If(GetSenderRef() == door) call open_door;
   If(GetSenderRef() == switch)
   {
      curCell = 1 - GetWallCel(switch);
      SetWallCel(switch, curCell);
      PlaySoundPos(soundon[curCell], GetSurfaceCenter(switch), .6, -1, -1, 0);
      MoveToFrame(deadbolt, curCell);
   }
   Return;

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

Open_door:
   If(GetWallCel(switch))
   {
      PlaySoundThing(locksound, door, .6, -1, -1, 0);
      Return;
   }
   If(IsThingMoving(door)||GetCurFrame(door) Return;

   SectorAdjoins(GetThingSector(door), 1);
   MoveToFrame(door, 1, movespeed);

   Return;

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

Arrived:
   If(GetSenderRef() != door) Return;
   If(GetCurFrame(door))
   {
      Sleep(sleeptime);
      MoveToFrame(door, 0, movespeed);
   }
   Else SectorAdjoins(GetThingSector(door), 0);
   Return;

end
That should work, but its untested. IF this doesn't work, just say so, and I'll fix it up for ya.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-12-26, 6:05 AM #3
1) It's dead. Nothing! Can yer fix it, please? And test it?
2) What the hell is the 'dead bolt'?

------------------
"All Your Base Are Belong To Us" - Some Bad Translation
We're three million years into deep space. Where the smeg did I get a traffic cone?

<font face="Verdana, Arial" size="2">Originally posted by Avenger:
I'm more worried about the waffle intake. That's a lot of waffles.</font>

↑ Up to the top!