| Author |
Topic: elevator timing? |
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Thursday, Feb. 16, 2006 12:35 am |
 |
hey all.
ive been building my map for some months now and have finally got two working elevators. There are also a pair of doors for each lift at the top of the elevator shaft, that are in a fixed position, dont move with the elevator.
Now at the moment you open the doors seperate from the control of the lift which i dont like.
Can anyone tell me how i could sync the lift doors with the control switch for the lift, so when you press the button to call the lift the doors open as the lift arrives?
thanks
![[wave]](images/BBCode/smilies/wave.gif) |
 |
|
|
| ={W}=DEVIL |
 |
General Member Since: Aug 23, 2004 Posts: 1670 Last: Dec 14, 2007 [view latest posts] |
|
|
|
|
| DadofAzz |
General Member Since: May 24, 2005 Posts: 1233 Last: Oct 17, 2009 [view latest posts] |
|
|
|
|
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
|
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Friday, Feb. 17, 2006 08:10 pm |
 |
ok im not sure how to do this but this is the script as ive edited so far. As each of my lifts has two doors top and two at the bottom. Is there a way i can use my existing lift gsc file somewhere in this script?
main()
{
thread gate_init();
}
gate_init(){
level.gatemoving=false;
level.gate1 = getent("lift1top","targetname");
level.gate2 = getent("lift1bottom","targetname");
level.gate3 = getent("lift2DL","targetname");
level.gate4 = getent("lift2DR","targetname");
level.trig = getentarray ("lift1doors","targetname");
if (isdefined(level.trig))
for (i=0;i
level.trigthread gate_handler();
}
gate_handler() {
while (1) {
self waittill ("trigger");
if (!level.gatemoving)
thread move_gate();
wait(1);
}
}
move_gate() {
level.gatemoving = true;
level.gate1 movez (83,2,0.5,0.5); //the top doors open
level.gate2 movez (-59,2,0.5,0.5);
wait (10); //this is the time to get in lift at top
level.gate1 movez (-83,2,0.5,0.5); //the top doors close
level.gate2 movez (59,2,0.5,0.5);
wait (14);
level.gate3 rotateto ((0,-90,0),2); //the lower doors open
level.gate4 rotateto ((0,90,0),2); //the lower doors open
wait (10);
level.gate3 rotateto ((0,90,0),2); //the lower doors close
level.gate4 rotateto ((0,-90,0),2); //the lower doors close
wait (3);
level.gatemoving=false;
} |
 |
|
|
| Mystic |
 |
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
 |
 |
|
Category: CoDUO Mapping Posted: Friday, Feb. 17, 2006 08:58 pm |
 |
You can add more to a script by calling a new thread. The thread your calling in this script is 'thread gate_init();'
You can add a line such as thread elevator(); then add the new script at the bottom of the existing script, so:
Code: main()
{
thread gate_init();
thread elevator();
}
gate_init(){
level.gatemoving=false;
level.gate1 = getent("lift1top","targetname");
level.gate2 = getent("lift1bottom","targetname");
level.gate3 = getent("lift2DL","targetname");
level.gate4 = getent("lift2DR","targetname");
level.trig = getentarray ("lift1doors","targetname");
if (isdefined(level.trig))
for (i=0;i
level.trigthread gate_handler();
}
gate_handler() {
while (1) {
self waittill ("trigger");
if (!level.gatemoving)
thread move_gate();
wait(1);
}
}
move_gate() {
level.gatemoving = true;
level.gate1 movez (83,2,0.5,0.5); //the top doors open
level.gate2 movez (-59,2,0.5,0.5);
wait (10); //this is the time to get in lift at top
level.gate1 movez (-83,2,0.5,0.5); //the top doors close
level.gate2 movez (59,2,0.5,0.5);
wait (14);
level.gate3 rotateto ((0,-90,0),2); //the lower doors open
level.gate4 rotateto ((0,90,0),2); //the lower doors open
wait (10);
level.gate3 rotateto ((0,90,0),2); //the lower doors close
level.gate4 rotateto ((0,-90,0),2); //the lower doors close
wait (3);
level.gatemoving=false;
}
elevator() {
ELEVATOR SCRIPT GOES HERE!
}
|
 |
|
|
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
|
| Mystic |
 |
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
 |
 |
|
|
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
|
| Maddogg8472 |
General Member Since: Jun 18, 2004 Posts: 55 Last: Aug 22, 2008 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Saturday, Feb. 18, 2006 11:57 pm |
 |
ok im still stuck on the lift doors, but heres my latest attempt which doesnt work.
But the lower lift doors open but only the left one of these doors close. lift goes up but then it just sits at the top and nothing else happens. Eventually the lift goes back down again.....
can anyone help here please
main()
{
thread gate_init();
}
gate_init(){
level.gatemoving=false;
level.gate1 = getent("lift2DL","targetname");
level.gate2 = getent("lift2DR","targetname");
level.gate3 = getent("lift1bottom","targetname");
level.gate4 = getent("lift1top","targetname");
level.gate5 = getent("elevatormodel_2","targetname");
level.trig = getentarray ("elevatorswitch_2","targetname");
if (isdefined(level.trig))
for (i=0;i
level.trig thread gate_handler();
}
gate_handler() {
while (1) {
self waittill ("trigger");
if (!level.gatemoving)
thread move_gate();
wait(1);
}
}
move_gate() {
level.gatemoving = true;
level.gate1 rotateto ((0,-90,0),2); //the bottom left door opens
level.gate2 rotateto ((0,90,0),2); //the bottom right door opens
wait (10); //this is the time to get in lift at top
level.gate1 rotateto ((0,0,0),2); //the bottom left door closes
level.gate1 rotateto ((0,0,0),2); //the bottom right door closes
wait (4);
level.gate5 movez (608,8,0,0,6); //the lift moves up
level.gate1 waittill ("movedone");
level.gate2 waittill ("movedone");
level.gate3 movez (-59,2,0.5,0.5); //top door lower opens
level.gate4 movez (83,2,0.5,0.5); //top door upper opens
wait (10);
level.gate3 movez (59,2,0.5,0.5); //top door lower closes
level.gate3 movez (-83,2,0.5,0.5); //top door upper closes
wait (4);
level.gate5 movez (-608,8,0,0,6); //the lift goes back down
level.gate1 waittill ("movedone");
level.gate2 waittill ("movedone");
level.gate1 rotateto ((0,-90,0),2); //the bottom left door opens
level.gate2 rotateto ((0,90,0),2); //the bottom right door opens
wait (10);
level.gate1 rotateto ((0,0,0),2); //the bottom left door closes
level.gate1 rotateto ((0,0,0),2); //the bottom right door closes
//wait (3);
level.gatemoving=false;
}
|
 |
|
|