I think it would be needed to control this one specificly. The AI just spawns it like hell-I guess cause it's very strong and changing to a maxnumber in unitclasses won't work for the Barbarian I tested that.TheLopez said:Hmmm... I believe you can control the amount of animals created through the GlobalDefines.XML file.
Ploeperpengel said:I think it would be needed to control this one specificly. The AI just spawns it like hell-I guess cause it's very strong and changing to a maxnumber in unitclasses won't work for the Barbarian I tested that.
I reduced str. to 8 but no effect and to make it lower than that I don't want- it should be dangerous to Frigates.
How far is the progress of this very good idea?TheLopez said:Give me a day or so to take a look at the source code and see what I can do about it. What I'll probably do is have some new methods available through python to control the amount of sea animals that are spawned. I focus on sea animals because on the typical map there is more water plots than land plots.
Does that sound ok to you?
Jeckel said:Sweet, somthing to look forward to this week.
jenks said:how does this function?
it allows you to set the chance of animal water units being spawned, right ?
but can it allow a definable number of units to be spawned, or does it just have a % chance that a bunch of units appear on each turn (as before) ? if not is this possible ?
TheLopez said:It allows you to set the chance that water animals will be spawned.
for(pLoopArea = GC.getMapINLINE().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMapINLINE().nextArea(&iLoop))
{
// < Water Animals Start >
//if (!(pLoopArea->isWater()))
//{
if( pLoopArea->isWater() )
{
iValue = (1 + getSorenRandNum(100, "Water Animal Spawn Check"));
if(iValue > getWaterAnimalSpawnChance())
{
continue;
}
}
iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal()) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));
if (iNeededAnimals > 0)
{
...
int iDivisor;
...
// < Water Animals Start >
if (pLoopArea->isWater())
{
iDivisor = GC.getHandicapInfo(getHandicapType()).getUnownedWaterTilesPerBarbarianUnit();
}
else
{
iDivisor = GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal();
}
if (iDivisor > 0)
{
iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / iDivisor) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));
//if (!(pLoopArea->isWater()))
//{
// iNeededAnimals = ((pLoopArea->getNumUnownedTiles() / GC.getHandicapInfo(getHandicapType()).getUnownedTilesPerGameAnimal()) - pLoopArea->getUnitsPerPlayer(BARBARIAN_PLAYER));
// < Water Animals End >
if (iNeededAnimals > 0)
{
iNeededAnimals = ((iNeededAnimals / 5) + 1);
for (iI = 0; iI < iNeededAnimals; iI++)
{
pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));
pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));
I disagree, but I am getting ahead of myself.MatzeHH said:Hi!
There is a little logical error in your concept of the animal spawn chance.
The loop you posted above will pass your if-clause in e.g. 25% of all cases.
That number is correct, since there is more water than land then logically there should be more marine animals...MatzeHH said:But in these remaining 25% iNeededAnimals is calculated as before and the same number of animals are created.
This value is calculated by some others values, including getUnownedTilesPerGameAnimal(). This is a value from CIV4HandicapInfo.xml and is something between 20 and 100 depending on the handicap.
Since a water area is normally much bigger than a land area, the value for iNeededAnimals gets very high and ~80 animals are created.
But we want animals to spawn anywhere there is water, not just in coastal tiles...MatzeHH said:If you want you can also modify the last line to:
Code:pPlot = GC.getMapINLINE().syncRandPlot((RANDPLOT_NOT_VISIBLE_TO_CIV | RANDPLOT_ADJACENT_LAND | RANDPLOT_PASSIBLE), pLoopArea->getID(), GC.getDefineINT("MIN_ANIMAL_STARTING_DISTANCE"));
Then, water animals will only spawn on coastal tiles.
This way, you don't need a value for the spawn chance and the number of water animals is also depending on the handicap.
TheLopez said:I understand that right now there is only the evil kraken to contend with but I am working with someone to create more water animals.
TheLopez said:That number is correct, since there is more water than land then logically there should be more marine animals...
But we want animals to spawn anywhere there is water, not just in coastal tiles...