Page 2 of 2

Re: New AI writer needs a little help.

Posted: 15 Aug 2009 13:36
by Dezmond_snz
Sorry for asking (possibly) stupid question but how my AI can get value of some game setting?
AIController.GetSetting(str) is for AI setting only?

(edit)
Oh, found it... AIGameSetting :oops: Sorry again.

Re: New AI writer needs a little help.

Posted: 15 Aug 2009 14:11
by Xander
hehe - no worries :)

Also don't forget that some of those values are indexed like subsidy value which can be a little confusing when you're expecting something like "4" but are getting "3" :)

Re: New AI writer needs a little help.

Posted: 16 Aug 2009 09:11
by Dezmond_snz
And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?

Re: New AI writer needs a little help.

Posted: 16 Aug 2009 09:38
by Yexo
Dezmond_snz wrote:And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?
Two requirements:
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");

Re: New AI writer needs a little help.

Posted: 16 Aug 2009 16:05
by Dezmond_snz
Yexo wrote:
Dezmond_snz wrote:And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?
Two requirements:
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");
Thanks.

Can town and industry have same Ids or Id is unique for all objects in game? (e.g. townId=1 and industryId=1 at same game)

Re: New AI writer needs a little help.

Posted: 16 Aug 2009 16:20
by Dustin
Dezmond_snz wrote:
Yexo wrote:
Dezmond_snz wrote:And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?
Two requirements:
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");
Thanks.

Can town and industry have same Ids or Id is unique for all objects in game? (e.g. townId=1 and industryId=1 at same game)

They can and will. Not only that, the ID's get recycled. So Industry 1 might close and later another industry would turn up with the same ID.

Re: New AI writer needs a little help.

Posted: 17 Aug 2009 10:20
by Yexo