Results 1 to 18 of 18

Thread: Is there really no way to test how many units a faction has?

  1. #1
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Is there really no way to test how many units a faction has?

    Trying to solve the AI full stack spamming is driving me nuts. Trying to adjust the income\expense side so that there is only a small surplus is pretty much impossible due to the number of variables. If the AI has a dollar and he can buy a unit for that dollar then he will do it.

    A very reliable method would be to test for the number of exisiting units and use a counter in the EDB. Drawback would be that every unit would need a separate recruit entry line for every faction it's available for (never mind the usual pit fall of EDB conditions) because the recruit poll is set to zero every time the condition is not met, so combined faction lines won't work.

    There is no direct testing, eg FactionNumberUnits.
    Testing how many units have been recruited is a matter of routine (although tedious).
    Testing how many units got killed is not possible as far as I know or is there some battle related script stuff for it (NumEnemyUnitsKilled?)

    Any other work around?










  2. #2

    Default Re: Is there really no way to test how many units a faction has?

    There's the in game graphs which has a measurement for army strength, maybe work out the method it uses?
    Reducing the factions to 1 or recruitable 2 units might give you a basis for measurement in any tests.
    Last edited by danny X; August 06, 2014 at 12:48 PM.


  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    It's worth a shot, but my guess would be a graph sub routine in the code is responsible for it.

    I'll go and dredge the EXE for some clues, maybe find something that might work.










  4. #4
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Is there really no way to test how many units a faction has?

    Quote Originally Posted by Gigantus View Post
    Trying to solve the AI full stack spamming is driving me nuts. Trying to adjust the income\expense side so that there is only a small surplus is pretty much impossible due to the number of variables. If the AI has a dollar and he can buy a unit for that dollar then he will do it.

    A very reliable method would be to test for the number of exisiting units and use a counter in the EDB. Drawback would be that every unit would need a separate recruit entry line for every faction it's available for (never mind the usual pit fall of EDB conditions) because the recruit poll is set to zero every time the condition is not met, so combined faction lines won't work.

    There is no direct testing, eg FactionNumberUnits.
    Testing how many units have been recruited is a matter of routine (although tedious).
    Testing how many units got killed is not possible as far as I know or is there some battle related script stuff for it (NumEnemyUnitsKilled?)

    Any other work around?
    Maybe stop giving them the money/recruit options to produce full stacks, but that's a complicated answer to a complicated question.

    DLV has had a unit limit imposed on the player for many years. I don't know who added it, possibly Repman. You could copy it for use with the AI. The only thing that doesn't work about it is it doesn't track mercenaries. And it has the awkward feature of entirely depleting recruit pools once the limit is hit, rather than conveniently freezing them. Might be worth a look anyway.

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    I'll check it out, thanks for the pointer.










  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Is there really no way to test how many units a faction has?

    Quote Originally Posted by danny X View Post
    There's the in game graphs which has a measurement for army strength, maybe work out the method it uses?
    Just an idea, for what it's worth...

    Add a new faction that isn't on the map, not playable. Every turn emerge them and give them X units, where X represents at what military strength you wish to disable recruitment. Then trigger some kind of event on them that exports faction and add one monitor per other faction to handle that event using this as a condition: FactionScore military < [other faction]. In the monitor body set the flag, or whatever, that disables recruitment for that other faction. Plus you'd need to unset the flag if that monitor doesn't execute: if this faction is stronger militarily than the other faction. Then kill the faction of course.

    I don't know how practical that is. e.g. Surely "military score" is not a count of units, it's probably a count of soldiers and takes into account unit class/stats/etc. Also, is that emerging faction in existence long enough to have a score? I don't know.

  7. #7
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    I haven't checked DLV, but I think they used an event counter condition to control the recruiting instead of the freeze_recruit_pool command - hence the resetting to zero of the pool. At least that was the first obstacle I ran into when starting this project.










  8. #8
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Is there really no way to test how many units a faction has?

    It uses freeze_recruit_pool - That's what actually sets the pools to zero.

    And it uses a counter to track units recruited, but since there's no obvious way to track how many mercs are being recruited, it doesn't track that.

    If you're going to try doing it to the AI then it's going to mean script activity everytime the AI recruits a unit and I wonder about the effect it will have on turn times.
    Last edited by Taiji; August 09, 2014 at 05:06 AM.

  9. #9
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    I was under the impression that 'freeze' would do exactly that: 'freeze' - not reset it to zero like an on\off event counter condition.

    The script I have for 22 factions clocks in at 30 seconds extra, 33 monitors, 62.000 lines of code
    Last edited by Gigantus; August 09, 2014 at 08:33 AM.










  10. #10

    Default Re: Is there really no way to test how many units a faction has?

    If you could improve Fred Putz's Carl script, that would solve your problems. It does what you want, but it increases end turn times.

  11. #11
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    Quote Originally Posted by k/t View Post
    If you could improve Fred Putz's Carl script, that would solve your problems. It does what you want, but it increases end turn times.
    Sadly it requires that large amount of monitors, from my initial looking into it I couldn't find an obvious way to reduce the excessive amount of it.



    NB: Carl the Taxman is actually a finance regulation script - it won't help at all with determining unit numbers. It did it's job with the finances but the added processing time wasn't acceptable. Regulating the income is a rather cumbersome method of curtailing recruiting as it also curtails building.
    Last edited by Gigantus; August 12, 2014 at 08:54 AM.










  12. #12
    irishron's Avatar Cura Palatii
    Join Date
    Feb 2005
    Location
    Cirith Ungol
    Posts
    47,023

    Default Re: Is there really no way to test how many units a faction has?

    Quote Originally Posted by k/t View Post
    If you could improve Fred Putz's Carl script, that would solve your problems. It does what you want, but it increases end turn times.
    Yeah, my initial End Turn went from seconds to three minutes. Gone.

  13. #13
    Emperor of The Great Unknown's Avatar Primicerius
    Join Date
    Nov 2008
    Location
    far enough where verizon cant go
    Posts
    3,110

    Default Re: Is there really no way to test how many units a faction has?

    Well the simplest idea to curl AI recruitment would be to increase the cost of the recruiting units, or maybe make units require more than one turn to recruit. Thus slowing down recruitment, and the AI's spiral into debt. However these changes would affect the player also. Or you could reduce the recruitment_slots in settlements. If you have an suitable conditions and event counter you could freeze recruitment this way.
    Give a man a fish you feed him for a day, teach a man to fish you feed him for a lifetime.
    cant read?

  14. #14

    Default Re: Is there really no way to test how many units a faction has?

    Building is not curtailed by the Carl script, as all buildings cost 1 dollar for the AI, so the AI can continue to improve its cities while "bankrupt", but it cannot recruit more units.

  15. #15
    irishron's Avatar Cura Palatii
    Join Date
    Feb 2005
    Location
    Cirith Ungol
    Posts
    47,023

    Default Re: Is there really no way to test how many units a faction has?

    Quote Originally Posted by k/t View Post
    Building is not curtailed by the Carl script, as all buildings cost 1 dollar for the AI, so the AI can continue to improve its cities while "bankrupt", but it cannot recruit more units.
    Do you have an improved version of Carl's script that does not take forever to run? Three minutes for turn one and I only have two regions is a bit much.

  16. #16

    Default Re: Is there really no way to test how many units a faction has?

    If I'm understanding correctly what you're trying to accomplish here, then wouldn't it work to just monitor for how much money each faction has and if below a certain amount freeze there recruit pools? or does that require having the seperate line for each unit per faction in the EDB as you previously mentioned?


    EDIT: OR, what about setting up some scripts that "freezes" a factions recruitment at all times except when warring with someone who has a higher military score...you could even set it to only freeze higher lvl units also so they can still recruit some low lvl units....JUST AN IDEA
    Last edited by valvegas1; August 20, 2014 at 09:43 AM.

  17. #17
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Is there really no way to test how many units a faction has?

    I have got a script that freezes recruitment (presently using it in Rise of three Kingdoms) when a certain ratio of unit count versus settlement level counts reached. Each unit type is assigned a debit point which counts against credit points assigned to settlements as per their level.
    It's far from perfect as is doesn't (can't) account correctly for units lost. An attrition credit is given according to debit numbers.
    Accounting for bribery or the change of settlements via diplomacy is extremely convoluted and the ton of additional script will eat into processing and isn't worth to cover this miniscule influence.

    Despite these short comings is does a fair job reducing AI stack spamming.

    Freezing individual pools requires one monitor per unit, per region as you can't freeze individual units or factions - I rather don't do the math.










  18. #18

    Default Re: Is there really no way to test how many units a faction has?

    I used the standard script for my TLK and BC submods. I think it did add to end turn times, but they didn't become unbearable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •