Jump to content
Sign in to follow this  
169th_Ice

CYCLE WAYPOINT

Recommended Posts

Is there a way to make only some waypoints CYCLE ?

For example Vehicle Group moves to WAYPOINT 3. But only cycles from Waypoints 3 to 5. Never goes back to waypoints 1 and 2.

Share this post


Link to post
Share on other sites

Sure

One way is to have a script called at waypoint 3 that sends the unit back and forth from then on.

I don't have time to show you one right now - gtg

Good luck

Share this post


Link to post
Share on other sites

At waypoint #3 set a triger to activate a script that sends the unit to waypoint#4 .. at wp#4 set another triger with a script to send it back to wp#3

somthing like the DoMove command or simlar .. fraid my scriptings total pants ... wait here , i think clever people are coming ! They will help you biggrin_o.gif

Share this post


Link to post
Share on other sites

I haven't had a chance to to try this at home so I can't guarantee it will work but this should work and it will make the group cycle between waypoints 5 and 4.

1. Firstly you'll need to define a new waypoint 6 that you place next to or superimpose over waypoint 4 ie. WP6.

2. In the init line of your vehicle that is the leader of the group you'll need to put : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Alpha = group this; where Alpha is the name of the group.

3. Then in notepad or Chris' OFP editor make a file name called init.sqs, save it in the same directory in which you are creating your mission and type in the following lines into this file:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Init.sqs

WP_4 = false;

WP_5 = false;

4.  In the on Activation line of waypoint 5 place the following code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> WP_5 = true; WP_4 = false; []exec "WP.sqs";

5. In the on Activation line of waypoint 6 (which is really WP4) place the following code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WP_5 = false; WP_4 = true; []exec "WP.sqs";

6. Create another file using notepad or Chris' OFp editor called WP.sqs and type in the following code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;WP.sqs

_group = Alpha

?(WP_5): Goto "RETURNWP4"

?(WP_4): Goto "RETURNWP5"

exit

"RETURNWP4"

_group AddWayPoint [getWPPos [_group, 6]]

exit

"RETURNWP5"

_group AddWayPoint [getWPPos [_group, 5]]

exit

I'll try it when i get home tonight and double check if it works if you have any luck with it please let me know.

Share this post


Link to post
Share on other sites

Thanks for the Reply. I cant seem to get it to work however.

Here is my example/Test Mission or template.

Share this post


Link to post
Share on other sites

I won't be able to check this until a little later tonight my time in about 3 or 4 hours as I'm currently at work.  One thing I did notice in your mission file is that the names you are giving your waypoints ie WP_5 and WP_6 may be conflicting with the variables you are defining in your init.sqs file which have the same name.  So to start with try changing the way you are naming your waypoints ie. remove the underscore so that they look like this WP1, WP2, WP3, WP4, WP5 and WP6 and this may fix the problem.

Share this post


Link to post
Share on other sites

Wowowow - so what's the problem here?

No need for any scripting commands if you want a group

only to cycle through a few waypoints. wow_o.gif

:note - a cycle waypoint makes a group start again from

the waypoint closest to itself.

wp1 - move

wp2 - move

wp3 - move

wp4 - move

wp5 - cycle (close to wp3)

Will make the group start again at wp3.

Now if you want to break to cycle on a certain condition,

you need to syncronise the cycle waypoint with a trigger

type SWITCH.

A trigger type SWITCH makes a group continue with the

waypoint which is after the waypoint it is syncronised with.

:note - it doesn't need to be the cycle waypoint btw - SWITCH makes a group continue wherever in the waypoint

order you want.

This means you can set up different sets of waypoints being

activated by switch triggers.

~S~ CD

Share this post


Link to post
Share on other sites

Well there you go. Chris Death thank you.

Norrin, loks like we both learn something. icon_rolleyes.gif

Share this post


Link to post
Share on other sites

Lol, there is always a much easier way. You're right Ice I'm feeling suitably embarassed, sorry to have wasted your time and to have over complicated matters unnecesarily.  

Looking back through that script I gave you now I've got more time there's a pretty gaping syntax error anyway (ie. the sub-routines should start with #RETURNWP4 and #RETURNWP5 and not be in quotes) and if it did work without more code added it most likely would've only cycled the 2 waypoints once anyway.  If nothing else it did spur someone more in the know to correct me though.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×