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 → Swinging door not client friendly
Swinging door not client friendly
2001-07-26, 2:58 PM #1
The subject says it all. I got this cog from a tutorial here at massassi I think, long time ago though. For the first time I've put it in my levels, I've finally got an MP level, and when I made a beta release of it for testing, the doors didnt work. Well, they worked for the host, but for everyone else, the doors are stuck. Just so you know, I've only got one door hooked up to it, and I'm using the open when activated, not the switch. (So, anyone got a can of WD40?) I mean... can someone turn this very needed swinging door cog into client and server cogs for MP use? I suck at cogging, but I can do some things, but this is just out of my league. Please help...
Code:
#
# h0_swingdoors5.cog
#
# By Heinz Högel 6/98 for free use in add-on levels
#
# This script controls one or two winged rotating doors. To start open/close
# action, touch one of the doors, activate one out of two possibly linked
# switches or send a user0 message to this cog.
#
# Parameters:
#
# Door0
# Door1           -  IDs of door things (one is optional).
#
# Switch0
# Switch1         -  Surfaces with switches on. These switches can activate opening
#                    and closing of the door wings. They are both displayed as activated
#                    as long as the doors are moving and then return to deactivated state.
#                    Both are optional.
#
# Time            -  How long a complete door swing should last (in seconds). Should be positive
#                    on startup.
#
# AutoCloseDelay  -  If greater than 0.0, delay in seconds for automatic re-closing of doors.
#
# TouchOpening    -  If set to 0 (off) the doors won't open simply by "touching" them (hitting
#                    the spacebar) (default: 1 (on)).
#
#
# This script is designed for JK Basic levels, for MotS levels please use
# h0_swingdoors4.cog or similar scripts!
#
# This file is was not made is not supported by LucasArts Entertainment Co.
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols
   message     startup
   message     activated
   message     arrived
   message     user0
   message     timer

   thing       Door0=-1          linkid=0
   thing       Door1=-1          linkid=1

   surface     Switch0=-1        linkid=2
   surface     Switch1=-1        linkid=3

   flex        Time=4.0
   flex        AutoCloseDelay=0.0

   int         TouchOpening=1

   int         Rotating=0        local
   int         NoOfDoors=0       local
   int         SenderID          local
   int         ArrivedCount=0    local
end


## Code Section
code

startup:
   if (Door0 >= 0)
      NoOfDoors = NoOfDoors + 1;
   if (Door1 >= 0)
      NoOfDoors = NoOfDoors + 1;
   return;

activated:
   SenderID = GetSenderID();
   if (TouchOpening == 0)
      {
      // Allow only switches to activate
      if (SenderID < 2 || SenderID > 3)
         return;
      }
   else
      {
      // Allow only switches and doors to activate
      if (SenderID < 0 || SenderID > 3)
         return;
      }
user0:
   KillTimerEx(1);                        // Avoid additional autoclose
delayed:
   if (Rotating) return;                  // Rotation already in progress
   Rotating = 1;
   if (Switch0 >= 0)
      SetWallCel(Switch0, 1);             // Display first switch as activated
   if (Switch1 >= 0)
      SetWallCel(Switch1, 0);             // Display second switch as activated
   if (Door0 >= 0)
      RotatePivot(Door0, 1, Time);        // Swing (rotate) first door
   if (Door1 >= 0)
      RotatePivot(Door1, 1, Time);        // Swing (rotate) second door
   return;

arrived:
   if (!Rotating) return;                 // Rotation already finished
   ArrivedCount = ArrivedCount + 1;       // Count arrived messages
   if (ArrivedCount < NoOfDoors) return;  // All doors have to be arrived!
   Time = -Time;                          // Negate time for invers rotation
   if (Switch0 >= 0)
      SetWallCel(Switch0, 0);             // Display first switch as deactivated
   if (Switch1 >= 0)
      SetWallCel(Switch1, 0);             // Display first switch as deactivated
   ArrivedCount = 0;
   Rotating = 0;
   if (AutoCloseDelay > 0.0  &&  Time < 0)
      SetTimerEx(AutoCloseDelay, 1, 0, 0);   // Prepare delayed automatic closing
   return;

timer:
   call delayed;                          // Delayed closing
   return;

end


------------------
"I hear You speak and I obey
I walked away from the grave
I will never be the same
I gave my life away"

