making an escalator

Tutorials for Call of Duty mapping

Moderator: Core Staff

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

making an escalator

Post by megazor » August 27th, 2010, 9:38 am

http://www.youtube.com/watch?v=-q4IrazmT9g

watched? excellent!

how to make it? lets go:

1. create a step, turn it into a brushmodel and give it targetname "step".
2. copy it as times as many steps ud like to create.
3. now put them all into the same place.
mapping finished on this.

now lets make some scripting. i assume u know how to script.

Code: Select all

startsteps()
{
	steps = getEntArray("step", "targetname");
	for (i = 0; i < steps.size; i++)
	{
		steps[i] thread step();
		wait .25;
	}
}	

step()
{
	while(1)
	{
		self moveTo((16, 0, 0), .25);
		wait .25;
		self moveTo((self.origin+(32, 0, 8)), .5);
		wait .5;
		self moveTo((self.origin+(16, 0, 8)), .25);
		wait .25;
		self moveTo((self.origin+(160, 0, 160)), 2.5);
		wait 2.5;
		self moveTo((self.origin+(16, 0, 8)), .25);
		wait .25;
		self moveTo((self.origin+(48, 0, 8)), .75);
		wait .75;
		self.origin = (0, 0, 0);
	}
}
WARNING! This code might not be working for your elevator. its supposed for 18 steps that are 16x16 units (width&height).
if u create 20 steps or make bigger ones, there will be holes between steps or some different problems. to make it work properly, u will have to change waits and motion values.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 27th, 2010, 4:22 pm

u mistaken ^^

the simplest proof:

http://img833.imageshack.us/img833/3002/escs.jpg





even without having seen your escalator, i say: my escalator looks nicer, doesnt it?

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 27th, 2010, 4:31 pm

the code u pasted looks simpler - according to your escalator, which is based on simple movement. i was going to make an escalator that would act like a real one, and i managed to do it.

my code has one shortcoming (just after map started, u dont see the escalator as all tis steps are being in the same place), but its possible to fix it - but more lines of code needed.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 27th, 2010, 4:33 pm

If you want some "level" parts at the start, end you can just set it to check the origins for these areas and adapt the movement to suit. This system is more "belt and braces" than yours imo and more adaptable.
then say goodbye to that simple code ^_^

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 28th, 2010, 6:18 am

improved script:

Code: Select all

