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: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

City Founder Gamescript

Post by agentw4b » 12 Mar 2018 17:59

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:
http://binaries.openttd.org/bananas/gam ... S-2.tar.gz

Or downloading it here:
City_Founder_GS-2.tar.gz
(10.47 KiB) Downloaded 133 times

City_Founder_GS.png
City_Founder_GS.png (8.87 KiB) Viewed 2818 times
This is my first gamescript
--------------------------------------------------------------------------------------------------

Changelog.txt:
--------------------------------------------------------------------------------------------------
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 31 Mar 2018 09:03, edited 9 times in total.
Owner and admin of servers:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b » 12 Mar 2018 20:04

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

dol422
Engineer
Engineer
Posts: 114
Joined: 29 Dec 2015 20:06
Location: Scunthorpe

Re: City Founder Gamescript

Post by dol422 » 30 Mar 2018 20:34

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
Lambrini and coke is the way to go
I think I may need a mental institution
Take a look at: http://www.tt-forums.net/viewtopic.php?f=47&t=74993

agentw4b
Traffic Manager
Traffic Manager
Posts: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b » 31 Mar 2018 06:24

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b » 31 Mar 2018 07:15

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: City Founder Gamescript

Post by agentw4b » 31 Mar 2018 08:17

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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 4 guests