The Bible is the only religious book to actually state that it is the truth and the only way. Thats why I'm a Christian.

_-=MaTRiX=-_
In my mind I can see your face, as Your love pours down in a shower of grace. Some people tell me that Your just a dream, but my faith is the evidence of things unseen.

Once upon a time God spoke to me, and then I was never the same again.

_-=MaTRiX=-_
2001-07-27, 9:59 AM #2
try this cog:

# Jedi Knight Cog Script
#
# h0_swingdoors2.cog
#
# By Heinz Högel 5/98 for free use in add-on levels
#
# This script controls one or two winged rotating doors. To start open/close
# action, activate one out of two possibly linked switches or send a user0
# message to this cog.
#
# Parameters:
#
# Door0
# Door1 - IDs of door things (one is optional).
#
# Switch0
# Switch1 - Surfaces with switches on. These switches can activate opening
# and closing of the door wings. They are both displayed as activated
# as long as the doors are moving and then return to deactivated state.
# Both are optional (without them you have to send a user0 message to this
# cog to open/close the doors).
#
# Time - How long a complete door swing should last (in seconds). Should be positive
# on startup.
#
# AutoCloseDelay - If greater than 0.0, delay in seconds for automatic re-closing of doors.
#
#
# This file is was not made and is not supported by LucasArts Entertainment Co.
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols
message activated
message arrived
message user0
message timer

thing Door0=-1 linkid=1
thing Door1=-1 nolink // nolink necessary to avoid double arrived messages!!!

surface Switch0=-1 linkid=0
surface Switch1=-1 linkid=0

flex Time=4.0
flex AutoCloseDelay=0.0

int Rotating=0 local
end


## Code Section
code

activated:
if (GetSenderID() != 0) return; // Allow only switches to send activated message
user0:
delayed:
if (Rotating) return; // Rotation already in progress
Rotating = 1;
if (Switch0 >= 0)
SetWallCel(Switch0, 1); // Display first switch as activated
if (Switch1 >= 0)
SetWallCel(Switch1, 0); // Display second switch as activated
if (Door0 >= 0)
RotatePivot(Door0, 1, Time); // Swing (rotate) first door
if (Door1 >= 0)
RotatePivot(Door1, 1, Time); // Swing (rotate) second door
return;

arrived:
if (!Rotating) return; // Rotation already finished
Time = -Time; // Negate time for invers rotation
if (Switch0 >= 0)
SetWallCel(Switch0, 0); // Display first switch as deactivated
if (Switch1 >= 0)
SetWallCel(Switch1, 0); // Display first switch as deactivated
Rotating = 0;
if (AutoCloseDelay > 0.0 && Time < 0)
SetTimer(AutoCloseDelay); // Prepare delayed automatic closing
return;

timer:
call delayed; // Delayed closing
return;

end
2001-07-27, 10:00 AM #3
LOL! my b sry didn't look over the cog that well sry
2001-07-27, 10:56 AM #4
Um... lol, yeh, thats the same one. wierd how it has a different name tho. Oh well, um, anyone that can help out there?

------------------
"I hear You speak and I obey
I walked away from the grave
I will never be the same
I gave my life away"

The Bible is the only religious book to actually state that it is the truth and the only way. Thats why I'm a Christian.

_-=MaTRiX=-_
In my mind I can see your face, as Your love pours down in a shower of grace. Some people tell me that Your just a dream, but my faith is the evidence of things unseen.

Once upon a time God spoke to me, and then I was never the same again.

_-=MaTRiX=-_
2001-07-29, 1:14 PM #5
hey hey. After looking long and hard, I finally discovered client and server swining door cogs in Drazen Isle. So, problem solved. (Thanks Jeff Walters! [http://forums.massassi.net/html/smile.gif])

------------------
"I hear You speak and I obey
I walked away from the grave
I will never be the same
I gave my life away"

The Bible is the only religious book to actually state that it is the truth and the only way. Thats why I'm a Christian.

_-=MaTRiX=-_
In my mind I can see your face, as Your love pours down in a shower of grace. Some people tell me that Your just a dream, but my faith is the evidence of things unseen.

Once upon a time God spoke to me, and then I was never the same again.

_-=MaTRiX=-_

↑ Up to the top!