Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.
Moderator: OpenTTD Developers
Dezmond_snz
Engineer
Posts: 58 Joined: 19 Apr 2009 11:50
Post
by Dezmond_snz » 15 Aug 2009 13:36
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.
Ru ss ia
Xander
Route Supervisor
Posts: 485 Joined: 18 May 2007 12:47
Location: Oxford
Contact:
Post
by Xander » 15 Aug 2009 14:11
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"
Dezmond_snz
Engineer
Posts: 58 Joined: 19 Apr 2009 11:50
Post
by Dezmond_snz » 16 Aug 2009 09:11
And new one: how can AI check if building tree at tile will affect rating of needed town? Will AITile.GetClosestTown(...) show that?
Ru ss ia
Yexo
Tycoon
Posts: 3663 Joined: 20 Dec 2007 12:49
Post
by Yexo » 16 Aug 2009 09:38
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");
Dezmond_snz
Engineer
Posts: 58 Joined: 19 Apr 2009 11:50
Post
by Dezmond_snz » 16 Aug 2009 16:05
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)
Ru ss ia
Dustin
Transport Coordinator
Posts: 272 Joined: 07 Dec 2005 19:22
Post
by Dustin » 16 Aug 2009 16:20
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.
Yexo
Tycoon
Posts: 3663 Joined: 20 Dec 2007 12:49
Post
by Yexo » 17 Aug 2009 10:20
Users browsing this forum: No registered users and 1 guest