Get plot owner before city is founded

qqqbbb

Prince
Joined
Sep 25, 2010
Messages
530
When a city is founded 6 plots around it instantly become owned by the founder. I'm looking for a way to get owner of those plots before the city was founded. I've tried SerialEventCityCreated and OnCanSaveUnit but when they fire the plots are already owned by city.
 
When a settler (or any unit with a 'consumable' mission) activates its mission, the unit itself is killed during that process.

I don't remember the exact timing, but you may be able to use the unit prekill event to catch when the settler unit is about to be destroyed. Unfortunately, I don't know if the game already sets up the city or not before this happens.
 
UnitPrekill did not help either. Looks like city is created before settler is destroyed.
 
Hmm.

In that case, I'm afraid I don't know.

Only other method I can think of is a very inelegant, extremely resource-intensive, brute-force method -- use UnitSetXY to track settlers via some type of unique ID, and scan the plots around them as they move and cache/store them in case they plop a City.

Unfortunately, this would mean you're firing a 7-plot scan every time a settler moves anywhere on the map.
 
I am pretty sure that founding new cities doesn't steal adjacent tiles of other players.

If you want only to know If it grabbed the plots from any other city of player, try:
Plot:GetOwnershipDuration()
However, if Player buy a plot and then settle there in the same turn, it will be useless.

If you want to know the previous City owner of the plot. Much harder.
 
I can't use Plot:GetOwnershipDuration() either. It won't work when a city is captured. I'm making a mod that makes cities start with 0 working plots. Looks like saving plots is the only way.
 
removing 6 surrounding plots (or more in case of Shoshone trait) from city area at city founding should be no problem in most cases: set ownership to none if owned by player at city founding, since plots are only acquired by city only if previously unowned (restored to none) OR if previously part of another city owned by the same player (too bad)

Cheers
 
I found option in Howard's dll that controls city radius for new cities.
 
Back
Top Bottom