dejvid2 wrote: ↑Sun Oct 14, 2018 5:23 pm
I want to increase the distance that a settler has to be from the existing cities before a city can be founded.
My aim is to discourage the AI from building cities and so the cities that are in play are the historical ones in their historical location as specified by the scenario.
First of all, I don't think you can set this is scenario or mod.ag directly.
You need to make a MOD with a new script file: Msgs.cs and eventually Units.cs.
I'm not a scripter myself, but I like to experiment a bit. For a real solution wait for Pavel, at least before you publish it.
USE AT YOUR OWN RISK
You should create a MOD with your own Msgs.cs script file where you change:
private MsgResult CanBuildTown(Unit unit, Position position)
Within:
MOD_MOVE_4 (in Msgs.cs script), which is actually the "build" command for towns.
Change:
else if (State.Chart.GetUnitsCloseToPosition(position, 1).GetUnitsByUnitClass(UNIT_CLASS.CITY).Count > 0)
To:
else if (State.Chart.GetUnitsCloseToPosition(position, 2).GetUnitsByUnitClass(UNIT_CLASS.CITY).Count > 0)
So it will check for two tiles away instead of one. Otherwise you will get message "cannot build here".
This is not bound specifically to the Settler, but to all units who can build cities.
If you really want to have this rule for the settler only you should make a complete new movetype with this rule and give only the settler this movetype (ability).
I'm not sure if it is enough to achieve what you want, but a good start I think. I tested it and it worked for me.
You probably also want to make use of more tiles around existing cities (for yield for example). You can do that as well:
I find a way to set the surrounding occupied tiles per city size in script file.
Again USE AT YOUR OWN RISK, I'm not exactly sure what all is bounded to the occupied neighbourhood positions. I think it's more then the "yielding" alone.
In the script you add a public class for cities. (public class Static Unit inluding all content must be there as well).
(see original Units.CS file to copy the whole Staticunit and City public class in the Scripts folder of the Ancient Rome mod).
So your script file looks like this:
//css_reference Shared.dll;
//css_reference Kernel.dll;
//css_reference Resource.dll;
using System;
using System.Drawing;
using System.Collections.Generic;
using Aggressors.Units;
using Aggressors.StateClasses;
using Aggressors.Msgs;
using Aggressors.Msgs.Moves;
using Aggressors;
using Aggressors.Reports;
- public class StaticUnit ...
- public class City ...
Within the public class cities find the:
private PositionCollection
For every city size (>3 for example) you can now set the neighbourhood range.
For example
If the city is smaller then 3, occupy type is a cross type (one square N, E, S and W) and one square range.
If change 1 to 3 for example and CROSS to SQUARE you will get a 3 range square.
(unit.Position, 0, 1, OCCUPY_TYPE.CROSS)
to
(unit.Position, 0, 3, OCCUPY_TYPE.SQUARE)
Will result in:

- range.jpg (319.43 KiB) Viewed 6644 times
Be also aware this only works for newly created cities in your scenario. The already placed ones keeps the same value.