Mapping CoD4 ( tuto )


305 : How to add ziplines on a map?


Radiant part


Create a trigger use brush anywhere like the following:

Image

Add the following properties :



Add a model to act like a handle (you can use whatever xmodels of your choice).

Image

You can add as many ziplines as you want, just make sure handles are properly set.
Please note, that handle will slide to destination location and will come back at its original place afterwards.
The zipline is usable only when the handle is back at its origin.

Script part


First, add a file called maps/mp/_zipline.gsc
Paste this in your file:


main() {
thread ziplines();
}

ziplines() {
zip = getentarray("zip_trig","targetname");
for (i = 0; i < zip.size; i++) {
zip[i] thread zip();
}
}

zip() {
handle = getent (self.target, "targetname"); //The handles
org_start = handle GetOrigin();
while (1) {
self waittill ("trigger", user);
user setOrigin( org_start - (0,0,80) );
user linkto(handle);
vec = strtok(self.script_noteworthy, ",");

handle moveto((int(vec[0]), int(vec[1]), int(vec[2])), 6, 4, 2);
// You can add sound here if you'd like
//handle playsound( "rope" );
handle waittill ("movedone");
user unlink();
handle moveto(org_start, 6, 4, 2);
handle waittill ("movedone");
wait 1;
}
}



In your maps/mp/mp_xxx.gsc
add the following:

main() {
  maps\mp\_load::main();
  maps\mp\_zipline::main();
  ...
}



Do not forget to add this rawfile,maps/mp/_zipline.gsc to your zone file.

Tuto by Efaya