Hey!
I asked this in the UCG forums and user Kramb answered. First, you need to add a cost to the unit you want to limit. Say, to archers (and crosbowmen and arbalesters), add unused resource 8. It’s resource id is 8
Now, you need to add an script call like this
const int cArcher = 4;
const int cArcherLimit = 10;
const int limitResource = 8;
rule limitArcher highFrequency {
for (player = 1; <= xsGetNumPlayers()) {
int count = xsGetObjectCountTotal(player, cArcher);
int resourceValue = cArcherLimit - count;
if (resourceValue >= 0) {
xsSetPlayerAttribute(player, limitResource, resourceValue);
} else {
xsSetPlayerAttribute(player, limitResource, 0);
}
}
}
This will make all players limit their archers to 10.
Hey! An easy solution with a trigger is shown in the following video about variables. If you start at 5:00 he explains it. It’s not as elegant as the solution above, but it works.
@CanineCrown7153 Do I understand this correct? I have to add the script above via the script trigger in the editor or elsewhere? Thanks for your answer in advance!
late reply, i found a solution which was also in El Dorado 5 scenario :
1 = Modify Attribute : Disable unit flag (4)
2 = Modify Attribute : Available unit flag (X)
For more precision : Disable unit flag 1 = unit disabled / 2 = has a limit but the unit can’t be trained back after his death / 4 = has a limit and the unit can be trained back after his death
both triggers effect must be used at the same time