Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 89 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Making Multiple Elevators
SantaClaus1996
General Member
Since: Sep 22, 2009
Posts: 8
Last: Sep 30, 2009
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Monday, Sep. 28, 2009 12:47 am
Okay for my map I ran into a problem... or three accually. And here is the link to the tutorial I used http://www.modsonline.com/Tutorials-read-169.html.

1. how do I create a second elevator on a map. I'm going to list the scirpt I used (from the tutorial, and it worked for me at the hight it was supposed to go up without editing it) and the entity stuff.

This is the entity informaton:

The elevator brushmodel:
key: targetname
value: elevatormodel

The trigger (use trigger)
key: targetname
value elevatorswitch

This is the sciprt information I put into my _elevator.gsc file:

main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

elevator_start() {
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 192;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}

*Note: I have called on this file in my mp_(map name).gsc file.

So, what do i need to do to make a second elevator?

2. I would like to know how to change how high the elevator will go up and if it will come back down or not.

3. Now the tutorial wants me to have a .csv file for the sound of the elevator starting and rising. I know how to make it but I don't know how to call on it or what to do with it or what to save it as.

Any help?
Share |
CoDLiNK
General Member
Since: Mar 16, 2008
Posts: 178
Last: Sep 28, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Sep. 28, 2009 02:26 am
Just add another gsc to the map and call them in your main gsc..

Share |
Kylee
General Member
Since: Aug 3, 2009
Posts: 56
Last: Apr 5, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Sep. 28, 2009 09:57 am
Hey again Santa lol.
Ok you would do this:

The elevator brushmodel:
key: targetname
value: elevatormodel2 <----- you see # 2

The trigger (use trigger)
key: targetname
value elevatorswitch2 <----- you see # 2

Now make a new _elevator2.gsc and put this in it

Code:

main() { 
level.elevatorDown = true; // elevator starts at bottom: true/false 
level.elevatorMoving = false; // elevator is not currently moving 
thread elevator_start(); 
} 

elevator_start() { 
elevator = getentarray ("elevatorswitch2","targetname"); 
if ( isdefined(elevator) ) 
for (i = 0; i < elevator.size; i++) 
elevator thread elevator_think(); 
} 

elevator_think() { 
while (1) { 
self waittill ("trigger"); 
if (!level.elevatorMoving) 
thread elevator_move(); 
} 
} 

elevator_move() { 
elevatormodel = getent ("elevatormodel2", "targetname"); 
level.elevatorMoving = true; 
speed = 2; 
height = 192; 
wait (1); 
if (level.elevatorDown) { // moves to top 
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed); 
elevatormodel waittill ("movedone"); 
level.elevatorDown = false; 
} 
else { // moves to bottom 
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed); 
elevatormodel waittill ("movedone"); 
level.elevatorDown = true; 
} 
level.elevatorMoving = false; 
}


You see line 26 & 27? thats where to change the height and speed [biggrin]

Share |
SantaClaus1996
General Member
Since: Sep 22, 2009
Posts: 8
Last: Sep 30, 2009
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Monday, Sep. 28, 2009 02:03 pm
Thnx again Kylee! Well with changing all of the stuff to _elevator2... I did try that but I guess I must have written something wrong. But thnx I'm going to add that in right now!
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»