Page 1 of 1

Looking for scripting advice

Posted: November 15th, 2010, 7:00 pm
by x0mbie
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:

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");
    }
}
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.

Re: Looking for scripting advice

Posted: November 16th, 2010, 11:06 pm
by IzNoGoD
Why dont you go with part 2 of the movie: The hypercube?
So if you exit the one cube, you automatically get into the other side of the cube :D

If you havent seen it yet: Go watch!

Re: Looking for scripting advice

Posted: November 17th, 2010, 12:06 am
by Drofder2004
Reading the description alone says the only way of doing this is to script each event individually...

Re: Looking for scripting advice

Posted: November 17th, 2010, 11:39 am
by x0mbie
IzNoGoD wrote:Why dont you go with part 2 of the movie: The hypercube?
So if you exit the one cube, you automatically get into the other side of the cube :D

If you havent seen it yet: Go watch!
I'm actually working on a whole single player campaign based off of the series of movies, so the first level will be based around the first movie, and later levels based around the other 2 movies perhaps, as well as my own original ideas to supplement the story behind the movie.
Drofder2004 wrote:Reading the description alone says the only way of doing this is to script each event individually...
Alright, well thanks for the reply. I just wanted to make sure I wasn't missing something obvious. I guess I'll have to do it that way or else change the whole door system.


WIP Screenshots:

http://www.xfire.com/profile/s4ntiago/s ... #106955718
http://www.xfire.com/profile/s4ntiago/s ... #106955721
http://www.xfire.com/profile/s4ntiago/s ... #106955722

Re: Looking for scripting advice

Posted: November 17th, 2010, 11:47 am
by IzNoGoD
If you need any help scripting, just add me to xfire
Looks like a lot of fun
imbackagainiba<-xfire

Re: Looking for scripting advice

Posted: November 17th, 2010, 11:51 am
by Moustache
Awesome idea :mrgreen:
I want to be a beta tester if you need one :)