commanderx 17 Posted January 13, 2015 Hi, I use DAC to create AI. I would like to give all AI Units randomly created waypoints which are only on roads. Any suggestion how to achieve that? Best regards Kai Share this post Link to post Share on other sites
shuko 59 Posted January 13, 2015 There's probably a better way nowadays, but if nothing shows up, you could try this: http://forums.bistudio.com/showthread.php?162695-SHK_pos Example: http://shuko.kapsi.fi/arma3/scripts/SHK_pos/img/road_position.jpg (317 kB) Share this post Link to post Share on other sites
commanderx 17 Posted January 13, 2015 I am probably too stupid to use that script. Don´t have a clue how to put in the variables?? Share this post Link to post Share on other sites
commanderx 17 Posted January 13, 2015 Would be better to ask your question here http://forums.bistudio.com/showthread.php?72059-The-all-new-Ask-a-moderator-about-the-forum-amp-rules instead of hijacking my thread :D Good luck! Share this post Link to post Share on other sites
dreadedentity 278 Posted January 13, 2015 nearRoads Share this post Link to post Share on other sites
commanderx 17 Posted January 13, 2015 Got it, thank you :-) _marker = getmarkerpos "marker"; _list = _marker nearRoads 10500; //_mcount = 1; /*{ _pos = getpos _x; _Xpos = _pos select 0; _Ypos = _pos select 1; m_name = format["name%1",_mcount]; _markerstr = createMarker [m_name,[_Xpos,_Ypos]]; _markerstr setMarkerShape "ICON"; _markerstr setMarkerType "hd_dot"; //sleep 2; //silenthint format ["%1 Strassen gefunden",m_name ]; _mcount = _mcount + 1;} forEach _list; */ hintSilent format ["%1 Strassen gefunden",_list ]; _count = 1; while {_count < 50} do { _road = _list call BIS_fnc_selectRandom; _posroad = getPos _road; _Xpos = _posroad select 0; _Ypos = _posroad select 1; m_name = format["name%1",_count]; _markerstr = createMarker [m_name,[_Xpos,_Ypos]]; _markerstr setMarkerShape "ICON"; _markerstr setMarkerType "hd_dot"; _count = _count +1; }; Share this post Link to post Share on other sites
ArmaMan360 94 Posted November 14, 2015 I am unable to adapt the above code in my convoy mission. spawnconvoy.sqf (and give them random destination far off with 5 + random 3 way points only being on roads and then cycle back to the first waypoint): _sidepos = getMarkerPos "m1"; // Spawn enemy officer _grp = createGroup west; _vehlist = ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F", "B_APC_Wheeled_01_cannon_F"]; _trklist = ["B_Truck_01_box_F", "rhsusf_m998_w_2dr", "B_G_Van_01_transport_F"]; sleep 0.5; _newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos; _vehtype = (count _vehlist )-1; _type = _vehlist select (round random _vehtype); _vehicle1 = [_newpos, 0, _type, _grp] call BIS_fnc_spawnvehicle; sleep 1.5; _newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos; _trktype = (count _trklist )-1; _type2 = _trklist select (round random _trktype); _vehicle2 = [_newpos, 0, _type2, _grp] call BIS_fnc_spawnvehicle; sleep 1.5; _newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos; _trktype = (count _trklist )-1; _type2 = _trklist select (round random _trktype); _vehicle3 = [_newpos, 0, _type2, _grp] call BIS_fnc_spawnvehicle; sleep 1.5; _newPos = [_sidepos, 0, 25, 1, 0, 200, 0, []] call BIS_fnc_findSafePos; _vehtype = (count _vehlist )-1; _type = _vehlist select (round random _vehtype); _vehicle4 = [_newpos, 0, _type, _grp] call BIS_fnc_spawnvehicle; sleep 1.5; _list = _sidepos nearRoads 500; _count = 1; while {_count < 10} do { _road = _list call BIS_fnc_selectRandom; _posroad = getPos _road; _count = _count +1; }; for "_i" from 0 to (5 + (floor (random 3))) do { _wp = _grp addWaypoint [(count _posroad) -1, 0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "LIMITED"; _wp setWaypointBehaviour "SAFE"; _wp setWaypointFormation "COLUMN";//"STAG COLUMN" sleep 3; _wp = _grp addWaypoint [_sidepos, 0]; _wp setWaypointType "CYCLE"; _wp setWaypointCompletionRadius 20; true; }; Please correct me. Share this post Link to post Share on other sites
Joe98 92 Posted November 16, 2015 Considering your convoy is on a road, what do you mean by a random waypoint? If the road is 5,000 meters long then the random waypoints would fall where? It seems to me the waypoints would all be somewhere on the 5,000 meters. . Share this post Link to post Share on other sites