I know how to open doors using a switch, and all that works fine. But I want to know how to make the door continually move the direction i say until i tell it to stop by using another switch. like what would i put in the script? i know the stuff like
movenorth 60
and so on. but what do i put instead of 60 to make the door never stop going north?
Switch Operated Door
Moderator: Moderators
-
CommandoKiller
- Lance Corporal
- Posts: 19
- Joined: Sat Jul 26, 2003 2:06 am
- Contact:
well I can't think why you want to do that but you can do this .
I assume your switch is a trigger_use and sets say it has the key: setthread and value: door_move
level.doormover=0
door_move:
if(level.doormover==0)
{
level.doormover=1
thread do_doormove
}
else
level.doormover=0
end
do_doormove:
while(level.doormover==1)
{
$door movenorth 10 // 10 units per second
$door move
wait 1
}
end
now if you want to rotate it that is different . If you do this what do you think is going to happen if you don't stop it I guess it will stop when it hits a solid object .
I assume your switch is a trigger_use and sets say it has the key: setthread and value: door_move
level.doormover=0
door_move:
if(level.doormover==0)
{
level.doormover=1
thread do_doormove
}
else
level.doormover=0
end
do_doormove:
while(level.doormover==1)
{
$door movenorth 10 // 10 units per second
$door move
wait 1
}
end
now if you want to rotate it that is different . If you do this what do you think is going to happen if you don't stop it I guess it will stop when it hits a solid object .
-
CommandoKiller
- Lance Corporal
- Posts: 19
- Joined: Sat Jul 26, 2003 2:06 am
- Contact:
Well in the above post if you use the same switch again it stops the door
you could do the same for all the directions or if a change in direction stops the previous direction move you can do that too . There is lots of ways to do it one way might be this .
Trigger use // north switch
key: setthread value: door_move
key: #set value: 1
Trigger use // south switch
key: setthread value:door_move
key: #set value: 2
Trigger use // east switch
key: setthread value:door_move
key: #set value: 3
Trigger use // west switch
key: setthread value:door_move
key: #set value: 4
for(local.i=1;local.i<=4;local.i++)
{
level.doormover[local.i] = 0
}
end
door_move:
if(level.doormover[self.set]==0)
{
level.doormover[self.set]=1
self thread do_doormove
}
else
level.doormover[self.set]=0
end
do_doormove:
while(level.doormover[self.set]==1)
{
switch (self.set)
{
case 1:
$door movenorth 10 // 10 units per second
$door move
wait 1
break
case 2:
$door movesouth 10 // 10 units per second
$door move
wait 1
break
case 3:
$door moveeast 10 // 10 units per second
$door move
wait 1
break
case 4:
$door movewest 10 // 10 units per second
$door move
wait 1
break
}
}
end
if you want the door to stop when you change directions make the case statements like this
case 1:
level.doormover[2] = 0
level.doormover[3] = 0
level.doormover[4] = 0
$door movenorth 10 // 10 units per second
$door move
wait 1
break
you could do the same for all the directions or if a change in direction stops the previous direction move you can do that too . There is lots of ways to do it one way might be this .
Trigger use // north switch
key: setthread value: door_move
key: #set value: 1
Trigger use // south switch
key: setthread value:door_move
key: #set value: 2
Trigger use // east switch
key: setthread value:door_move
key: #set value: 3
Trigger use // west switch
key: setthread value:door_move
key: #set value: 4
for(local.i=1;local.i<=4;local.i++)
{
level.doormover[local.i] = 0
}
end
door_move:
if(level.doormover[self.set]==0)
{
level.doormover[self.set]=1
self thread do_doormove
}
else
level.doormover[self.set]=0
end
do_doormove:
while(level.doormover[self.set]==1)
{
switch (self.set)
{
case 1:
$door movenorth 10 // 10 units per second
$door move
wait 1
break
case 2:
$door movesouth 10 // 10 units per second
$door move
wait 1
break
case 3:
$door moveeast 10 // 10 units per second
$door move
wait 1
break
case 4:
$door movewest 10 // 10 units per second
$door move
wait 1
break
}
}
end
if you want the door to stop when you change directions make the case statements like this
case 1:
level.doormover[2] = 0
level.doormover[3] = 0
level.doormover[4] = 0
$door movenorth 10 // 10 units per second
$door move
wait 1
break
