Looking for scripting advice

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
x0mbie
CJ Wannabe
CJ Wannabe
Posts: 32
Joined: February 1st, 2008, 7:07 am

Looking for scripting advice

Post by x0mbie » 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:

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.
I saw a priest kill a cop on TV. :o

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Looking for scripting advice

Post by IzNoGoD » November 16th, 2010, 11:06 pm

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!
LMGTFY!

Its not a glitch... Its the future!

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Looking for scripting advice

Post by Drofder2004 » November 17th, 2010, 12:06 am

Reading the description alone says the only way of doing this is to script each event individually...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

x0mbie
CJ Wannabe
CJ Wannabe
Posts: 32
Joined: February 1st, 2008, 7:07 am

Re: Looking for scripting advice

Post by x0mbie » November 17th, 2010, 11:39 am

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
I saw a priest kill a cop on TV. :o

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Looking for scripting advice

Post by IzNoGoD » November 17th, 2010, 11:47 am

If you need any help scripting, just add me to xfire
Looks like a lot of fun
imbackagainiba<-xfire
LMGTFY!

Its not a glitch... Its the future!

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Looking for scripting advice

Post by Moustache » November 17th, 2010, 11:51 am

Awesome idea :mrgreen:
I want to be a beta tester if you need one :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests