Loading...
 

General


Make multiple bots go to one NavPoint?

Hi there,

I have this code:

Collection navPoints = tabooNavPoints.filter(getWorldView().getAll(NavPoint.class).values());

Iterator itr = navPoints.iterator();
NavPoint target = null;
while(itr.hasNext())
{
NavPoint temp = (NavPoint)itr.next();
String id = temp.getId().getStringId();
if(id.equals("UTCTFRedFlagBase_2")) //The Goal
{
return temp;
}
}

So I iterate through the navpoints, but I've noticed the collection seems to change, it usually have a size of 548, but this goes down. Does anyone know why the navPoint count would go down? Is there a better way to make bots go to a specific navpoint?
> Hi there,
>
> I have this code:
>
> Collection navPoints = tabooNavPoints.filter(getWorldView().getAll(NavPoint.class).values());

The count goes down, because you are using TabooSet and you are filtering through it in the line above. If the set is not empty, all nav points in the TabooSet won't be in the Collection - they will be filtered. Review your code and find places where you are adding NavPoints to TabooSet - those will be your missing navpoints.
Generally it is a good idea to use some kind of TabooSet to prevent bot from periodically picking the same navigation point.
 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.