steps(i)
{
	org = self.origin;
	switch(i)
	{
		case 20:
		case 19:
		d = (21-i);
		self moveX(16*d, .25*d);
		wait .25*d;
		break;

		case 18:
		self moveTo(org+(16, 0, 2), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 17:
		self moveTo(org+(16, 0, 4), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 16:
		self moveTo(org+(16, 0, 8), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 15:
		self moveTo(org+(16, 0, 10), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 14:
		case 13:
		case 12:
		case 11:
		case 10:
		case 9:
		case 8:
		case 7:
		case 6:
		d = 15-i;
		self moveTo(org+(16*d, 0, 16*d), .25*d);
		wait .25*d;
		self thread steps(15);
		return;
		
		case 5:
		self moveTo(org+(16, 0, 10), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 4:
		self moveTo(org+(16, 0, 8), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 3:
		self moveTo(org+(16, 0, 4), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 2:
		self moveTo(org+(16, 0, 2), .25);
		wait .25;
		self thread steps(i+1);
		return;

		case 1:
		case 0:
		d = (2-i);
		self moveX(16*d, .25*d);
		wait .25*d;
		self thread steps(2);
		return;
	}
	self.origin = (0, 0, 0);
	self thread steps(0);
}
i bet drof's code would be as big as mine is or even bigger - if u decided to complicate the movement of your escalator.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 28th, 2010, 6:25 am

and in addition, (at least in cod1) waittill() function doesnt fit escalators since it causes pauses between parts of its motion.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 28th, 2010, 10:11 am

the boce above sux, i improved it again:

Code: Select all

steps(i)
{
	org = self.origin;
	switch(i)
	{
		case 20:
		case 19:
		d = (21-i);
		self moveX(16*d, level.esc_time*d);
		wait level.esc_time*d;
		break;

		case 18:
		case 17:
		case 16:
		case 15:
		d = 2;
		for (a = 0; a < 18-i; a++) d*=2;
		if (d == 16) d = 10;
		self moveTo(org+(16, 0, d), level.esc_time);
		wait level.esc_time;
		self thread steps(i+1);
		return;

		case 14:
		case 13:
		case 12:
		case 11:
		case 10:
		case 9:
		case 8:
		case 7:
		case 6:
		d = 15-i;
		self moveTo(org+(16*d, 0, 16*d), level.esc_time*d);
		wait level.esc_time*d;
		self thread steps(15);
		return;
		
		case 5:
		case 4:
		case 3:
		case 2:
		d = 2;
		for (a = 0; a < i-2; a++) d*=2;
		if (d == 16) d = 10;
		self moveTo(org+(16, 0, d), level.esc_time);
		wait level.esc_time;
		self thread steps(i+1);
		return;

		case 1:
		case 0:
		d = (2-i);
		self moveX(16*d, level.esc_time*d);
		wait level.esc_time*d;
		self thread steps(2);
		return;
	}
	self.origin = (0, 0, 0);
	self thread steps(0);
}
now im looking for a way to stop the elevator and increase its speed without restarting.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 28th, 2010, 10:15 am

boce = code. thats my own language.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 28th, 2010, 12:34 pm

code above sux hard, this is the best one coz u can change its speed:

Code: Select all

main()
{
	if (getCvar("esc_time") == "")
		setCvar("esc_time", .5);

	thread esc_time_update();

	wait .05;
	steps = getEntArray("step", "targetname");
	for (i = 0; i < steps.size; i++)
	{
		steps[i].saved_origin = steps[i].origin;
		steps[i] thread steps(i);
	}
}

esc_time_update()
{
	level.esc_time = getCvarFloat("esc_time");
	while(1)
	{
		if(level.esc_time != getCvarFloat("esc_time"))
		{
			level.steps_stopped = 0;
			level.stop_esc = 1;
			level waittill("esc stopped");
			level.stop_esc = undefined;
			level.steps_stopped = 0;
			level.esc_time = getCvarFloat("esc_time");
			steps = getEntArray("step", "targetname");
			for (i = 0; i < steps.size; i++)
			{
				steps[i].origin = steps[i].saved_origin;
				steps[i] thread steps(i);
			}
		}
	wait 1;
	}
}

steps(i)
{
	org = self.origin;
	switch(i)
	{
		case 20:
		case 19:
		d = (21-i);
		self moveX(16*d, level.esc_time*d);
		if(isDefined(level.stop_esc))
			return;
		wait level.esc_time*d;
		break;

		case 18:
		case 17:
		case 16:
		case 15:
		d = 2;
		for (a = 0; a < 18-i; a++) d*=2;
		if (d == 16) d = 10;
		self moveTo(org+(16, 0, d), level.esc_time);
		wait level.esc_time;
		if(isDefined(level.stop_esc))
			return;
			
		self thread steps(i+1);
		return;

		case 14:
		case 13:
		case 12:
		case 11:
		case 10:
		case 9:
		case 8:
		case 7:
		case 6:
		d = 15-i;
		self moveTo(org+(16*d, 0, 16*d), level.esc_time*d);
		wait level.esc_time*d;
		if(isDefined(level.stop_esc))
		{
			level.steps_stopped++;
			if (level.steps_stopped >= 9)
				level notify("esc stopped");
			return;
		}
		self thread steps(15);
		return;
		
		case 5:
		case 4:
		case 3:
		case 2:
		d = 2;
		for (a = 0; a < i-2; a++) d*=2;
		if (d == 16) d = 10;
		self moveTo(org+(16, 0, d), level.esc_time);
		wait level.esc_time;
		if(isDefined(level.stop_esc))
			return;
		self thread steps(i+1);
		return;

		case 1:
		case 0:
		d = (2-i);
		self moveX(16*d, level.esc_time*d);
		wait level.esc_time*d;
		if(isDefined(level.stop_esc))
			return;
		self thread steps(2);
		return;
	}
	self.origin = (0, 0, 0);	
	self thread steps(0);
}

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

Re: making an escalator

Post by Drofder2004 » August 28th, 2010, 4:02 pm

Congratulations, its a nice script, I am sure you worked hard... but don't assume I cannot make as good as a script simply because I haven't devoted more than 10 minutes to making an escalator :roll:
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

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 29th, 2010, 3:46 am

i didnt mean it, lol. but killerSam said your script is easier - well, he told the truth, but try making an easier script for movement that is as hard as i made :) its not the first escalator altogether, of course, there were ones in many games, for example GTA, and so on, but, regarding cod, its the first escalator that is moving like a real one. the thing KS made doesnt please eyes, i bet.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 29th, 2010, 6:53 am

if u put some nice textures on it... it might be looking nice. but it would be looking much better it if had both nice movement and nice textures.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: making an escalator

Post by megazor » August 29th, 2010, 7:28 am

new video. just look how realistic it is. lol, except the texturing, i dont show taste in it -.-

http://www.youtube.com/watch?v=4zfEEbSOuQQ

User avatar
Hoogie
Core Staff
Core Staff
Posts: 3974
Joined: September 2nd, 2008, 10:22 am
Location: Holland

Re: making an escalator

Post by Hoogie » August 29th, 2010, 7:02 pm

Like you said yourself, work on the textures.
-=[[CoDJumper.com Movies]]=-
[[Ambush]] || [[Backlot]] || [[Bloc]] || [[Bog]] || [[Broadcast]] || [[Chinatown]] || [[Countdown]]
[[Crash]] || [[Creek]] || [[Crossfire]] || [[District]] || [[Downpour]] || [[Killhouse]] || [[Overgrown]]
[[Pipeline]] || [[Shipment & Wetwork]] || [[Showdown]] || [[Strike]] || [[Vacant]]


A woman can fake an orgasm, but a man can fake an entire relationship

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: making an escalator

Post by waywaaaard » August 29th, 2010, 7:41 pm

And Please add an handrail
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests