SCRIPT: I LUV Connections! Connect your own resources through any roads or rivers.

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

SCRIPT: I LUV Connections! Connect your own resources through any roads or rivers.

Post by leo.priori »

Freeciv version:
* 3.2 or better

Level needed -
* Ruleset: Basics+
* Scipt LUA: Basics+

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

Hello everyone! I bring you a script that I have had for some time.
Previously, control was done by buildings, due to the lack of reqs in the unit section.
After the release of FreeCiv 3.2-beta1 I managed to make the final adjustments and now I would like to share these rules (along with the script AND the tileset) with you so that everyone can change accordingly with your own rules.

This script is a complete change of perspective on resources.

The rule is simple, the resource that is WITHIN (i.e: INSIDE) the radius of your city needs 2 things:
1) Must have appropriate infrastructure (Mine, Irrigation, etc.)
2) Roads (or even rivers) between the resource tile and the tile in the center of your city.

Only then will it be possible to construct units or buildings and also share this resource with other cities that are connected (by roads or rivers) to this one!

And there's more!
- Export resources to those cities that are inaccessible by road;
- Build factories that need other resources to generate NEW resources.
- Choose which buildings can automatically share what resources you want, when two cities have this same building.
- Create units that can reveal hidden resources;
- Hide resources from the player and only reveal them when the tech is hit and/or by a specific unit! (get a little crazy here, i know, but we’ll get there!)

But you may now be asking: what about the AI?
We know that it does not have this connection capability, so as soon as it creates the infrastructure, it will have the connection to the resource.
I think that's fair, don't you think?
However, it still needs to create roads (or take advantage of rivers) between the cities to share the resources, which will happen soon.
And remember, it will eventually create a building that shares all the resources the city has! In my ruleset, Harbour improvement can share the first most important resources of the game.
So I suggest you hurry up with the basics first, Wood from some Forest or Jungle and Rocks from some Mountain.
I leave the rest for you to find out!


Frequently Asked Questions

Question: Where are the resources?
Answer: Wood and Rocks are the only ones I chose that don't need symbols (extras) on the map. Just build a Lumber in any Forest or Jungle to get Wood and a Mine in any Mountain to get Rocks. Resources that are within the radius of your city will be automatically revealed when you have the corresponding technology. Gold and Gems are always revealed as they do not require any technology.
If you want to reveal resources that are outside the city radius, you need to create a specific unit that can reveal them and use the action:
* "Search resource (1 turn without moving)"
Example of this ruleset:
The Explorer can reveal Gold and Gems.
The Alchemist can also reveal Sulfur and Saltpeter, essential to create Niter(Gunpowder).

Question: How do I see if my city is connected to the resource?
Answer: Use the mouse middle-click on the city. The resource will appear with the # symbol.
Example: #Bauxite, #Clay, #Coal, etc.

Question: I have a resource that is outside the city radius! Can I connect it?
Answer: No, you can't! If you can't create another city near the resource, forget it!

Question: I have a resource that is WITHIN the city radius, but not accessible by road and it is outside my border! Can I connect it?
Answer: If it is WITHIN the city radius, so Yes, there are three ways to connect:
1) Roads or rivers;
2) No roads at all, only infrastructure, such as Oil Platforms in Deep Oceans;
3) Or use the "Connect/Disconnect resource outside the border" action. Any unit with "Settlers" flag in the city center will do.

Question: How to use the "Connect/Disconnect resource outside the border" action?
Answer: Do the following:
1) Build the infrastructure on the resource outside the border.
2) Take any unit with the "Settlers" flag to the CITY CENTER. (i.e. Workers)
3) Press "D" (Do action...) and click on the resource outside the border.
4) Use the "Connect/Disconnect resource outside the border" action.

Question: How to connect to other cities?
Answer: There are three ways to connect cities:
1) Roads and/or rivers connecting the center of the two cities. Take advantage of the rivers at the beginning of the game to connect your resources and cities;
2) Export/Import. If the city is connected to that resource, directly or indirectly, and is not yet exporting or importing that resource, it can export to another city;
3) Build Harbours (early game) or Airports (late game) in both cities to share all the resources that this building allows.
You can set up your own buildings and resources to share.

Question: How to export a resource?
Answer: The city must follow two rules!
1) Be connected directly (resource within the radius of the city itself) or indirectly (coming from another city);
2) Not be Exporting or Importing that resource yet.
If the city is allow to build the unit, take it to the city that wants the resource and then use the action:
* "Export Resource to this city"
In these rules of mine, not all resources can be exported, only those necessary to construct units or buildings. Choose your own resources to export.

