Log in

View Full Version : scripted population



Red Spot
11-05-2007, 17:32
am/was trying to get the AI to actually get to a point where they can have/start with lower size settlement than city and not drain all population from it and in effect causing their own doom, doing so by adding some population on the unittrained event

this works perfect;

monitor_event UnitTrained TrainedUnitCategory infantry
and SettlementName Messana
and not SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Messana, 200
end_monitor
monitor_event UnitTrained TrainedUnitCategory cavalry
and SettlementName Messana
and not SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Messana, 120
end_monitor
monitor_event UnitTrained TrainedUnitCategory infantry
and SettlementName Messana
and SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Messana, 80
end_monitor

nicelly gives me 80 men back and the AI up to 200

but can you spot the diff. between the above and following;

monitor_event UnitTrained TrainedUnitCategory infantry
and SettlementName Thapsus_S
and not SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Thapsus_S, 200
end_monitor
monitor_event UnitTrained TrainedUnitCategory cavalry
and SettlementName Thapsus_S
and not SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Thapsus_S, 120
end_monitor
monitor_event UnitTrained TrainedUnitCategory infantry
and SettlementName Thapsus_S
and SettlementIsLocal
and I_CompareCounter Settlement_Level < 3
console_command add_population Thapsus_S, 80
end_monitor

possibly tell me why it does not work, nor any other recruitment-event from any other faction than the Julii and Senate works
the Senate happily gets a boost in all 5 of its settlements, the Julii in all 6, but no-one else

tried using

monitor_event UnitTrained TrueCondition

no errors, but again no effect whatsoever when I also connect it to a specific settlement not owned by the Julii/Senate

Does anyone possibly have an idea whats going on here, afaik the script isnt the issue

(note that "Settlement_Level" is a counter set based on whats build in Rome, at the time of testing it was "0")


G

Monkwarrior
11-05-2007, 19:55
My 2 cents contribution. :embarassed:

Possibilities to test:

- I imagine that you checked it 1 million times, but... are you sure that Thapsus_S is the settlement name? Just in case it is the region name.

- Is it the internal or the external name? I remember that in some case one or another name was needed (but I don't remember when :embarassed: ).

- Why to use a counter for this purpose? It will require some trick for reloading issues. I would suggest to use the condition SettlementBuildingExists and the corresponding governor building.

- Just to speed up the tests, I will leave only one event, by eliminating the condition of SettlementIsLocal. You can add it at the end of the tests.

- Perhaps it would be advisable to start a campaign with a different owner for Messana. (sorry if you had already done :embarassed: ) As this part of the script was working, a success with another owner would eliminate the faction-restriction hypothesis.

That's all for the moment.

Pharnakes
11-05-2007, 22:54
My advice would be pinch ebs script and adapt it to your map.

Red Spot
11-06-2007, 03:41
My 2 cents contribution. :embarassed:

Possibilities to test:

- I imagine that you checked it 1 million times, but... are you sure that Thapsus_S is the settlement name? Just in case it is the region name.

- Is it the internal or the external name? I remember that in some case one or another name was needed (but I don't remember when :embarassed: ).

- Why to use a counter for this purpose? It will require some trick for reloading issues. I would suggest to use the condition SettlementBuildingExists and the corresponding governor building.

- Just to speed up the tests, I will leave only one event, by eliminating the condition of SettlementIsLocal. You can add it at the end of the tests.

- Perhaps it would be advisable to start a campaign with a different owner for Messana. (sorry if you had already done :embarassed: ) As this part of the script was working, a success with another owner would eliminate the faction-restriction hypothesis.

That's all for the moment.

-I tried "Thapsus_S", "Thapsus S" and finally changed the name to ThapsusS and tried that, just incase ...

-tried it as well with the console itself, the game needs the name in descr_regions (the ones with underscores, though you dont get an error if incorrectly used in a script)

-I wanted to keep a small settlement growing as in my game everything from pop. ~7400 and above will grow in such level I dont even mind them slowing down, even with as max base-farm 4 and max farm-bonus 3 without any pop-bonus, but the small stuff quickly gets drained to like 300 people ....
via settlement level would work, I just favoured the idea of settlements growing as they should without the drain of recruitment, at least for the AI(I actually like it, its just that the AI cant handle it)

-conditions dont matter, with conditions they work for the Senate and Julii but without the event doesnt register for any other faction, at least thats my conclusion

-have cheated my way into Thapsus_S ..... the event registered when under my control


thanks for the pointers, though I've already pretty much adapted my work to start with a map where everything is city from start with no less than 6400 people/settlement (some capitals at 7400 for "quick-growth")
I already had most settlements at city level after like 20-ish turns by not recruiting while testing some balance in growth between AI and me, where the AI with some minor EDB-cheats outgrew my cities but drained everything that started below ~6200
Now I have no growth-cheats but everythin at or above 6400 people where the only drained settlements are the ones that see some longterm heavy fighting, for some reason I cant keep up in growth with the more populated settlements even though we have the same EBD-bonusses ....

Now I just have to get the AI to recruit something better than town-watch ... :wall:


G

Atilius
11-06-2007, 06:49
SettlementName requires the display name (not the tag name) of the settlement as a parameter, but won't treat spaces properly. If you have a space in a display name you won't be able to use SettlementName successfully. The add_population command also uses the display name, not the tag name.

If you have the following in imperial_campaign_regions_and_settlement_names.txt,



{Rome} Roma
{Narbo_Martius} Narbo Martius


SettlementName Roma

will work, but


SettlementName Rome

won't.

None of these will work:

SettlementName Narbo Martius
SettlementName "Narbo Martius"
SettlementName Narbo_Martius

Red Spot
11-06-2007, 07:11
The add_population command also uses the display name, not the tag name.


Gonna have to disagree on that one, at least my findings say so ...

The console gave me errors when using "Thapsus S", but when I used "Thapsus_S" the extra population appeared

Maybe the game is reading the actual display name, but if so it does seem to (partially) take underscores for spaces, it also makes me wonder what the renaming option would/could do to a script ....

Is there any other way to check up on a specific settlement without needing its name, can we look them up by region-ID or so and would that still be the same after a regen of map.rwm ....?!? ..


G

Atilius
11-07-2007, 02:39
Gonna have to disagree on that one, at least my findings say so ...

The console gave me errors when using "Thapsus S", but when I used "Thapsus_S" the extra population appeared

I'm sorry, I didn't check add_population carefully enough; it accepts BOTH the display name and the tag name.



Is there any other way to check up on a specific settlement without needing its name, can we look them up by region-ID or so and would that still be the same after a regen of map.rwm ....?!? ..

In general, no. You're dependent upon the variable exported by the event you're monitoring. For instance, GeneralCaptureSettlement exports the settlement name AND the region ID. You've probably already discovered that UnitTrained doesn't export the region ID but GovernorUnitTrained does.

Red Spot
11-11-2007, 23:34
thanks for the reply Atilius ..

Guess I'll be sticking with everything at city-level from the start, after some -ai testruns I've found it to work pretty good in the hands of the AI, population climbs barelly on average wich is exactly what I was after and enlight of lozing a trier I just made huge_city into a double trier by adding a 2nd level of buildings at that level only to be build if certain other huge_city buildings are constructed, same effect (cities with wooden walls etc) though the AI "seems" to work a bit better with it(even if its just cause they dont get the chance to drain the population)


G