Results 1 to 8 of 8

Thread: scripted population

  1. #1
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default scripted population

    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;
    Code:
    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;
    Code:
    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
    Code:
    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

  2. #2
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: scripted population

    My 2 cents contribution.

    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 ).

    - 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 ) 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.

  3. #3
    Asia ton Barbaron mapper Member Pharnakes's Avatar
    Join Date
    Feb 2007
    Location
    The Kingdom of Fife
    Posts
    1,768

    Smile Re: scripted population

    My advice would be pinch ebs script and adapt it to your map.
    Asia ton Barbaron The new eastern mod for eb!

    Laziest member of the team My red balloons, as red as the blood of he who mentioned Galatians.
    Roma Victor!

    Yous ee gishes?

  4. #4
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: scripted population

    Quote Originally Posted by Monkwarrior
    My 2 cents contribution.

    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 ).

    - 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 ) 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 ...


    G

  5. #5
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

    Default Re: scripted population

    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,

    Code:
    {Rome}           Roma
    {Narbo_Martius}  Narbo Martius
    Code:
    SettlementName Roma
    will work, but

    Code:
    SettlementName Rome
    won't.

    None of these will work:
    Code:
    SettlementName Narbo Martius
    SettlementName "Narbo Martius"
    SettlementName Narbo_Martius
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  6. #6
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: scripted population

    Quote Originally Posted by Atilius
    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

  7. #7
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

    Default Re: scripted population

    Quote Originally Posted by Red Spot
    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.

    Quote Originally Posted by Red Spot
    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.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  8. #8
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: scripted population

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO