MODSonline
  Welcome Guest to MODSonline Home | Forums | Register | Login
Main-Menu
Home
Login
Register
Add Download
Add News
Add Tutorial *
Forums

Advertise
Affiliate Store US *
Affiliate Store UK *
Affiliate Store CA *
Angry Letter Generator
Avatar Upload
Calendar of Games
Contact
Downloads
FAQs
Forums
Member List
Member Projects
News
News Grabber *
Policy
Polls
Private Messages
Reviews
Screenshot Gallery
Search
Servers - Game
Store - Shirts *
Subscribe
Topics
Tutorials
Weblinks
Wiki *
Tutorials
CoD Mapping
CoDUO Mapping
CoD2 Mapping
CoD4 Mapping
CoDWW Mapping
CoD FAQs
HL2 Mapping
HL2 FAQs
SOF1 Mapping
Crysis Mapping
Q4 Mapping
Doom 3 Mapping
Doom 3 FAQs
UT2K3 Mapping
SOF2 Mapping
SOF2 FAQs

Lightray Modeling
General Modeling
General Modding
Adobe Photoshop
Common Mapping Errors

Readme.txt Generator
Members-Online
starkk [Forum]
voidsource [Forum]
LRSD [Forum]
OutPoursTh... [Forum]
riegerminden [Downl]

5 Members and 17 Guests
Chat MODSonline
0 People Now Chatting
MODSOnline TeamSpeak

download TeamSpeak

In-The-News
Friday, Nov. 21st
CoD:WW Video Tutorial is up!
Friday, Nov. 21st
MODSonair Episode 154
Thursday, Nov. 20th
Call Of Duty World At War - Mod Tools
Wednesday, Nov. 19th
Half-Life 1 $0.98
Sunday, Nov. 16th
MODSonair 154 Live
Latest Poll
Would you pay for mod tools?
I would pay a one time fee for mod tools for my favorite title 8.46%
I would pay a monthly/yearly subsrciption fee for mod tools for my favorite title 0.5%
I already paid for the game - Tools should come bundled because I am just fixing what the developers broke 68.16%
100% definitely NOT! 18.91%
I haven't seen a game yet that wasn't 100% perfect when the developers released it 2.49%
Games are the devil! 1.49%
Read More...
16 comments

Newsletter
Name:
Email:
Newsletter Archives
Your Membership
User Name:
Password:
Register.
In The Forums
[WIP] SP_Paradise
CoD 4 Single Pla.. Posts: (17) Views: (531) by starkk
Spawn = screwed up
CoD:WW Level Des.. Posts: (1) Views: (3) by starkk
Running a mod with downloads from redirect
CoD:WW Scripting.. Posts: (1) Views: (3) by OutPoursTheRED
Question: Portal Test
CoD 4 Level Desi.. Posts: (4) Views: (55) by JerryAtricks
Art of War Central Quake 4 Mods for Dummies
CoDWW Download
Forums
MODSonline.com Forums

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD 2 Level Design
CoD 2 mapping and level design.
Moderators: foyleman, rEdrUmMDK, Foxhound, Wyatt_Earp, Rasta, StrYdeR, The_Caretaker, Cypher2004, batistablr, Welshy
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access subscribe
Author Topic: Multiple Floor Elevator Script
(VM)Monkey
General Member
Since: Jul 31, 2006
Posts: 113
Last: Mar 24, 2008
[view latest posts]
Level 4
Category: CoD 2 Level Design
Posted: Monday, Aug. 20, 2007 03:21 am
I had a request for how I did my elevator, so I thought I would post it on here in case it could help anybody else.

I have a tower in my map, with 11 floors accessible by elevators. Simply shoot the button that corresponds to the floor you want to go to, the door will close, and take you to your intended destination.

This is the radiant view:



There are a few major components:

The large group of brushes that make up the main part of the cab (walls, floor, ceiling), which I named "acab"

The doors that are attached to the cab. There are four independent sliding panels, similar to a modern elevator. They are named aclo, acli, acri, acro (basically, elevator a, cab door, left outside, etc)

The doors that are at the individual floors. This was the pain in the but part, there may be an easier way, but they're named similar to the cab doors, a1lo, a2lo, etc. Instead of "c" for cab, they have the floor number.

The group of button triggers to tell the elevator where to go. These are all named buttonatrig. The way the script knows which floor they point to is they are given a script_noteworthy of the floor number. For example, the one that will take the elevator to the third floor has a script_noteworthy of "3"

These triggers are linked to the actual button brushes, which don't need to be named, in this script.

Now for the fun part, the scripting.


Code:


