Moving Platforms

Tutorials for Call of Duty mapping

Moderator: Core Staff

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Moving Platforms

Post by Nightmare » April 8th, 2006, 5:01 am

Well, I had some free time on my hands so I decided to go ahead and make a tut for Moving Platforms and how to make and animate them.
I will try and go in as much detail as I can, but if there is still something you dont understand, X-Fire me at nightmare377.

56K Beware, There are a few of pics.

Ok, so for the Intro:
Well you want to make a moving platform? Its simple. Here are the simple and easy steps on how to make one.

First we are going to call this map: platform (Keep it simple for less confusion)

Simple Platform Movment
For our first platform, we will make a very simple 64 X 64 unit platform move back and forth between two ledges.

So First, Make two ledges and put a 64 X 64 platform on one side of the platforms over the gap.

Image

The selected brush is the platform and it will move up and down along the Y Axis. Remeber this because it will be a big help in the scripting after wards.

Now onto the naming part:

How to name your Platform
To name your platform, it is really simple. Select the Platform Brush and right click it on the 2d grid. Now go all the way down to the Section: Script and Click on BrushModel.

The outline of your platform on the 2d Grid should turn in blue.

Now press N to bring up the entities and type in the following

Key:targetname
Value:platform1

and press enter.

Thats all for your mapping, Compile and lets head onto the scripting.

Scripting
So first what we will do is have our two folders ready: The maps/mp and the mp folder.

Add the .bsp filein the maps/mp folder and the .arena to the mp.

Now go back to the maps/mp folder, because we will be spending alot of time in there.
First, make a notepad and name it platform, then inside the txt put in this script

Code: Select all

main()
{
maps\mp\_load::main();
maps\mp\platform1::main();
maps\mp\platform2::main();
}
The main() Runs the paks in cod and the platform 1 and 2 are the two other gscs that we are going to add now.
But first save the txt and rename the end as a .gsc instead of a .txt, so you should have platform.gsc

Scripting the First Platform
Now that we have our bsp and main runner, its time to add our first movment script.

As you recall, we named the platform "platform1". So now we will add a new notpad in the maps/mp folder that will be called platform1.

In this notepad put in the following:

Code: Select all

main()
{
thread platform1();
}

platform1()
{
platform = getent ("platform1","targetname");
while(1)
{
platform moveY (208,2,0.5,0.5);
wait(5);
platform moveY (-208,2,0.5,0.5);
platform waittill ("movedone");
}
}
Ok, so in detail:

Image

So now that you have that copy and pasted save that as a gsc as I showed you earlier and thats it!

Adding Triggers
Ok so now we will go on to the fun stuff; adding triggers.
The script will be alittle more complicated but it will give a better and more controlled effect.

So lets go back to our platform.map and add two more platforms and a moving script/brushmodel platform just like I showed you earlier.
BUT! Watch out when naming the platform again, make sure you dont name it platform1.
Instead we will name it

Key:targetname
Value:platform2

Now this time we will make a Trigger just in front of the platform. Make it 64 by 64 units big and 72 units high.
Right click on the selected trigger and select: trigger/multiple

Now Press N again to bring up the entities and type in these names;

Key:targetname
Value:trig_platform

Here is what you map should look like:

Image

Ok, so now lets compile and go back to the scripting:

Scripting a Triggered Platform
Ok so now you have the mapping done for both a platform and a platform with a trigger, before you run off to test everything, you have to now script in the Triggered platform.

This is where that maps\mp\platform2::main(); line comes into play;

Make a new notepad beside your bsp and two gscs in your maps/mp folder, and name it platform2

Now inside put in this script I will only explain the new commands in the picture:

Code: Select all

main()
{
thread platform2();
}

platform2()
{
platform = getent ("platform2","targetname");
trigger = getent ("trig_platform","targetname");
while(1)
{
trigger waittill ("trigger");
wait(2);
platform moveY (208,2,0.5,0.5);
wait(5);
platform moveY (-208,2,0.5,0.5);
platform waittill ("movedone");
}
}
As for the in depth Description:

Image

Now save and turn this txt into a gsc

So what you should have in your maps/mp is this:

Image

So just turn all that into a pk3 and Congrats! You have just made a moving platform with and without a trigger!!!

I am also putting a zip at the bottom for those who dont understand or is missing something, in the zip is the pk3 and the map file.

http://s42.yousendit.com/d.aspx?id=3VC5 ... O35DUCM085

