[Tutorial] Tide-Runners: Seamless Land-Sea Unit Transitions

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
leo.priori
Posts: 38
Joined: Mon Jan 01, 2024 3:22 am

[Tutorial] Tide-Runners: Seamless Land-Sea Unit Transitions

Post by leo.priori »

Tide-Runners: Seamless Land-Sea Unit Transitions
(Land-to-Sea Seamless Transitions)

explorer.png
explorer.png (934.74 KiB) Viewed 780 times

Hello everyone! I'm bringing you a new script called Tide-Runners.
This mod allows units to automatically transform when moving between land and water.

Once a unit (like an Explorer) enters the sea, it instantly shifts into a coastal vessel.
Through a configuration table at the beginning of the script, you can define for each unit if it preserves movement points after transformation or if a notification is sent to the player.

In this tutorial, I show how to apply it ONLY to the Explorer, but I also provide playable rulesets below where it is already implemented for "Workers" and "Engineers" for testing.

Workers:
workers.png
workers.png (839.16 KiB) Viewed 780 times
Engineers:
engineers.png
engineers.png (959.17 KiB) Viewed 780 times

So lets apply to the Explorer:

1) Define Unit Classes

Open the units.ruleset file and add the following unit classes:
These are copies of the Land and Sea unit classes, but with some 'flags' removed since they are specifically designed for non-military units.

Code: Select all


; ------------------------------------------------------------------------------
; Class for land units 
[unitclass_land_ocean]
name          = _("LandOcean")
min_speed     = 1
hp_loss_pct   = 0
flags         = "BuildAnywhere", "DoesntOccupyTile", "ZOC", "TerrainDefense", 
                "TerrainSpeed", "Airliftable", "NonNatBombardTgt"

; Class for maritime units (coastal only) 
[unitclass_ocean_land]
name          = _("OceanLand")
min_speed     = 2
hp_loss_pct   = 0
flags         = "ZOC"

; ------------------------------------------------------------------------------

2) Unit Configuration

Further down in the same file, modify the 'class' property for the units that will undergo transformation.
Note: The "Raft" unit is a copy of the Trireme but without transport capacity (transport_cap = 0).

Code: Select all


; Set the 1st class for the Explorer 
[unit_explorer] 
name          = _("Explorer") 
class         = "LandOcean"

; Set the 2nd class (coastal) 
[unit_raft] 
name          = _("Raft") 
class         = "OceanLand"

3) Terrain Native Rules

Open the terrain.ruleset file and add the classes to all terrains, except Deep Ocean, using the 'native_to' property.
If applicable, apply it also to the 'extras' Road, Railroad, Maglev, Fortress, and Fort.

Code: Select all

[terrain_forest]
name                 = _("Forest")
native_to            = "OceanLand", "LandOcean",
                       "Sea", "Air", "Missile", "Helicopter", "Trireme"
Now apply it to the extras (e.g., Road, Railroad, River, etc.):

Code: Select all

[extra_road]
name           = _("Road")
native_to      = "OceanLand", "LandOcean"
                 "Land", "Small Land", "Merchant", "Big Land"
4) And finally, download the script.lua.tar.gz file, extract it, and place it in your ruleset folder.
script.lua.tar.gz
(1.29 KiB) Downloaded 12 times
leo.priori
Posts: 38
Joined: Mon Jan 01, 2024 3:22 am

Re: [Tutorial] Tide-Runners: Seamless Land-Sea Unit Transitions

Post by leo.priori »

Rulesets with Tide-Runners
Attachments
civ2_tide_runners.tar.gz
(88.27 KiB) Downloaded 10 times
civ2civ3_tide_runners.tar.gz
(104.04 KiB) Downloaded 14 times
classic_tide_runners.tar.gz
(75.11 KiB) Downloaded 13 times
Post Reply