Jump to content

Home

My script won't loop!


War Master

Recommended Posts

I'm trying to rotate a large cylander 180 degrees and make it stop for 3 seconds and then start up again. I can get it to rotate once but that's it. I've tried many different ways and here is my latest script:

 

//Generated by BehavEd

 

rem ( "Rotate" );

 

affect ( "cylanderRotate", /*@AFFECT_TYPE*/ FLUSH )

{

 

loop ( -1 )

{

 

task ( "spin180" )

{

rotate ( < 0.000 0.000 180.000 >, 5000.000 );

}

 

dowait ( "spin180" );

wait ( 3000.000 );

}

 

}

Link to comment
Share on other sites

I would try moving the TASK statement out of the loop. After all, you really only need to create the task one time, right? That may be what's causing the works to gum up.

 

I could be wrong, but that's the only thing that really jumps out at me as being a little weird with your code.

 

 

Hope this helps

Link to comment
Share on other sites

I've tried so many ways now. On page 8 of the ICARUS manual it gives an example of a looped task:

 

task ( “Go to the door” )

{

commands…

}

 

loop ( 50 )

{

dowait ( “Go to the door”);

}

 

I used this as an example. Now here's what I have now:

 

affect ( "cylinderRotate", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "spin180" )

{

rotate ( < 0.000 0.000 180.000 >, 5000.000 );

}

 

 

loop ( -1 )

{

dowait ( "spin180" );

}

 

}

Link to comment
Share on other sites

ah ok its not too deep

heres a simple script with a loop

 

//Generated by BehavEd

 

rem ( "mouse1" );

set ( /*@SET_TYPES*/ "SET_WEAPON", /*@WEAPON_NAMES*/ "WP_NONE" );

set ( /*@SET_TYPES*/ "SET_WALKING", /*@BOOL_TYPES*/ "true" );

 

task ( "patrol1" )

{

set ( /*@SET_TYPES*/ "SET_NAVGOAL", "mouse1nav1" );

}

 

 

task ( "patrol2" )

{

set ( /*@SET_TYPES*/ "SET_NAVGOAL", "mouse1nav2" );

}

 

 

loop ( -1 )

{

dowait ( "patrol1" );

wait ( 2000.000 );

dowait ( "patrol2" );

wait ( 1000.000 );

}

 

 

so mouse1nav1 is the target name of a waypoint_navgoal

same for number 2

 

the -1 means it is continuous; put a positive number to have it happen that

many times. e.g. a number 3 for it to happen 3 times.

Link to comment
Share on other sites

I don't think I can loop a rotate move. I've tried for a few days now. This is my theory, once the object has been rotated, by a script, it will not rotate again. I tested it out with this script

 

affect ( "cylinderRotate", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "spin1" )

{

rotate ( < 0.000 0.000 180.000 >, 5000.000 );

}

 

 

task ( "spin2" )

{

rotate ( < 0.000 0.000 180.000 >, 5000.000 );

}

 

dowait ( "spin1" );

wait ( 4000.000 );

dowait ( "spin2" );

wait ( 4000.000 );

}

 

It would only spin once. If anyone knows a way around this please help.

Link to comment
Share on other sites

I was completely wrong! Following an example by MilesTeg in another thread, I figured out how to make it rotate the way I want it to. My mistake was that I thought, when looped, it would increment 180 degrees each time. You have to guide it around the whole rotation.

 

I got something to work with, it's behaving a little weird but maybe for the better. It'll go through it's full routine a couple of times then it'll rotate the opposite way. I'm making a complexe generator with this script and I plan to add more stuff to it like beams that go on when it rests for 3 seconds. Try this out to start

 

affect ( "cylinderRotate", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "spin180" )

{

rotate ( < 0.000 0.000 180.000 >, 5000.000 );

wait ( 8000.000 );

rotate ( < 0.000 0.000 360.000 >, 5000.000 );

wait ( 8000.000 );

}

 

 

loop ( -1 )

{

dowait ( "spin180" );

}

 

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...