Well, I hope this Tut helped anyone out, I will try to come with some more tuts later!
Made By Nightmare
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Grom
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 738
Joined: March 30th, 2005, 12:29 pm
Location: Norway

Post by Grom » April 8th, 2006, 7:53 am

Great tutorial Nightmare, good job !

/stickied :wink:

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Post by Soviet » April 8th, 2006, 1:59 pm

nice one man
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » April 8th, 2006, 3:01 pm

Nice tut, one thing i'd suggest tho is to use moveto rather than movex/y/z for things like this and elevators.. otherwise if the object gets stuck it will just fuck it up.
This is the script i would use:

Code: Select all

main()
{
thread platform1();
thread platform2();
}

platform1()
{
platform = getent ("platform1","targetname");
while(1)
{
platform  moveto ((0, 208,0), 2,0.5,0.5);
wait(5);
platform  moveto ((0, 0,0), 2,0.5,0.5);
platform waittill ("movedone");
}
}

platform2()
{
platform = getent ("platform2","targetname");
trigger = getent ("trig_platform","targetname");
while(1)
{
trigger waittill ("trigger");
wait(2);
platform moveto ((0, 208,0), 2,0.5,0.5);
wait(5);
platform moveto ((0, 0,0), 2,0.5,0.5);
platform waittill ("movedone");
}
}

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » April 8th, 2006, 3:04 pm

the problem with the moveto is that its harder to position and it can get out of track very easily. Thats why I like to keep it simple with moveX,Y,Z even tho that it can bug sometimes.

And the reason I kept the two scripts in two different gscs is not to confuse people :P
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » April 8th, 2006, 3:20 pm

Nightmare wrote:the problem with the moveto is that its harder to position and it can get out of track very easily.
Example? ...i'm not saying you can use it for everything you want to do, but for something like this, something that just moves forward and back or up and down, moveto is better coz even if it gets stuck, it will continue to work correctly afterwards, unlike movex/y/z.

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » April 8th, 2006, 3:41 pm

I know that but moveX,Y,Z is alot simpler to use :P
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » April 8th, 2006, 3:47 pm

Very nice tutorial Nightmare :)

I've only used moveX/Y/Z so far, will try out moveto in the near future.
Image
Image

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

Post by Drofder2004 » April 10th, 2006, 6:21 pm

Very nicely done :)
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

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » April 13th, 2006, 12:58 am

Luke, remember where you were saying that its easy to glitch move X,Y,Z? Well I found a way to make it completly glitch proof.
main()
{
thread platform1();
}

platform1()
{
platform = getent ("platform1","targetname");
while(1)
{
platform moveY (208,2,0.5,0.5);
platform waittill ("movedone");
wait(5);
platform moveY (-208,2,0.5,0.5);
platform waittill ("movedone");
}
}
If you acctually add the waittill move done after every move, it tells the game to wait until the script brush model has moved until it will continue to the next command.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » April 13th, 2006, 1:46 am

Nightmare wrote:Luke, remember where you were saying that its easy to glitch move X,Y,Z? Well I found a way to make it completly glitch proof.
main()
{
thread platform1();
}

platform1()
{
platform = getent ("platform1","targetname");
while(1)
{
platform moveY (208,2,0.5,0.5);
platform waittill ("movedone");
wait(5);
platform moveY (-208,2,0.5,0.5);
platform waittill ("movedone");
}
}
If you acctually add the waittill move done after every move, it tells the game to wait until the script brush model has moved until it will continue to the next command.
Very true. The "glitch" of screwing up a moving platform is usually if people use "wait" instead of "waittill", but for best practise, using origins is better ;)
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

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » April 14th, 2006, 1:54 am

I've just used moveto in my coding for peds_parkour, about to test it ;)

Edit: bloody hell this has caused a shitload of problems lol - took ages for me to solve a script compile error first, and then the map crashed with a runtime error every time i loaded the map and tried to choose a team, with it going on about something to do with menus/lev (think it's to do with soviet's menu mod so I have deleted it for the meantime).
Image
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » April 14th, 2006, 3:06 am

Developer mode doesn't like mods :wink:

Pedsdude
Site Admin
Site Admin
Posts: 15908
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » April 14th, 2006, 12:11 pm

Ah, so it's only cause I'm running it in developer mode? :P
Image
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » April 14th, 2006, 12:29 pm

Well whenever i've run it in developer mode with mods i've always got errors, so if you get big erros like that which have nothing to do with your script its more than likely mods.
I usually leave developer mode off in the coduo maker options, and just turn it on if i get an error.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests