New AI writer needs a little help.
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 58
- Joined: 19 Apr 2009 11:50
Re: New AI writer needs a little help.
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 Sorry again.
AIController.GetSetting(str) is for AI setting only?
(edit)
Oh, found it... AIGameSetting Sorry again.
Russia
Re: New AI writer needs a little help.
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"
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"
-
- Engineer
- Posts: 58
- Joined: 19 Apr 2009 11:50
Re: New AI writer needs a little help.
And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?
Russia
Re: New AI writer needs a little help.
Two requirements: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?
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");
-
- Engineer
- Posts: 58
- Joined: 19 Apr 2009 11:50
Re: New AI writer needs a little help.
Thanks.Yexo wrote:Two requirements: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?
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");
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)
Russia
Re: New AI writer needs a little help.
Dezmond_snz wrote:Thanks.Yexo wrote:Two requirements: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?
needed_town == AITile.GetClosestTown(tile);
AIMap.DistanceManhattan(tile, AITown.GetLocation(needed_town)) < AIGameSettings.GetValue("economy.dist_local_authority");
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.
Who is online
Users browsing this forum: No registered users and 2 guests