City Founder Gamescript

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

Post Reply
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

City Founder Gamescript

Post by agentw4b »

This new gamescript creates new cities.
You can change the number of cities, the speed of city establishing, the size of cities and the shape of roads in the city.

Downloading last version from official Bananas server via game GUI.


Or downloading it here:
City_Founder_GS-3.tar.gz
(10.66 KiB) Downloaded 228 times




This is my first gamescript
--------------------------------------------------------------------------------------------------

Changelog.txt:
--------------------------------------------------------------------------------------------------
Version 3:
- Feature: Extracting existing cities to the script log is also performed when the game is loaded. Previously, this was only done at the start of the game.
- Fixed bug: If the list of city names does not offer next city name, script is now finished.

Version 2:
- Fixed bug: Blocked "Log" feature from Superlib library, occurring when saving game.
- Fixed info in Readme.txt
- Added URL in info.nut

Version 1:
- Initial release

---------------------------------------------------------------------------------------------------

Parameters:
---------------------------------------------------------------------------------------------------

- This gamescript will end
(on/off, developer only)

- Logging
(on/off, default on)

- Logging level :
1: Small (default)
2: Medium
3: Large

- How many cities do you want to add ?
(1 - 100000, default 200, not configurable in running game)

- How many days to wait for a new city to be established ?
(1-36500, default 15)

- City size :
1: Random (default)
2: Small
3: Medium
4: Large

- Road Layout
1: Random (default)
2: Original
3: Better Roads
4: 2x2
5: 3x3

- City
1: Random (default)
2: Yes
3: No

- The probability that the village will turn into a city (%)
(1 - 100, default 50)

- Viewport of the new city
(on/off, default off)

- Should a welcome message appear for new companies ?
(on/off, default on)

----------------------------------------------------------------------------------------------
Last edited by agentw4b on 07 Jun 2020 09:44, edited 13 times in total.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

City_Founder_GS_example.png
(433.24 KiB) Not downloaded yet

To test the script I recommend very few existing cities after start game, at least 1 city.

Openttd.cfg for 1 town:
[difficulty]
number_towns = 4

[game_creation]
custom_town_number = 1
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
dol422
Transport Coordinator
Transport Coordinator
Posts: 310
Joined: 29 Dec 2015 20:06
Location: England

Re: City Founder Gamescript

Post by dol422 »

Nice to see a game script which actually founds towns for you. Turns out to be useful when you start with hardly any towns and want to add more without splurging out money. I actually found a bug when playing with this script. It looks like it doesn't support save/load:
Hawthorn Transport Ltd, 01-01-2019.png
Error: index 'Log' is non-existent
(188.9 KiB) Not downloaded yet
Take a look at: http://www.tt-forums.net/viewtopic.php?f=47&t=74993
Why do it tomorrow when you can do it today
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

dol422 wrote:Nice to see a game script which actually founds towns for you. Turns out to be useful when you start with hardly any towns and want to add more without splurging out money. I actually found a bug when playing with this script. It looks like it doesn't support save/load:Hawthorn Transport Ltd, 01-01-2019.png

I've taken the "save" feature from the MinimalGS project. I did not test it, but I'll look at it.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

This is probably because I blocked unused features before releasing and I mistakenly blocked the Log function from the "Superlib" library.

on line 5 in the main.nut:

"// Log <- SuperLib.Log;"

I will try to unblock it and continue to test it.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

dol422 wrote:Nice to see a game script which actually founds towns for you. Turns out to be useful when you start with hardly any towns and want to add more without splurging out money. I actually found a bug when playing with this script. It looks like it doesn't support save/load:Hawthorn Transport Ltd, 01-01-2019.png
Fixed, Version 2 released
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
graphicnano
Engineer
Engineer
Posts: 6
Joined: 09 Feb 2020 19:12

Re: City Founder Gamescript

Post by graphicnano »

I try this even with 1 city to found, it just makes my game load continuously and letting me not play :(
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

I do not understand your problem. This script is funkcional. I use it.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

Set "Viewport of the new cities?": off .
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b »

Version 3 has been created to fix some bugs. See Changelog.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests