Results 1 to 11 of 11

Thread: Giving AI unlimited money?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Giving AI unlimited money?

    So it seems the AI doesn't know how to handle his economy at all and almost always goes bankrupt, resulting in very weak resistance and even weaker attacks. Is there some way I can simply give AI factions unlimited money without affecting the player-controlled faction? The only way I can think of is making their King's Purse upwards 10000 florins and increase the less territories they hold. Is there any other way or is this my best option?
    "People don't think the universe be like it is, but it do." -- Neil deGrasse Tyson


    In Soviet Russia you want Uncle Sam.

  2. #2

    Default Re: Giving AI unlimited money?

    you could just create an add_money script

    monitor_event FactionTurnStart not FactionIsLocal
    and FactionType spain
    and LosingMoney
    and Treasury < 0

    add_money spain 2000

    end_monitor

    that would give AI controlled spain 2000 if the faction is losing money and the treasury is less then zero


  3. #3
    The Count(er)'s Avatar Protector Domesticus
    Join Date
    May 2008
    Location
    Canada
    Posts
    4,134

    Default Re: Giving AI unlimited money?

    only issue with that is factions with 2 cities will be able to afford 1,000,000 soilders because they keep getting money that's why I wouldn't go overboard on how much they get each turn 500 may be a better number so their not broke but can't fill up their recruitment queue for free either
    Quote Originally Posted by Chaigidel View Post
    everyone but me is wrong.
    Ego's are fun

  4. #4

    Default Re: Giving AI unlimited money?

    Quote Originally Posted by The Count(er) View Post
    only issue with that is factions with 2 cities will be able to afford 1,000,000 soilders because they keep getting money that's why I wouldn't go overboard on how much they get each turn 500 may be a better number so their not broke but can't fill up their recruitment queue for free either
    that can easily be fixed with the blue line

    monitor_event FactionTurnStart not FactionIsLocal
    and FactionType spain
    and I_NumberOfSettlements spain > 2
    and LosingMoney
    and Treasury < 0

    add_money spain 2000

    end_monitor


  5. #5

    Default Re: Giving AI unlimited money?

    There are a number of conditions you could use to define when the AI would or could gain additional money. It comes down to personal preference on how you write the script. If you wanted the AI to gain money dependant on number of settlements it owns then something like...

    Code:
    monitor_event FactionTurnStart not FactionIsLocal
    and FactionType spain
    and LosingMoney
    and Treasury < 0
    
    if I_NumberOfSettlements spain = 1
    add_money spain 2000
    end_if
    
    if I_NumberOfSettlements spain = 2
    add_money spain 4000
    end_if
    
    if I_NumberOfSettlements spain = 3
    add_money spain 6000
    end_if
    
    if I_NumberOfSettlements spain = 4
    add_money spain 8000
    end_if
    
    end_monitor
    would suffice... The above code would give spain 2000 florins for every settlement it owned.

    ofcourse, that script would end up being rather long and may slow your turn timing down, so setting the number of settlements to >, < would help in shortening it. Such as...

    Code:
    monitor_event FactionTurnStart not FactionIsLocal
    and FactionType spain
    and LosingMoney
    and Treasury < 0
    
    if I_NumberOfSettlements spain < 6
    add_money spain 5000
    end_if
    
    if I_NumberOfSettlements spain > 5
    and I_NumberOfSettlements spain < 11
    add_money spain 10000
    end_if
    
    if I_NumberOfSettlements spain > 10
    and I_NumberOfSettlements spain < 16
    add_money spain 15000
    end_if
    
    if I_NumberOfSettlements spain > 15
    and I_NumberOfSettlements spain < 21
    add_money spain 20000
    end_if
    
    end_monitor
    Which would cover more settlements and shorten the script. Every 5 settlements would gain thew AI 5000.

    You could also base the entire script on how many settlements the player has and give each AI faction money dependant on how powerful the player is. Which would in itself make the AI challenging even when the player has 30+ settlements. You would just need the first part of the script to track which faction is the local faction.
    ...longbows, in skilled hands, could reach further than trebuchets...

  6. #6
    Indefinitely Banned
    Join Date
    Dec 2006
    Posts
    1,640

    Default Re: Giving AI unlimited money?

    Is there a way to measure the kings purse in the campaign_script?

    for instance
    if kings_purse > 0 ....

  7. #7

    Default Re: Giving AI unlimited money?

    as far as i know ... no... But you as the scripter already know the kings purse... its in descr strat for each faction. therefore you simply need to do what you need to do but keeping that knowledge at hand (as in, if you increment the kings purse in script, then you should know what it is has been incremented too seeing as you knew what it started at)... unless you increment it randomly in script...

    and unless you wish the script to find out how much the kings purse is at a certain time (after incrementation and such)... then no...


    alternatively, you could set a counter at the styart of your script for each faction which represents that factions kings purse. so taking england, 2300 is the kings purse, make a counter (declare_counter Engs_KiingPurse), then on turnstart (first turn only), set the counter to 2300... do that for each faction... then in script you simply need to know which faction your referring to and call on that counter in your if statement... i dont know what it is your trying to achieve so i cant really give any further advice on it

    hope i was of some help none the less...
    ...longbows, in skilled hands, could reach further than trebuchets...

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Giving AI unlimited money?

    They had a way of changing the king's purse in the British isle campaign. Have a look in the script there.










  9. #9

    Default Re: Giving AI unlimited money?

    yes you can change the kings purse a few ways in script... but i dont think you can track what it is... or if it is higher than somthing...etc...
    ...longbows, in skilled hands, could reach further than trebuchets...

  10. #10

    Default Re: Giving AI unlimited money?

    Gotcha everyone, big thanks for the help!

    A few questions about scripting, does this command: "and LosingMoney" check if the AI has negative income or is it determined some other way?
    "People don't think the universe be like it is, but it do." -- Neil deGrasse Tyson


    In Soviet Russia you want Uncle Sam.

  11. #11
    The Count(er)'s Avatar Protector Domesticus
    Join Date
    May 2008
    Location
    Canada
    Posts
    4,134

    Default Re: Giving AI unlimited money?

    and LosingMoney means the faction has to have a negative income to for the script to work
    Quote Originally Posted by Chaigidel View Post
    everyone but me is wrong.
    Ego's are fun

Posting Permissions

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