Scenario Tools - generic GS for generic scenarios

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
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Scenario Tools - generic GS for generic scenarios

Post by jfs »

Ever wanted to have a scenario that does something a bit unusual, but thought it would be too bothersome to write a unique Game Script for it? This is a toolbox for encoding some types of commands/events into a scenario by using signs.

Right now it can found towns and industries at specific dates, and force towns to grow at specific dates. This is mostly for proof of concept, I hope to expand this much more with useful features.

Image


Known bugs/problems:
- Random placement of towns doesn't work
- I'm not sure town growth actions ever stop acting
- Prints red errors in the GS debug window during some of the sign parsing (need to do a pcall or something)
- Will eat signs even during the scenario editor, if you click the Pause or FFwd buttons

This is my first foray into writing GS so any tips and criticism is appreciated. Wishlists are also welcome.
Attachments
scntoolstest.scn
Demo scenario
(12.27 KiB) Downloaded 86 times
ScenarioTools.zip
Proof of concept version of the GS
(14.1 KiB) Downloaded 90 times
Screenshot of demo scenario
Screenshot of demo scenario
sctldemo.png (116.1 KiB) Viewed 344 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Scenario Tools - generic GS for generic scenarios

Post by Zuu »

Coding help:
You do not need to import libraries at the beginning of each .nut-file. It is enough to do this once, preferable in the top of main.nut. What you assign at the global scope there, will be available in all files.

You are also welcome to change the name from MinimalGS and author in the copyright notice in top of main.nut to yourself.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Scenario Tools - generic GS for generic scenarios

Post by agentw4b »

Known bugs/problems:
- Random placement of towns doesn't work
I did not look at your gamescript, but in my gamescript "City Founder GS" I use random city deployment. You might be inspired.
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: Google Adsense [Bot] and 7 guests