Build building on other continent only?

Putmalk

Deity
Joined
Sep 26, 2010
Messages
2,652
Location
New York
Hey, is it possible to make a building that can only be built on another continent from your capital? Similar to the Conquistador unique unit.

Thank you for any insight.
 
try something like this

Code:
GameEvents.CityCanconstruct.Add(OtherContinentCondition);
function OtherContinentCondition(iPlayer, iCity, iBuildingType)
  player = Players[iPlayer];
  city = player:Cities[iCity];
  return 
    player:GetCapitalCity:Area() ~= city:Area() and 
    GameInfo.Buildings[iBuildingType].OtherContinent;
end
 
Just looking through that, just making sure it's right:

First line calls function.
Third and fourth declare the player and city variables.
Sixth and seventh line check if the capital city doesn't equal the new city's area and that the building is on the other continent?

Also, what's the "return" doing there?

How would I specify exactly what building can't be built on another continent?
 
Lines 5, 6 and 7 are all one statement of the form "return this and that", where the "this" part checks that the city you are trying to build in is not on the same continent(area) as your capital and the "that" part has assumed you have used an SQL ALTER TABLE command to add a new column called "OtherContinent" to the Buildings table, and that you have also used SQL/XML to populate that column for the buildings you only want abroad

If this is for one specific building, the "that" part could be
Code:
    iBuildingType == GameInfoTypes["BUILDING_EMBASSY"]
(or whatever identifier you've used for your building)
 
In that case, is each island also it's own area?

No.

Depending on map size and type there are between 1 and 4 continents. The map generation scripts locate N large landmasses as far apart as possible and assign those as the continents. Islands are then assigned based on proximity to the main continents.

If you hand-craft a map in WorldBuilder you have to do it all yourself.
 
No.

Depending on map size and type there are between 1 and 4 continents. The map generation scripts locate N large landmasses as far apart as possible and assign those as the continents. Islands are then assigned based on proximity to the main continents.

If you hand-craft a map in WorldBuilder you have to do it all yourself.

See, this is the problem. I'll be using a custom-made map, so I don't think "areas" would exist. However, the good news is is that the continents would be pretty far apart, so maybe a minimum tile distance apart is just as good?
 
See, this is the problem. I'll be using a custom-made map, so I don't think "areas" would exist. However, the good news is is that the continents would be pretty far apart, so maybe a minimum tile distance apart is just as good?

How is it custom made? In WorldBuilder or by another script?

If the former, just add the areas yourself, if the latter, just rip the continent determining code out of the standard map generator scripts
 
How is it custom made? In WorldBuilder or by another script?

If the former, just add the areas yourself, if the latter, just rip the continent determining code out of the standard map generator scripts

I see what you mean now. It's the former, and by "continents" it's only defined by two different "continent" brushes (like one for Europe, one for Asia, you know what I mean?). That's good. That will work then. Hopefully the script will work too. Thank you very much!
 
Back
Top Bottom