ToTPP Ships on River Movement

Civinator

Blue Lion
Supporter
Joined
May 5, 2005
Messages
9,956
With this post I will inform modders about my experiences with ToTPP and ships moving on rivers.

When I saw that new feature coming with ToTPP, I thought: Wow, this feature gives me the long needed landcarrier for my spacemod. This mod is based on two landmaps with desert as the filler terrain. Ocean tiles are only for the suns in those maps. Working @COSMIC2 settings were added to the rules text without any problems and NavigableRiversIntercardinal were set to 0.

One click in Mercator´s map tool and there was a river in every tile of the map (without the sun tiles). To show it I use in the screenshot of map one (Milky Way) yellow river graphics (normally the river graphics in my mod are set to transparency).

space1-jpg.504427


Near the planet Kilrah you can see my testship, the battlestar Galactica, given to a no-player civ. The testship is set to be a real naval ship having the carrier flag.

In the screenshot of map2 you can see the same situation with rivers in every tile (but suns) with transparent river graphics (as it normally looks in that mod) and the same testing ship for the human player.

space2-jpg.504428


When I draw this testship, the ship carried fighters and missiles with it like a naval carrier. It was a great moment, but the 'move to' action was limited to the next tile. I was not able to draw the ship with the mouse to a tile two or three tiles away from the ship.

The test ship of the AI was drawn by the AI to the sun (ocean tile) next to the ship. Here it stayed forever. When there was no sun (ocean tile) next to the ship, the AI didn´t move the ship on the map.

space3-jpg.504429


Another interesting feature with the 'all-tiles-river-landmap' was, that my settlers were not able to build roads, before having invented bridge building.

Another cool feature of that setting was, that the ships were able to fight any land- or naval unit on the map, but they were not able to capture the cities. This setting offers a cornucopia of new options for my space mod

... but how can I convince the AI to draw its ships on such an 'all-tiles-river-map' ?
 

Attachments

  • Space1.jpg
    Space1.jpg
    771 KB · Views: 426
  • Space2.jpg
    Space2.jpg
    207.5 KB · Views: 555
  • Space3.jpg
    Space3.jpg
    770.8 KB · Views: 460
Last edited:
... but how can I convince the AI to draw its ships on such an 'all-tiles-river-map' ?

You are probably going to have to implement your own AI into the Events, at least for moving "ships" on land. For example, when an AI "carrier" activates, you run some code to determine where it should go, and then use the teleport unit function to move it there (simultaneously expending all its move points). At the same time, you would also teleport all the "air" units that should go with it (probably without expending their movement points). Writing a partial AI will undoubtedly be some work, but I doubt very much you have any other options. For that matter, I heard somewhere that the AI doesn't know how to use carriers anyway, so you might have even more AI to write with it... While we can use teleportation to override AI movement, I don't know how to make the AI attack.

It may be possible to use a teleport event to 'fix' the land carriers, without resorting to rivers everywhere.

When you activate the carrier, store the carrier and all the units it carries in a table. Call it carryTable. If the carrier is moved by a key press, teleport all the other units in carryTable to the new location with it. When units activate, doublecheck that all units in carryTable are with the carrier in carryTable (this should account for moveTo orders), then delete the entries in carryTable so that we don't keep teleporting units to the carrier after they move and so it can be used for the next carrier
 
Prof. Garfield, thank you very much for your answer. :)
Despite your great tutorial and the great explanations how to work with lua, that helps me a lot (I think you are a professor in real life, too :hatsoff:) I´m yet far away from beeing able to create such a complex lua programming. As I think the code for a working 'landcarrier' would be needed by a lot of Civ 2 modders, may be this could be a topic for the [ToTPP] Lua Library, when there is a time for it.

In my test I gave the carrier the settings of the naval carrier in the Civ 2 ToT original game. Role: 2 = Naval Superiority, and added the left "ninth" bit 1 for river movement in the UNITS_ADVANCED settings.

May be it would be a big advantage, if the 'landcarrier' can not attack the other unit, if the units that are carried by such a carrier (aircraft, missiles, amunition) are able and will attack the target after the teleportation. In fact I think this would be much better than a direct attack by the 'landcarrier'.

In my eyes it could be a much bigger problem, to trigger the AI 'landcarrier' to teleport in attacking range of the target unit. May be such a programming could be useful for a human player vs. AI version of 'Bombing the Reich', too.

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

For TNO, if he should be reading this post):

navigable-rivers-jpg.504508


It seems, the patch in the screenshot above yet is not working very well.
 

Attachments

  • Navigable Rivers.jpg
    Navigable Rivers.jpg
    73.2 KB · Views: 403
Despite your great tutorial and the great explanations how to work with lua, that helps me a lot (I think you are a professor in real life, too :hatsoff:) I´m yet far away from beeing able to create such a complex lua programming. As I think the code for a working 'landcarrier' would be needed by a lot of Civ 2 modders, may be this could be a topic for the [ToTPP] Lua Library, when there is a time for it.

Well, we haven't even covered everything necessary to do 'land carriers' yet, although I think it might actually be simple enough to do as an example in a few lessons (at least in a rudimentary form). In any case, it will be best to start with more 'basic' events, then expand your horizons once you gain experience. Like most things, skill in programming increases with practice and experience. A lot of programming basics were covered in lessons 2 and 3, which probably won't make a lot of sense until you actually take the time to start writing events. At the moment, my plan for lesson 4 is a combination of examples and assignments that will start using the stuff covered in the previous lessons.
 
Try changing the landcarrier's Role to one that the AI understands is intended for land. It gets confused if you have a land unit with a naval role, and doesn't connect ToTPP's navigable rivers with being the ocean.

Noire Leblanc, thank you very much for your input. :) Bevore posting in this thread, I also had a test, giving the naval carrier the role '0' for land attack, but the AI didn´t use it, when it is a naval unit. After your post I made a second test with the original Civ 2 game, modded by ToTPP and the needed additions to the rules text. The result was, that the naval carrier of the original game (with the added ninth bit) inside land didn´t move anyway, even if the navigable river was connected to the ocean. The only exception was, when the naval carrier was placed at the last tile of the river that flow into the ocean. In that case the naval carrier was moved into the ocean by the AI.

It seems, Prof. Garfield´s solution is the only proper solution (or TNO is improving that patch).
 
Back
Top Bottom