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

Members Online

»
0 Active | 104 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

Tutorials

»
CoD Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Elevator in Multiplayer
Versions: You must be logged in to view history.
This tutorial will show you how to add an elevator in your multiplayer map.

Elevator in Multiplayer

This tutorial will show you how to add an elevator in your multiplayer map.

The majority of the process of putting an elevator in your map is script work - however i will walk you through the entire process.

First create your elevator out of brushes.

Select them all and right click in the 2d window and make them a script_brushmodel.

Press "N" to bring up the entity editor and give them the key targetname and the value elevatormodel.

Now we will add the button. Right click in the 2d window and click misc then model. Close the browser window and in the entity editor enter the key model and the value xmodel/switch1. (I accidentally created mine as a script_model - but it will work either way). Move the button into position.

Then, using textures common/trigger, draw out the trigger area. (this is where the button will be pressable).

Right click in the 2d view and click trigger and use.

Press "N" to bring up the entity editor and give the trigger_use the key of targetname and the value elevatorswitch.

Texture the visible faces of your elevator.

That is it for the map...now onto the scripting

First, for sounds - create a .csv file using the following information.



name,sequence,file,vol_min,vol_max,pitch_min,pitch_max,dist_min,dist_max,channel
,type,probability,loop,masterslave,loadspec,subtitle

null,,null.wav,,,,,,,,,,,,,

# Personal Sounddefinitions,,,,,,,,,,,,,,,
elevator1,,misc/elevator_med.wav,,,,,,,auto,,,,,,


.csv information courtesy of Sgt. Skywalker

Now we need a .gsc to make the elevator work...you can save it as whatever you want - just make sure you call on it in yourmap.gsc.


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[i] 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;
}


.gsc courtesy of LordBlank, enhanced by Snakeshift and modified by Sgt. Skywalker

Also note:

If you put in

movez(320,5,2,2)


it'll move upwards 320 units (z axis) in 5 seconds, however the elevator will accelerate the first two seconds then move one second at top speed and then take the last two seconds to slow down, i suggest you use that to make your elevator more realistic, ofcourse remember that you cant put in

movez(320,3,2,2)

because 2+2 is 4 and since that's more then three you'll get a script compile error

see the tutorial Getting Started in Scripting for more information on this.

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

»