spawn barbs within culture borders.

In the DLL, you want to edit CvGame::createBarbarianUnits()

And this is the line you probably want to edit.

pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_BARBARIAN_STARTING_DISTANCE"));
 
hi,

thank you,

any idea what should be instead of that?

ok i located this - "RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE",

i guess this tells the barbs where to spawn - is the a line names something like randplot_inside culture border? and maybe - sea plot?

*****

ok i found in the map that there are these flags:

RANDPLOT_NOT_CITY
RANDPLOT_NOT_VISIBLE_TO_CIV
RANDPLOT_PASSIBLE
RANDPLOT_ADJACENT_LAND
RANDPLOT_ADJACENT_UNOWNED
RANDPLOT_UNOWNED
RANDPLOT_LAND

the 3 bolds, are the current spawn order as i understand,

maybe a new flag of the map can be defined? rand_plotowned_land?
that says owned players land?

***
well im tring some stuff - ive only put this - RANDPLOT_NOT_CITY in the pPlot = GC.getMapINLINE().syncRandPlot, lets see what happens.
 
If you just remove that without adding other restrictions, then the barb can spawn directly on the city itself and capture it the moment it is spawned
 
I guess so, but again it can spawn
1) directly on your workers and capture them
2) spawn on peaks and oceans or stuck in ice
 
I guess so, but again it can spawn
1) directly on your workers and capture them

That would be easy enough to fix. Just do a check on the plot for VisibleEnemyUnit before the plot gets marked as a valid spawn spot.

2) spawn on peaks and oceans or stuck in ice

Yeah. I would leave the RANDPLOT_PASSIBLE check in place.
 
That would be easy enough to fix. Just do a check on the plot for VisibleEnemyUnit before the plot gets marked as a valid spawn spot.

interesting,

can you explain?

do i need a new flag that act the same as the rand stuff about but just one that checks for enemy visibility?

i tired to do something like that and failed - i know i need to add those into
cvgame.cpp+h and aidefines.h (with this one i got messed up :) )

could you help by telling me what to write there?

thanks anyway for all the help here so far.
 
do i need a new flag that act the same as the rand stuff about but just one that checks for enemy visibility?

i tired to do something like that and failed - i know i need to add those into
cvgame.cpp+h and aidefines.h (with this one i got messed up :) )

Actually, now that I dig into the code, it looks like it already discounts occupied tiles as spawn locations. In CvMap::syncRandPlot, the very first section:

Code:
		if ((iArea == -1) || (pTestPlot->getArea() == iArea))
		{
			bValid = true;

			if (bValid)
			{
				if (iMinUnitDistance != -1)
				{
					for (iDX = -(iMinUnitDistance); iDX <= iMinUnitDistance; iDX++)
					{
						for (iDY = -(iMinUnitDistance); iDY <= iMinUnitDistance; iDY++)
						{
							pLoopPlot	= plotXY(pTestPlot->getX_INLINE(), pTestPlot->getY_INLINE(), iDX, iDY);

							if (pLoopPlot != NULL)
							{
[COLOR="RoyalBlue"][B]								if (pLoopPlot->isUnit())
								{
									bValid = false;
								}[/B][/COLOR]
							}
						}
					}
				}
			}
 
Back
Top Bottom