Help wanted! How easy would it be to add MP capability to the swingdoor cog (the cog in the tutorial)?
Here for convienience
# 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 or 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 activate
user0:
delayed:
if (Rotating) return; // Rotation already in progress
Rotating = 1;
// Display switches as activated:
if (Switch0 >= 0)
SetWallCel(Switch0, 1); // Display first switch as activated
if (Switch1 >= 0)
SetWallCel(Switch1, 0); // Display second switch as activated
if (Door >= 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
If this is too hard would it be easy to add a switch control to Jeff Waters Drazen swinging door cog? (currently you activate the door itself rather than a switch). Without it I'll have to decide whether to simply have sliding doors or doors that are permanently open.
------------------
La lova num botaffa
Here for convienience
# 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 or 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 activate
user0:
delayed:
if (Rotating) return; // Rotation already in progress
Rotating = 1;
// Display switches as activated:
if (Switch0 >= 0)
SetWallCel(Switch0, 1); // Display first switch as activated
if (Switch1 >= 0)
SetWallCel(Switch1, 0); // Display second switch as activated
if (Door >= 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
If this is too hard would it be easy to add a switch control to Jeff Waters Drazen swinging door cog? (currently you activate the door itself rather than a switch). Without it I'll have to decide whether to simply have sliding doors or doors that are permanently open.
------------------
La lova num botaffa