Does AI have access to setting autorenew options for its company?
The option whether autorenew or not, and the options for min money and min. age of vehicle. While AI can periodically watch vehicle list and just send old vehicles to depot so they can get cloned and scrapped quite easily, the renew is better, as renewed vehicle keeps its current cargo and history of profits. Also, it means less code in the AI :)
AIController have only GetSetting, but no SetSettings... while most client-side settings do not make sense for AI (like whether something is shown in toolbar or not), the autorenew settings does make sense.
AI and autorenew?
Moderator: OpenTTD Developers
AI and autorenew?
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: AI and autorenew?
Yes, the functions you want are in AICompany. Note the AIController::GetSetting returns an AI setting, not a game setting. Those can be queried by AIGameSetting
Re: AI and autorenew?
I actually encountered quite a few problems with using the auto renew option in AIs:
- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
What I've done now, is to have an order list like this:
1: Load / Unload Cargo
2: Move to some waypoint / or service in depot when needed, etc.
3: Load / Unload Cargo
4: If age >= max age goto 6
5: goto 1
6: Go to depot and stop
Then every now and then check all vehicle in depots and if they're over age do a replace function otherwise just sell them.
That should do the trick and solve all problems
.
- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
What I've done now, is to have an order list like this:
1: Load / Unload Cargo
2: Move to some waypoint / or service in depot when needed, etc.
3: Load / Unload Cargo
4: If age >= max age goto 6
5: goto 1
6: Go to depot and stop
Then every now and then check all vehicle in depots and if they're over age do a replace function otherwise just sell them.
That should do the trick and solve all problems

Re: AI and autorenew?
The first is a problem also for human players, not with the NoAI code. The second is intended.Morloth wrote:- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
They are available in AIGroup.I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
Re: AI and autorenew?
I've ever tried using AIGroup functions, it can autoreplace vehicles only if the new engine(vehicle) can goto station/depot order same as the old vehicle one. (the error said something like "Auto replace failed, the new vehicle can't goto one of your destination order")Yexo wrote:The first is a problem also for human players, not with the NoAI code. The second is intended.Morloth wrote:- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
They are available in AIGroup.I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
Re: AI and autorenew?
Am I right when you're saying you can't replace normal rail trains with monorail trains? That's intended, it's the same as for humans.fanioz wrote:I've ever tried using AIGroup functions, it can autoreplace vehicles only if the new engine(vehicle) can goto station/depot order same as the old vehicle one. (the error said something like "Auto replace failed, the new vehicle can't goto one of your destination order")
Re: AI and autorenew?
SimiliarlyYexo wrote:Am I right when you're saying you can't replace normal rail trains with monorail trains?

And u're right :
Yexo wrote: That's intended, it's the same as for humans.
Who is online
Users browsing this forum: No registered users and 9 guests