[R&F] How to “one per continent”?

acluewithout

Deity
Joined
Dec 1, 2017
Messages
3,470
Hi All

I’m working on a mod that would give England one extra trade route for each continent it has at least one Royal Navy Dockyard.

From sql, there’s a xml table called “moments” which seems to set moments for Eras. This has a “MomentType” called “Moment_City_Built_ New_Continent”.

Is there a way I could kludge something using that to get what I want?

Is there something underlying this I could use to identify when a RND is built on a new continent rather than a city?

Sorry. Very new to all this, and still trying to figure things out.
 
Hi All

Still working on this. I think I could code something using Lua to keep track of how much of "x" is built on a particular continent.

But does anyone know how to find out in a gameplay context what continent a particular city is on?

There must be some way of knowing, otherwise the game wouldn't be able to know when a city is on a home continent or foreign continent (for example).
 
https://docs.google.com/spreadsheets/d/1HQSUOmw_pI8dNSr1kmun4qAHj6SsOVfa1vGTbk5mVvs/edit#gid=0

Long story short is you have to
  • get the city object. The exact method you use to get the city object "City" will depend entirely on what game event hook your code is being executed from.
  • use the city object to get the XY for the city's grid location via City:GetX(), City:GetY()
  • get the plot from the XY location
    Code:
    local pPlot = Map.GetPlot(City:GetX(), City:GetY())
  • Use
    Code:
    local iContinentID = pPlot:GetContinentType()
    to get the ID # for the continent that will then match up to a continent designation in the XML-table <Continents>
FYI the game engine handles all this internally at DLL level rather than relying on any lua method to determine if the city is on the home continent or not (for example).
 
Top Bottom