Everything related to the elevator is all stored in the structure eleva. This makes it easier to pass the information along to the individual scripts that operate the elevator, and allow for increased flexibility with both adding new floors and adding new elevators.

One important thing to notice is that this is hard coded to the size of my floors. Each one is 136 units high. The script takes the "direction" variable, which again is the intended floor minus the current floor, and multiplies that by 136 to figure the amount it will have to move.

Hopefully this helps some people out. I tried to clean it up and make it as clear as possible, but I know it's some confusing code.

EDIT: I just realized I posted this in the level design, not the scripting forum. It's a little of both I guess, mod's choice. Sorry.

edited on Aug. 20, 2007 03:24 am by (VM)Monkey
playername
Preferred Member
Since: Aug 24, 2006
Posts: 695
Last: Nov 21, 2008
[view latest posts]
Level 6
Category: CoD 2 Level Design
Posted: Monday, Aug. 20, 2007 12:44 pm
I couldn't help but notice this command in your script

eleva.buttons = getentarray("buttonatrig", "targetname");

but yet you said nothing about adding a targetname to the triggers. Am i missing something that i didn't see somewere or...?
Few tips for coding.
1. Keep the script as short as possable.
2. Don't use comments unless you HAVE to point something out.
3. Don't over complicate the script, keep it orgainized and easy to read.

These help you find simple errors and makes it easy to make changes.
OLD_MAN_WITH_GUN
General Member
Since: May 13, 2006
Posts: 747
Last: Oct 13, 2008
[view latest posts]
Level 6
Category: CoD 2 Level Design
Posted: Monday, Aug. 20, 2007 12:54 pm
playername writes...
Quote:
I couldn't help
Maybe thats not a helping request, it's a tutorial [wink]
playername
Preferred Member
Since: Aug 24, 2006
Posts: 695
Last: Nov 21, 2008
[view latest posts]
Level 6
Category: CoD 2 Level Design
Posted: Monday, Aug. 20, 2007 12:59 pm
dang you got me there [lol][wink]
Few tips for coding.
1. Keep the script as short as possable.
2. Don't use comments unless you HAVE to point something out.
3. Don't over complicate the script, keep it orgainized and easy to read.

These help you find simple errors and makes it easy to make changes.
(VM)Monkey
General Member
Since: Jul 31, 2006
Posts: 113
Last: Mar 24, 2008
[view latest posts]
Level 4
Category: CoD 2 Level Design
Posted: Monday, Aug. 20, 2007 03:24 pm
playername writes...
Quote:
I couldn't help but notice this command in your script

eleva.buttons = getentarray("buttonatrig", "targetname");

but yet you said nothing about adding a targetname to the triggers. Am i missing something that i didn't see somewere or...?


Sorry, I'm not a very eloquent writer at 2am, I guess.


Quote:
The group of button triggers to tell the elevator where to go. These are all named buttonatrig.


The button triggers are all named buttonatrig. Their targets (the actual button brushes) are the ones that don't need to be named. If you look in the screenshot, you can barely see the targetname "buttonatrig", and the target of "auto10", as well as the script_noteworthy of "1".
(VM)Monkey
General Member
Since: Jul 31, 2006
Posts: 113
Last: Mar 24, 2008
[view latest posts]
Level 4
Category: CoD 2 Level Design
Posted: Friday, Nov. 23, 2007 03:01 pm
Sorry for digging up this old thread, but I noticed somebody else linked to it, so I needed to post an update.

This script may work best for SP only (I can't verify that though). With the three elevators I had running, and an otherwise average scripted map, once more than a few people logged on in MP, the game became basically unplayable due to the amount of scripting, models, and triggers for this elevator.

Anybody interested in modifying this code to work for their map is more than welcome, just be warned that it is flawed. Caveat Emptor and all that jazz.
Restricted Access Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD 2 Level Design
All logos and trademarks and information in this site are property of MODSonline LLC © 2008.
The comments are property of their posters.
RSS news feeds for MODSonline can be found News.php.
Art of War Central
Partners
CODAddicts - Call of Duty News & Downloads
modbase.be
The Firing Box
Call of Duty Headquarters
Battle for Europe COD2
Frag Universe
XoXide
Ask About
Advertising
Friends
Great Gamer
ModTheater
After Life Gaming
Ask About
Advertising
Link to Us
MODSonair
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
MODSonair Releases
MODSonair Episode 154
MODSonair Episode 153
MODSonair Episode 152
MODSonair Episode 151
Video server move
Next Show
The next MODSonair show will air LIVE on:
11/23/2008 12:00 EST

Time remaining:
Copyright © 2008 MODSonline
Tresware Content Management System Copyright © 2008 Tresware
Website Designed and Hosted   Tresware