Question: I already have the resource connected and shared. However, there are more of the same resource without connecting in some cities. Do I need to connect them too?
Answer: No, you don't. Just 1(ONE) resource of this type is enough to share with all your cities. However, each connection brings effects and bonuses and still guarantees another source of this resource if the first one breaks. So I recommend making all of them with ALL the resources. The AI ​​will do it.

Question: How to manufacture new resources?
Answer: Factories must be directly or indirectly connected to the resources they consume.
As soon as they are built, they start generating the new resource.
Example: The Charcoal Kiln factory can generate Coal through Wood.
To make Iron, the Forge(Iron) factory needs Coal and Iron Ore.

Question: How to break a connection?
Answer: Any unit with the "Pillage" action can destroy the infrastructure or the road.

Question: How to break an Export connection?
Answer: Build a unit in both cities that are exporting and importing called "Cancel Export/Import Resource".
Use the "EXPORT Resource or BREAK Export/Import" action in BOTH cities to cancel the connections.

Question: Can I share resources with a player on my team or an ally?
Answer: Not yet! But in the near future (maybe in v3.3) it will be possible with the command "player:diplstate()".
Come back here later and maybe there will be news.

------------------------------------------------------------------------
Attached I provide a rule based on civ2civ3 that I always play single and multiplayer with a friend.
It contains the necessary changes to run the script and also some other small changes such as:
- New units and actions (Explorer and Workers Convert Units to Sea, Heal Units, etc.)
- City radius to 10 (3 tiles radius)
- Unit capacity multiplied by 10 (attack, defense, hitpoints and bombardment)
- Changed Storm Unit to Storm Extra
- Added volcanoes
- Added Animals
- among other effects
And most importantly, the file contains the tileset, which mainly contains a transparent (invisible) image that allows you to hide the resources and then reveal them.

Note:
In all these rules, barbarian units were duplicated, separated and disabled (commented).
This is due to the fact that this nation cannot create connections.
If you want the Barbarian nation to appear, uncomment (remove the semicolon) from the barbarian units located at the end of the 'units.ruleset' file.

Change-log
* script_v1.2.2.zip
- Added notification when unable to export.
- The way to cancel export has been changed to specific 'Cancel Export' units.

* civ2civ3_connections_v2.zip
- Added Cancel Export units
- Sulfur and Oil resources adjustments.
- BUG FIXED: Add Barbarian units. (Due to the crash when they appear).


Change-log - 03/FEB/2025
This is probably the last version before the release of FreeCiv 3.3
The biggest changes are

