Moving Platforms..HELP Required Please

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
steveuk
CJ G0D!
CJ G0D!
Posts: 1330
Joined: November 21st, 2006, 12:51 pm

Moving Platforms..HELP Required Please

Post by steveuk » May 13th, 2011, 12:19 pm

can someone please tell me how to make a platform move side to side and up and down, along with any scripts i may need to add, and where to place the scripts..

i have tried this already but it just is not working..

I made a Brush_origin over some water and added the following to my GSC file.

Code: Select all

main()
{
	maps\mp\_load::main();
	maps\mp\_explosive_barrels::main();
	maps\mp\mp_barrel1_platforms::main();
	ambientPlay("ambient_backlot_ext");

	game["allies"] = "sas";
	game["axis"] = "opfor";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";

	setdvar( "r_specularcolorscale", "1" );

	setdvar("r_glowbloomintensity0",".25");
	setdvar("r_glowbloomintensity1",".25");
	setdvar("r_glowskybleedintensity0",".3");
	setdvar("compassmaxrange","1800");

    level._effect[ "rain_heavy_mist" ] = loadfx( "weather/rain_mp_farm" );
    level._effect[ "lightning" ]   = loadfx( "weather/lightning_mp_farm" );

	level thread Fxs();
}

Fxs()
{
	maps\mp\_fx::loopfx("rain_heavy_mist", (531.5, -411.9, 0.0), 3);
	maps\mp\_fx::loopfx("lightning", (531.5, -411.9, 0.0), 10);
}
ive then made a platform.gsc file and added the following
ain()
{
platform = getEnt("platform","targetname");
platform thread moveit();
}

moveit()
{
while(1)
{
self moveX(30, 5, 0.1, 0.2); //this will move the platform 30 units on the X axis in 5 seconds, accelerating for 0.1 seconds and decelerating for 0.2 seconds; you can change these number to best suit your needs; only restriction is that acceleration+deceleration wait 5; //waits for 5 seconds
self moveX(-30, 5, 0.1, 0.2); //this will move the platform 30 units in the other direction on the same X axis, so the platform will end up in the starting position
wait 5;
// you can also use moveY to move the platform on the Y axis (side to side) or moveZ (up - down)
}

{

when i compile the map i get a error

Image

the error being the Bracket (}) sometime it will change when i change the script to ({)
even so if i can get the scrip corrected, im not even sure if the platform will move,. as the map wont run with this error.

Also do i need to add anything in my zonefile and is a script origin the correct thing i need to use, and when i press (N) do i set the vaules as KEY: Targetname: Value: Platform ???

HELP PLEASE.

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: Moving Platforms..HELP Required Please

Post by Nekoneko » May 13th, 2011, 12:49 pm

i hope for the "ain()" you just failed to copy the "m".
And I get those errors sometime too, its mostly a missing ;

steveuk
CJ G0D!
CJ G0D!
Posts: 1330
Joined: November 21st, 2006, 12:51 pm

Re: Moving Platforms..HELP Required Please

Post by steveuk » May 13th, 2011, 1:15 pm

Nekoneko wrote:i hope for the "ain()" you just failed to copy the "m".
And I get those errors sometime too, its mostly a missing ;

lol yea i missed the 'M@ when copying i do that a lot.lol

steveuk
CJ G0D!
CJ G0D!
Posts: 1330
Joined: November 21st, 2006, 12:51 pm

Re: Moving Platforms..HELP Required Please

Post by steveuk » May 13th, 2011, 1:16 pm

KillerSam wrote:
steveuk wrote:

Code: Select all

 
main()
 {
 platform = getEnt("platform","targetname");
 platform thread moveit();
 }
 
 moveit()
 {
 while(1)
 {
 self moveX(30, 5, 0.1, 0.2); //this will move the platform 30 units on the X axis in 5 seconds, accelerating for 0.1 seconds and decelerating for 0.2 seconds; you can change these number to best suit your needs; only restriction is that acceleration+deceleration wait 5; //waits for 5 seconds
 self moveX(-30, 5, 0.1, 0.2); //this will move the platform 30 units in the other direction on the same X axis, so the platform will end up in the starting position
 wait 5;
 // you can also use moveY to move the platform on the Y axis (side to side) or moveZ (up - down)
 }
 
 {
 
 
If you are getting a brackets error it pays to:-
a) count the open brackets, count the close brackets and make sure they match up.
b) indent your code so you can match the pairs.

The last bracket is an open bracket and must be a close bracket in your above code.

Try this:

Code: Select all

 
main()
 {
 platform = getEnt("platform","targetname");
 platform thread moveit();
 }
 
 moveit()
 {
    while(1)
    {
    self moveX(30, 5, 0.1, 0.2); //this will move the platform 30 units on the X axis in 5 seconds
    self moveX(-30, 5, 0.1, 0.2); //this will move the platform 30 units in the other direction back to start
    wait 5;   
    self moveY(30, 5, 0.1, 0.2); //this will move the platform 30 units on the Y axis in 5 seconds
    self moveY(-30, 5, 0.1, 0.2); //this will move the platform 30 units in the other direction back to start
    wait 5;   
    self moveZ(30, 5, 0.1, 0.2); //this will move the platform 30 units on the X axis in 5 seconds
    self moveZ(-30, 5, 0.1, 0.2); //this will move the platform 30 units in the other direction back to start
    wait 5; 
    }
 } 
That should move back and forth on the x axis, y axis and z axis. You'll obviously need to adjust it and configure it to how you need.
thanks i try that now. well after ive compiled the map like the 300th time.lol

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests