Jump to content
Sign in to follow this  
fabrizio_t

Injecting waypoints

Recommended Posts

Hi again,

i've spent much time in the last few days trying to implement some reliable functionality to "inject" waypoints, so i can dinamically change (definitely or temporarily) the path of AI units when needed.

So far i was able to successfully insert waypoints into a queue, but i have problems with reading / moving existing synchronized waypoints: is there any command giving out the list of synchronized waypoints, given [group, waypoint number]?

Thx.

Share this post


Link to post
Share on other sites

No expert, what about these?

group addWaypoint [center, radius, index]

waypoints group

Essentially its about getting the index done right.

Share this post


Link to post
Share on other sites
No expert, what about these?

group addWaypoint [center, radius, index]

waypoints group

Essentially its about getting the index done right.

Hi kju and thx.

I am missing the third param (index) !

Can you give me a link to check out that syntax ? I was stuck with:

http://community.bistudio.com/wiki/addWaypoint

groupName addWaypoint [center, radius] 

Having the option to set the new waypoint index may do the trick indeed, if the new waypoint won't overwrite any existing one with the same index.

---------- Post added at 07:57 AM ---------- Previous post was at 07:50 AM ----------

Ok, found that alternative syntax in the COMREF, strangely it's not on the BIKI.

So seems i wasted an evening for not having double-checked the info i had ...

Thx again!

Edited by fabrizio_T

Share this post


Link to post
Share on other sites
Hi again,

i've spent much time in the last few days trying to implement some reliable functionality to "inject" waypoints, so i can dinamically change (definitely or temporarily) the path of AI units when needed.

So far i was able to successfully insert waypoints into a queue, but i have problems with reading / moving existing synchronized waypoints: is there any command giving out the list of synchronized waypoints, given [group, waypoint number]?

Thx.

Here's a script I've been working on from a thread I started a few days. I hope it provides some enlightenment :)

If you have any questions for me, feel free, but know that I'm a beginner with scripting myself.

//////////////////Random Waypoint System/////////////////////

///////Implementation example: nul = [this, escort, getaway] execVM "RandomWaypoint.sqf";

_posnum = round (random 2); 

_unit = _this select 0;
_group1 = group leader _unit;
_unit2 = _this select 1;
_group2 = group leader _unit2;
_unit3 = _this select 2;
_group3 = group leader _unit3;

/////////////////////////////////////////////////////////////////
///////////////////ESCORT MOVES//////////////////////////////////
_wp1 = _group2 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group2, 1] setWaypointtype "LEADER";
_group2 SetCurrentWaypoint [_group2, 1];

_wp2 = _group2 AddWaypoint[GetMarkerPos "WP2", 0];
[_group2, 2] setWaypointtype "GETIN";
_group2 SetCurrentWaypoint [_group2, 1];


/////////////////////////////////////////////////////////////////
///////////////////CHOPPER MOVES/////////////////////////////////
_wp1 = _group3 AddWaypoint[GetMarkerPos "WP2", 0];
[_group3, 1] SetWaypointtype "LOAD";
_group3 SetCurrentWaypoint [_group3, 1];
/////////////////////////////////////////////////////////////////

[_group2, 1] synchronizeWaypoint [[_group3, 1]];

hint format["%1 ",_posnum];

sleep 2;
if (_posnum == 0) then 
{
_wp1 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 1] setWaypointType "MOVE";	

_wp2 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 2] SetWaypointType "GETIN NEAREST";
//wp1 SetWaypointTimeout[60, 120, 180];

_wp3 = _group1 AddWaypoint[GetMarkerPos "StarySoborWP", 0];
[_group1, 3] SetWaypointType"MOVE";

_wp4 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 4] SetWaypointType "GETOUT";

_wp5 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 5] SetWaypointType"JOIN";

_group1 setCurrentWaypoint [_group1, 1];


}

else { 	

if (_posnum == 1) then {

_wp1 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 1] setWaypointType "MOVE";	

_wp2 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 2] setWaypointType "GETIN NEAREST";
//wp1 SetWaypointTimeout[60, 120, 180];

_wp3 = _group1 AddWaypoint[GetMarkerPos "PolanaWP", 0];
[_group1, 3] SetWaypointType"MOVE";

_wp4 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 4] SetWaypointType "GETOUT";

_wp5 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 5] SetWaypointType"JOIN";

_group1 setCurrentWaypoint [_group1, 1];


}

else {

if (_posnum == 2) then {
_wp1 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 1] setWaypointType "MOVE";	

_wp2 = _group1 addWaypoint[GetMarkerPos "GO", 0];
[_group1, 2] setWaypointType "GETIN NEAREST";
//wp1 SetWaypointTimeout[60, 120, 180];

_wp3 = _group1 AddWaypoint[GetMarkerPos "SolWP", 0];
[_group1, 3] SetWaypointType"MOVE";

_wp4 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 4] SetWaypointType "GETOUT";

_wp5 = _group1 AddWaypoint[GetMarkerPos "Joinup", 0];
[_group1, 5] SetWaypointType"JOIN";

_group1 setCurrentWaypoint [_group1, 1];

}
}
};

[_group1, 5] synchronizeWaypoint [[_group2, 1]];

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  

×