Jump to content

Scripting a platform to move to ref_tag


Recommended Posts

Hello peeps, I've ran into a scripting area that I'm not really familiar with. Basically what I'm trying to do, is when a button is pressed so that a platform can move from it's starting point to first ref_tag, second ref_tag etc. until the last ref_tag.
And after few seconds it would return back the same path following these reference_tags. I made a script myself but, something seems left out of a loop. My platform just makes a noise and doesn't move.

 

 
affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{
wait ( 1000.000 );
move ( $tag( "tram1", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
move ( $tag( "tram2", ORIGIN)$, < 0.000 0.000 0.000 >, 7000.000 );
wait ( 6900.000 );
move ( $tag( "tram3", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
move ( $tag( "tram4", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
}
 
wait ( 3000.000 );
 
affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{
move ( $tag( "tram3", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
move ( $tag( "tram2", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
move ( $tag( "tram1", ORIGIN)$, < 0.000 0.000 0.000 >, 7000.000 );
wait ( 6900.000 );
move ( $tag( "tram_start", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
wait ( 4900.000 );
}
Link to comment

What's the platform? Does it have a script_targetname? 

 

                               This is the platform                                                                            This is the switch                                                                          

 

2zoadyh.jpg 2py3sdv.jpg 

 

                                                                                                                This is the script

                         

 

                                                                                  15nu2yo.jpg     

Link to comment

                               This is the platform                                                                            This is the switch                                                                          

 

2zoadyh.jpg 2py3sdv.jpg

 

                                                                                                                This is the script

                         

 

                                                                                  15nu2yo.jpg     

 

Is the script directory okay? Is it on the scripts folder or a subfolder you haven't named on the target_scriptrunner entity? 

 

When I try to move something I don't really write it like that, but like this:


affect ( "portcullis01", FLUSH )
{

	task ( "move01" )
	{
		move ( $tag( "movehere01", ORIGIN)$, 3000.000 );
	}

	do ( "move01" );
	wait ( "move01" );
}


Link to comment

 

Is the script directory okay? Is it on the scripts folder or a subfolder you haven't named on the target_scriptrunner entity? 

 

When I try to move something I don't really write it like that, but like this:


affect ( "portcullis01", FLUSH )
{

	task ( "move01" )
	{
		move ( $tag( "movehere01", ORIGIN)$, 3000.000 );
	}

	do ( "move01" );
	wait ( "move01" );
}


 

No the script doesn't have any subfolder so the path is correct. But the script that you posted, is it supposed to go like this? :


affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{

	task ( "travel01" )
	{
		move ( $tag( "tram1", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}

	do ( "travel01" );
	wait ( "travel01" );
}

affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{

	task ( "travel02" )
	{
		move ( $tag( "tram2", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}

	do ( "travel02" );
	wait ( "travel02" );
}


etc.. 

(Sorry if I don't really follow, scripting is a very new field to me)


Link to comment

 

No the script doesn't have any subfolder so the path is correct. But the script that you posted, is it supposed to go like this? :


affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{

	task ( "travel01" )
	{
		move ( $tag( "tram1", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}

	do ( "travel01" );
	wait ( "travel01" );
}

affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{

	task ( "travel02" )
	{
		move ( $tag( "tram2", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}

	do ( "travel02" );
	wait ( "travel02" );
}


etc.. 

(Sorry if I don't really follow, scripting is a very new field to me)

 

Sorry but I have a hard time explaining this. 

 

You're doing a move [ <vec>, <vec>, <float>] command, while I normally do move [<expr>, <expr>]. I just set an origin tag and a speed value. It's the only thing you've done that's different from what I normally do.

 

If you change this and it doesn't work, I'll do a small .map file with a working moving object for you so you can study it. I haven't done it yet because I don't have time. 

Link to comment

Sorry but I have a hard time explaining this. 

 

You're doing a move [ <vec>, <vec>, <float>] command, while I normally do move [<expr>, <expr>]. I just set an origin tag and a speed value. It's the only thing you've done that's different from what I normally do.

 

If you change this and it doesn't work, I'll do a small .map file with a working moving object for you so you can study it. I haven't done it yet because I don't have time. 

 

I tried with [<expr>,<expr>] as well, still no luck. When I typed developer 1 and pressed the button, the platform moved outside of the map with huge speed, and in the console it said that 9 DEBUGS were fired at the same time, which is strange, it shouldn't have triggered/fired all entities in the script at once.

 

Sure you could do a small .map so I could take a peak whenever you have time to make one, I'll just keep trying in meantime I guess.

Link to comment

UPDATE:

 

Problem is solved! Managed to get it work by help of Maui, looks like this script did the trick!

affect ( "tram", /*@AFFECT_TYPE*/ FLUSH )
{

	task ( "ride0" )
	{
		move ( $tag( "ride0", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}


	task ( "ride1" )
	{
		move ( $tag( "ride1", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}


	task ( "ride2" )
	{
		move ( $tag( "ride2", ORIGIN)$, < 0.000 0.000 0.000 >, 7000.000 );
	}


	task ( "ride3" )
	{
		move ( $tag( "ride3", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}


	task ( "ride4" )
	{
		move ( $tag( "ride4", ORIGIN)$, < 0.000 0.000 0.000 >, 5000.000 );
	}

	wait ( 3000.000 );
	dowait ( "ride1" );
	dowait ( "ride2" );
	dowait ( "ride3" );
	dowait ( "ride4" );
	dowait ( "ride3" );
	dowait ( "ride2" );
	dowait ( "ride1" );
	dowait ( "ride0" );
}

Noodle likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...