script_v1.2.3.zip
* HEX and ISO maps with diagonal connections
Now the same script works on HEX and ISO maps and also connects diagonally.
* BUG FIXED: AI can now connect to unreachable resources
* Improved 'place and hide' resource system
When removing an extra resource, we do not get the bonuses back (food/shield/trade) when we put it back, so the numbers were causing confusion!
So all [resource_*] tags were removed and the extras previously attached to these tags were replaced with "Nuisance"
Since there are no longer [resource_*] tags, make sure that all bonuses are set correctly in effects.ruleset, otherwise the AI won't be interested.
From now on, to place resources, you need to edit the table:
__place_resources
And also choose the percentage chance of resources appearing in:
__specials_pct
* Cancel Export Control completed
Added notifications instructing the player how to cancel multiple imports.
When canceling an export, and more than one city is importing that resource, the script will ask which city should cancel, creating specific units in each city.
* Bonus: Added conversion unit control (Land-Sea)
This small tool is used to convert units from Land to Sea and vice-versa.
It has 2 actions:
- Convert Unit(River) (the game's default convert action)
- Convert Unit(Land-Sea) (User Action 1)
Unlike the game's default action, the "User Action 1" restores all of the unit's hit points, so use it carefully.
I believe that some units, like the Explorer, don't unbalance the game if they keep jumping around in the sea recovering every time they get hurt!
But of course, that's up to you!
Edit the table:
__units_convertion

civ2civ3_connections_v2.1.zip
* All [resource_*] tags removed.
* Extras category replaced with "Nuisance"
* Cancel export units adjusted for new script
* Tileset reworked to play in ISO and HEX maps
* Add helptext to factories and units in English (sorry for the Portuguese part)

Before playing, change your tileset in:
-- Client Options/Graphics
* Tileset(Square): connections_iso
* Tileset(Iso-Hex): connections_hex
Attachments
script_v1.2.3.zip
=== UPDATE === Only the script v1.2.3 - for HEX and ISO maps and connect diagonally
(13.45 KiB) Downloaded 2048 times
civ2civ3_connections_v2.1.zip
=== UPDATE === Complete and playable ruleset with the script v1.2.3, with Tileset.
(439.7 KiB) Downloaded 2030 times
Last edited by leo.priori on Thu Feb 06, 2025 11:55 pm, edited 71 times in total.
leo.priori
Posts: 22
Joined: Mon Jan 01, 2024 3:22 am

Re: SCRIPT: I LUV Connections! Connect your own resources by any roads or river.

Post by leo.priori »

TOO MANY RESOURCES?

I know, I know, the previous rules had a lot of resources, a lot of mess and things you didn't want, right?
So these ones are completely copied from the originals, without volcanoes and animals, etc.
But with only the changes necessary to use the script.
Instead of more than 30 resources, you only need to connect 6 to build stuff.
All other resources are not necessary to build units and/or buildings, but each connection will give you a lot of bonuses.
The main natural resources are:
* Coal
* Horses
* Iron_Ore
* Oil
* Stones
* Wood

And the factories in these rules can manufacture:
* Coal
* Iron
* Steel
* Energy

Have fun!
------------------------------------------------------------------------
Major rule set changes:
  • Added extras, units, buildings and effects to run the script
  • Change Buffalo resource to Horses
  • Renamed Iron resource to Iron Ore

CHANGELOG 3/FEB/2025

* All [resource_*] tags removed.
* Extras category replaced with "Nuisance"
* Cancel export units adjusted for new script
* Tileset reworked to play in ISO and HEX maps
* Add helptext to factories and units in English (sorry for the Portuguese part)

OBS: Connect all resources to earn bonuses, but only those mentioned above will unlock units and buildings

Unzip the tileset.zip and put everything in the same folder with the other rulesets.
And before playing, change your tileset in:
-- Client Options/Graphics
* Tileset(Square): amplio2_connections
* Tileset(Iso-Hex): hexemplio_connections

So the final rules look like this:
Attachments
tileset.zip
Only the tileset to play with the rulesets below
(86.63 KiB) Downloaded 2029 times
ORIGINAL_Civ1_Ruleset_with_I_LUV_Connections.zip
**UPDATE** HEX and ISO Maps - Original Civ1 ruleset with script v1.2.3 (Tileset NOT included)
(97.12 KiB) Downloaded 2039 times
ORIGINAL_Civ2_Ruleset_with_I_LUV_Connections.zip
**UPDATE** HEX and ISO Maps - Original Civ2 ruleset with script v1.2.3 (Tileset NOT included)
(112.82 KiB) Downloaded 2030 times
ORIGINAL_Civ2Civ3_Ruleset_with_I_LUV_Connections.zip
**UPDATE** HEX and ISO Maps - Original Civ2Civ3 ruleset with script v1.2.3 (Tileset NOT included)
(129.42 KiB) Downloaded 2062 times
ORIGINAL_Classic_Ruleset_with_I_LUV_Connections.zip
**UPDATE** HEX and ISO Maps - Original Classic ruleset with script v1.2.3 (Tileset NOT included)
(102.69 KiB) Downloaded 2033 times
Last edited by leo.priori on Mon Feb 17, 2025 6:17 pm, edited 14 times in total.
leo.priori
Posts: 22
Joined: Mon Jan 01, 2024 3:22 am

Re: SCRIPT: I LUV Connections! Connect your own resources by any roads or river.

Post by leo.priori »

I want connnect DIAGONALLY in ISO maps too

UPDATE 3/FEB/2025
My mistake, sorry. Lack of testing on ISO maps.
Not all commands should be changed, some should remain circle.
Update to script version 1.2.3 (link above) to play on ISO and connect diagonally.
Last edited by leo.priori on Mon Feb 03, 2025 3:25 am, edited 6 times in total.
alfredocarroll
Posts: 1
Joined: Wed Jan 22, 2025 1:27 am

Re: SCRIPT: I LUV Connections! Connect your own resources through any roads or rivers.

Post by alfredocarroll »

Oh thank you, I have successfully changed the ISO map, hope it will be an interesting experience.
Post Reply