API request - expose industry founder to gamescript.
Moderator: OpenTTD Developers
API request - expose industry founder to gamescript.
It would be useful, for a competitive game script, to know which company founded an industry. This information is already known to OpenTTD - it's industry var A7.
Re: API request - expose industry founder to gamescript.
Technically it's not known to OpenTTD. The founder information is incorrect when companies close and restart. But NewGRF never bothered about that.
Edit: Nevermind, it is actually updated on bankrupt or takeover.
Edit: Nevermind, it is actually updated on bankrupt or takeover.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: API request - expose industry founder to gamescript.
That's handy.frosch wrote:Edit: Nevermind, it is actually updated on bankrupt or takeover.

In any case, I was planning to check the founder only at the moment the industry was created, and handle companies closing down explicitly elsewhere.
Re: API request - expose industry founder to gamescript.
Afaik there is no way to query the founder of an industry for a user, so when buying a company, I may become founder of an industry, but I have no way to find out if so, or which one(s).
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: API request - expose industry founder to gamescript.
Unless the GS tells you, of course.Alberth wrote:I have no way to find out if so, or which one(s).

Re: API request - expose industry founder to gamescript.
/me grabs the magic bulldozer to delete all those weird industries inherited from a former competitor 

Being a retired OpenTTD developer does not mean I know what I am doing.
Re: API request - expose industry founder to gamescript.
Still, it's not really an issue for what I want to do with it. 
To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.

To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: API request - expose industry founder to gamescript.
I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).PikkaBird wrote:Still, it's not really an issue for what I want to do with it.
To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: API request - expose industry founder to gamescript.
There would be a way to make that more transparent.planetmaker wrote:I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
If the GS keeps a list of the industries founded by a company, it can then publish and update the list in the storybook.
Patch - Let's timetable depot waiting time with the Wait in depot patch.
GameScript - Searching a new way to make your cities growing ? Try the Renewed City Growth GameScript.
My screenshots thread.
GameScript - Searching a new way to make your cities growing ? Try the Renewed City Growth GameScript.
My screenshots thread.
Re: API request - expose industry founder to gamescript.
In case it might be of help for you :PikkaBird wrote: To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.
- You can "guess" who made the industry, to a certain limit. On industry open you can browse all companies money spent (its not a cheap expense and it might also goes into some specific category, see the API expenses/money for details) and check this against the prize of the industrytype that was create.
There's limit, if two industrytype appears at the same time, or when two companies found two industries within the same month, you won't be able to tell what industry was found by whom, but you can still credits both companies have founded an industry. If your aim is only # of founded industries by companies.
- You can also make your GS drives player : player must add a sign at position where to build the indutry, GS read the special sign, remove it and create the industry for the player. So the GS take the hand of player and do build it (using the player money). In this form your GS can gives credit to any company that found industry using the sign trick ; validating owner itself.
GS have access to all signs, as such, any companies can speak with GS thru signs. (that's script communication protocol base to speak with all companies).
Re: API request - expose industry founder to gamescript.
I do know your concern about AI must be do what human can do only ; and cheat issues. But i hardly follow you why any AI should remain blind to that info in this case.planetmaker wrote: I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
Re: API request - expose industry founder to gamescript.
What I pointed out was that a normal player doesn't have this information either at this moment. As such normal players and AIs are the same.krinn wrote:I do know your concern about AI must be do what human can do only ; and cheat issues. But i hardly follow you why any AI should remain blind to that info in this case.planetmaker wrote: I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
If the GS gets this information, it should provide a way for the AI to get the same information that a player gets from the GS.
To be honest, I very much doubt that all GS authors will bother to make a story book page for users about their industries (both bought and inherited), especially if only a few industries are involved for the GS. I have even more doubts that they will also provide that information to the AI, and that an AI will understand such information.
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: API request - expose industry founder to gamescript.
That's a rather NewGRF-specific assumption.krinn wrote:its not a cheap expense

Who is online
Users browsing this forum: No registered users and 9 guests