Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game Script: method to change company rating in town #6381

Closed
DorpsGek opened this issue Oct 21, 2015 · 9 comments
Closed

Game Script: method to change company rating in town #6381

DorpsGek opened this issue Oct 21, 2015 · 9 comments
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) enhancement Issue would be a good enhancement; we accept Pull Requests! flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) stale Stale issues

Comments

@DorpsGek
Copy link
Member

dp opened the ticket and wrote:

GSTown.SetRating(town_id, company_id, rating) method as a complement for GetRating. Changes local authority rating of company in town to one of predefined values. Can only be executed as deity.

Will be useful in situations where local authority doesn't work well with gameplay like in claimed city in citybuilder. Also will allow GS to freely build stuff as a company, for example, destroy houses to shape up city.

Attachments

Reported version: 1.5.2
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6381
@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 2, 2017

andythenorth wrote:

Applied fine to r27908.

Set up a test 64x64 map with just two towns. Using the provided test GS (appears as "MinimalGS" in list), both towns alternate ratings between "Outstanding" and "Appalling". As expected.

IMHO, this is a useful feature in GS.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6381#comment14719

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Goal/Game script labels Apr 7, 2018
@andythenorth
Copy link
Contributor

Would be a good pull request, now we're on github.

@frosch123 frosch123 added component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) and removed Goal/Game script labels Apr 14, 2018
@Alberth289346
Copy link
Contributor

It looks reasonable, but what effect do you expect with the command? The mechanism of updating the rating is still there, and it will change the rating back to however you behave in the town.
If you take out complete city-blocks, the rating will again drop, for example.

The deeper issue is thus, who controls future changes in the rating, the script or the game? If the script, would "indefinitely" be a good choice? I would tend to see these forced changes as temporary, much like an advertising campaign.

Also, this patch adds a company to having a rating, wouldn't it also need a way to undo this, giving a company a blank sheet in a town?

@nielsmh
Copy link
Contributor

nielsmh commented Jun 25, 2018

I would suggest three additional methods:

  • ClearTownRating - resets a town rating to not know about a company at all.
  • LockTownRating - sets a "prevent town rating modification by normal game rules" flag, this should probably be per town/company so a GS can also forcibly lock out a company from a town. When this is set it would also prevent a company from executing certain town actions.
  • GetTownRatingLocked - gets the above flag.

@Alberth289346
Copy link
Contributor

You seem to be missing "UnlockTownRating", ie revert to the normal situation where the comapny is known, and should take out city blocks if it wants to keep its reputation.

For locking, I'd prefer a number of days as parameter of the lock at least, so it's not indefinitely in case of a script crash or so. It's simple enough to loop every X days to re-inforce the lock.

@nielsmh
Copy link
Contributor

nielsmh commented Jun 25, 2018

I intended LockTownRating to take a boolean whether to lock or unlock, but a days counter might be safer, in that case you can just set the lock timer to 0 days to unlock.

@James103
Copy link
Contributor

James103 commented Jul 4, 2018

How about being able to pass a special value (-1 = Infinity) into GSTown.LockTownRating to lock the town rating until either the script unlocks the town rating via another GSTown.LockTownRating call, or the script crashes?

@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. Since OpenTTD moved to GitHub, we use pull requests rather than patches, as they are a much more productive workflow.

I'm planning to close this soon (in 7 days), as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun.

If you would like to continue with this patch, the best way would be to move the patch to your own GitHub fork, update it for the current OpenTTD master, and then create a pull request. For more information, please see our CONTRIBUTING.md.

We are also happy to discuss directly on the issue, or in #openttd irc, including help to get this into a pull request. Thanks for your contribution!

@stale
Copy link

stale bot commented Mar 6, 2019

This issue has been automatically marked as stale because it has not had any activity in the last two months.
If you believe the issue is still relevant, please test on the latest nightly and report back.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale Stale issues label Mar 6, 2019
@stale stale bot closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) enhancement Issue would be a good enhancement; we accept Pull Requests! flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) stale Stale issues
Projects
None yet
Development

No branches or pull requests

6 participants