An Elevator

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

Moderator: Core Staff

Post Reply
User avatar
Soviet
Core Staff
Core Staff
Posts: 7762
Joined: April 23rd, 2005, 9:12 pm

An Elevator

Post by Soviet » July 9th, 2008, 10:23 pm

I want to create an advanced elevator, but unfortunately I have no idea how to go about it. I was hoping someone (drofder) could help me out. First, it needs to be a two-way elevator that goes from story 1 to story 2 and back. Each level needs to have an outer button that can be pressed to call the elevator to that level and open the door. When the person is inside the elevator there should be 2 buttons. One for the top story, one for the bottom story. If the door is open, pressing the button to go down/up once should close the door. Pressing it a second time should make the elevator go down/up and open the door on the other floor. If the door is closed and you press the button for the floor you are on, it should open the door.

Is this possible, reasonable, and are there any ways to simplify it?

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

Re: An Elevator

Post by Drofder2004 » July 9th, 2008, 11:47 pm

Yep, KS has it spot on.
Each level make a vairable
elevator.floor_1 = (0,0,0);
etc

Then create an elevator status variable

i.e

elevator.status = 1 / 2 / 3

Each number represents a different thing.

1 = Bottom floor
2 = 2nd floor
etc

and finally, a door open/closed variable
elevator.door = open/closed

Then through use of correctly placed if statements, you can create the desired effect.

Start with obviously a button detection script.
Then check if the doors are open/closed
Then check which floor it is at and whether or not to open/close/move the elevator
Then repeat.

Write it yourself and then let us know how you get on and we can help from there.
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

User avatar
Soviet
Core Staff
Core Staff
Posts: 7762
Joined: April 23rd, 2005, 9:12 pm

Re: An Elevator

Post by Soviet » July 9th, 2008, 11:54 pm

Damn, I really need to learn scripting beyond rotate and moveto commands :P I get the concept of what you are saying, I just don't really know the syntax and how to put it all together. Is there any map that has used these commands so I can see a sample of them in action?

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: An Elevator

Post by Pedsdude » July 10th, 2008, 3:30 pm

Soviet wrote:Is there any map that has used these commands so I can see a sample of them in action?
Your map, for the right price :lol:
Image
Image

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests