Looking for scripting advice
Posted: November 15th, 2010, 7:00 pm
I'm working on a map and was looking for opinions on how to simplify my script somewhat. Here is the scenario:
My map is like the movie "Cube." I have many rooms, each having 4 ways out. (6 technically, but I'm working with the 4 walls at the moment to keep things simple). When the player approaches one door, it will open, as well as the corresponding door in the next room. Before the doors move up (open), they each move a few units toward each other, and to my knowledge have to be controlled with separate scripts for that reason. Here is the script I currently have for 1 set of doors:
I am hoping for some recommendations for an easier way to do this, since I have many rooms and 3 doors per room (after this first room. I thought I could use an array to do this at first, but I don't know how to do that with a set of doors moving each time and with different movements.
My map is like the movie "Cube." I have many rooms, each having 4 ways out. (6 technically, but I'm working with the 4 walls at the moment to keep things simple). When the player approaches one door, it will open, as well as the corresponding door in the next room. Before the doors move up (open), they each move a few units toward each other, and to my knowledge have to be controlled with separate scripts for that reason. Here is the script I currently have for 1 set of doors:
Code: Select all
main()
{
thread cube1();
}
cube1()
{
xm_cube1trigger = getent("trig1a", "targetname");
xm_cube1doora = getent("door1a", "targetname");
xm_cube1doora_2 = getent("door1a_2", "targetname"); //The corresponding door in the adjacent room
while(1)
{
xm_cube1trigger waittill ("trigger", user);
xm_cube1doora moveX(-16,1.5,0.5,0.5);
xm_cube1doora_2 moveX(16,1.5,0.5,0.5);
xm_cube1doora_2 waittill("movedone");
xm_cube1doora moveZ(128,2);
xm_cube1doora_2 moveZ(128,2);
xm_cube1doora_2 waittill("movedone");
wait(8);
xm_cube1doora moveZ(-128,2);
xm_cube1doora_2 moveZ(-128,2);
xm_cube1doora_2 waittill("movedone");
xm_cube1doora moveX(16,1.5,0.5,0.5);
xm_cube1doora_2 moveX(-16,1.5,0.5,0.5);
xm_cube1doora_2 waittill("movedone");
}
}