Results 1 to 18 of 18

Thread: Script to increase king's purse for AI factions

Hybrid View

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

    Default Script to increase king's purse for AI factions

    Hey.

    So this will be my first venture into the world of scripting. I want to make a script, essentially a money script, that increases the kings purse for all non-player factions. The script would do the following:

    1) Set a marker that identifies the player's faction. (would faction_is_local work for this)
    2) Increase the kings purse of all factions without the marker by 2000 florins.

    This would be a one time thing at the begining of the game.

    Is this do-able? And if so, how would I go about it?

    Your help is most appreciated!

  2. #2
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Script to increase king's purse for AI factions

    Code:
        monitor_event FactionTurnStart FactionType england
            and IsFactionAIControlled
                    
            set_kings_purse england 2000
            
           terminate_monitor
        end_monitor
    repeat that for all factions

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  3. #3

    Default Re: Script to increase king's purse for AI factions

    Thanks!

    No way to avoid doing it for each individual faction, then?

    ................


    Follow-up question: would the script above add 2000 florins to the purse, or merely set the purse at 2000?
    Last edited by Triumvere; November 02, 2009 at 04:55 AM.

  4. #4
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Script to increase king's purse for AI factions

    No, because you need to define the faction of which you wish to set the purse.

    EDIT: If you wish to add 2,000 use the command increment_kings_purse. If you wish to add 2,000 each turn don't terminate the monitor.
    Last edited by konny; November 02, 2009 at 04:59 AM.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  5. #5

    Default Re: Script to increase king's purse for AI factions

    How about this:

    income_bonus bonus 2000

  6. #6

    Default Re: Script to increase king's purse for AI factions

    Ok, just checking to see if I understand...


    Code:
        monitor_event FactionTurnStart FactionType england
            and IsFactionAIControlled
     
            increment_kings_purse england 2000
     
           terminate_monitor
        end_monitor
    And will this result in A) a one-time bonus of 2000, or B) a permanent increase of 2000 (ie, 2000 florins income every turn?)

    I take it that the answer is A? And if I cut out the "terminate monitor" I get B?

  7. #7
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Script to increase king's purse for AI factions

    Quote Originally Posted by Triumvere View Post
    I take it that the answer is A? And if I cut out the "terminate monitor" I get B?
    correct. Now you know what terminate_monitor does.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  8. #8

    Default Re: Script to increase king's purse for AI factions

    Ok, great! I'll give it a try. My point of confusion was over "kings purse" was a sum or a rate, ie. whether the script would result in 2000 extra florins per turn, or a cumulative increase of 2000 florins of income (2000, 4000, 8000,....)


    update: appears to be working! thanks!
    Last edited by Triumvere; November 02, 2009 at 09:06 AM.

  9. #9
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Script to increase king's purse for AI factions

    The kings purse is how much the faction gets each turn, it is not a one time deal. So if the kings purse is 1500, the faction gets 1500 each turn, plus all settlement incomes.

    If you use set_kings_purse 2000, then the faction will get 2000 each turn.

    If you use increment_kings_purse 2000 then that 2000 is added to the previous 1500 for a total of 3500, and the faction will get that every turn.

    If you want to add money for a single turn then use the add_money command.

  10. #10

    Default Re: Script to increase king's purse for AI factions

    Quote Originally Posted by GrnEyedDvl View Post
    The kings purse is how much the faction gets each turn, it is not a one time deal. So if the kings purse is 1500, the faction gets 1500 each turn, plus all settlement incomes.

    If you use set_kings_purse 2000, then the faction will get 2000 each turn.

    If you use increment_kings_purse 2000 then that 2000 is added to the previous 1500 for a total of 3500, and the faction will get that every turn.

    If you want to add money for a single turn then use the add_money command.
    Thanks for the clarification. Thats without terminating the script, I take it. Well, I'm using the script and it hasn't crashed, but I don't really have a way of telling whether it is working or not. Also, the script I have prior to it does not seem to be working properly... I don't know if I messed it up or not when I put on the new script. Would you mind taling a look? It is supposed to pass special "king" battle models to new kings:

    Code:
    ;------------------- FACTION LEADER MODELS -------------------; 
     monitor_event BecomesFactionLeader FactionType byzantium
      change_battle_model byzantium leader andronicus
     end_monitor
     monitor_event BecomesFactionLeader FactionType england
      change_battle_model england leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType france
      change_battle_model france leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType hre
      change_battle_model hre leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType spain
      change_battle_model spain leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType venice
      change_battle_model venice leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType sicily
      change_battle_model sicily leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType milan
      change_battle_model milan leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType scotland
      change_battle_model scotland leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType ireland
      change_battle_model ireland leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType russia
      change_battle_model russia leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType kiev
      change_battle_model kiev leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType moors
      change_battle_model moors leader eastern_sultan
     end_monitor
     monitor_event BecomesFactionLeader FactionType turks
      change_battle_model turks leader sultan_nur_eldin
     end_monitor
     monitor_event BecomesFactionLeader FactionType egypt
      change_battle_model egypt leader sultan_saladin
     end_monitor
     monitor_event BecomesFactionLeader FactionType denmark
      change_battle_model denmark leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType norway
      change_battle_model norway leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType portugal
      change_battle_model portugal leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType poland
      change_battle_model poland leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType hungary
      change_battle_model hungary leader oneill_general
     end_monitor
    ;------------------- KINGS PURSE -------------------; 
     monitor_event FactionTurnStart FactionType england and IsFactionAIControlled
             increment_kings_purse england 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType ireland and IsFactionAIControlled
             increment_kings_purse ireland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType scotland and IsFactionAIControlled
             increment_kings_purse scotland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType denmark and IsFactionAIControlled
             increment_kings_purse denmark 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType norway and IsFactionAIControlled
             increment_kings_purse norway 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType france and IsFactionAIControlled
             increment_kings_purse france 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType hre and IsFactionAIControlled
             increment_kings_purse hre 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType spain and IsFactionAIControlled
             increment_kings_purse spain 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType portugal and IsFactionAIControlled
             increment_kings_purse portugal 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType venice and IsFactionAIControlled
             increment_kings_purse venice 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType milan and IsFactionAIControlled
             increment_kings_purse milan 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType sicily and IsFactionAIControlled
             increment_kings_purse sicily 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType hungary and IsFactionAIControlled
             increment_kings_purse hungary 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType poland and IsFactionAIControlled
             increment_kings_purse poland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType russia and IsFactionAIControlled
             increment_kings_purse russia 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType kiev and IsFactionAIControlled
             increment_kings_purse kiev 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType byzantium and IsFactionAIControlled
             increment_kings_purse byzantium 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType turks and IsFactionAIControlled
             increment_kings_purse turks 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType moors and IsFactionAIControlled
             increment_kings_purse moors 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType egypt and IsFactionAIControlled
             increment_kings_purse egypt 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType timurids and IsFactionAIControlled
             increment_kings_purse timurids 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType mongols and IsFactionAIControlled
             increment_kings_purse mongols 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType aztecs and IsFactionAIControlled
             increment_kings_purse aztecs 2000
     end_monitor
     
    end_script

  11. #11
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Script to increase king's purse for AI factions

    Quote Originally Posted by Triumvere View Post
    Thanks for the clarification. Thats without terminating the script, I take it.
    You are looking at this wrong. The terminate_monitor command simply keeps that monitor from firing again. Lets assume once again that the kings purse is 1500, and you have this in your script:

    Code:
    monitor_event FactionTurnEnd FactionIsLocal
    increment_kings_purse england 2000
    terminate_monitor
    end_monitor

    The first time you click EndTurn the kings purse for England will go from 1500 to 3500 and stay there for the rest of the game. Every turn England will get 3500 from the Kings Purse.

    However if you remove the terminate_monitor line, it will add 2000 to whatever the current value is every turn.

    So after turn 1 3500
    Turn 2 5500
    Turn 3 7500
    Turn 4 9500
    Turn 5 11500

    And so on...

    The kings purse is always there, what the increment command does is increase/decrease the amount the faction gets every turn. The set command will set it to the specified value and leave it there until you change it either by using the set command again or the increment command.

    Use terminate_monitor if you only want it to increase 1 time. Or set a bunch of other conditions and make the amount go up and down as the game progresses.




    Also, the script I have prior to it does not seem to be working properly... I don't know if I messed it up or not when I put on the new script. Would you mind taling a look? It is supposed to pass special "king" battle models to new kings:

    Code:
    ;------------------- FACTION LEADER MODELS -------------------; 
     monitor_event BecomesFactionLeader FactionType byzantium
      change_battle_model byzantium leader andronicus
     end_monitor
     monitor_event BecomesFactionLeader FactionType england
      change_battle_model england leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType france
      change_battle_model france leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType hre
      change_battle_model hre leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType spain
      change_battle_model spain leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType venice
      change_battle_model venice leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType sicily
      change_battle_model sicily leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType milan
      change_battle_model milan leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType scotland
      change_battle_model scotland leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType ireland
      change_battle_model ireland leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType russia
      change_battle_model russia leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType kiev
      change_battle_model kiev leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType moors
      change_battle_model moors leader eastern_sultan
     end_monitor
     monitor_event BecomesFactionLeader FactionType turks
      change_battle_model turks leader sultan_nur_eldin
     end_monitor
     monitor_event BecomesFactionLeader FactionType egypt
      change_battle_model egypt leader sultan_saladin
     end_monitor
     monitor_event BecomesFactionLeader FactionType denmark
      change_battle_model denmark leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType norway
      change_battle_model norway leader edward_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType portugal
      change_battle_model portugal leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType poland
      change_battle_model poland leader oneill_general
     end_monitor
     monitor_event BecomesFactionLeader FactionType hungary
      change_battle_model hungary leader oneill_general
     end_monitor
    ;------------------- KINGS PURSE -------------------; 
     monitor_event FactionTurnStart FactionType england and IsFactionAIControlled
             increment_kings_purse england 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType ireland and IsFactionAIControlled
             increment_kings_purse ireland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType scotland and IsFactionAIControlled
             increment_kings_purse scotland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType denmark and IsFactionAIControlled
             increment_kings_purse denmark 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType norway and IsFactionAIControlled
             increment_kings_purse norway 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType france and IsFactionAIControlled
             increment_kings_purse france 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType hre and IsFactionAIControlled
             increment_kings_purse hre 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType spain and IsFactionAIControlled
             increment_kings_purse spain 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType portugal and IsFactionAIControlled
             increment_kings_purse portugal 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType venice and IsFactionAIControlled
             increment_kings_purse venice 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType milan and IsFactionAIControlled
             increment_kings_purse milan 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType sicily and IsFactionAIControlled
             increment_kings_purse sicily 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType hungary and IsFactionAIControlled
             increment_kings_purse hungary 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType poland and IsFactionAIControlled
             increment_kings_purse poland 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType russia and IsFactionAIControlled
             increment_kings_purse russia 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType kiev and IsFactionAIControlled
             increment_kings_purse kiev 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType byzantium and IsFactionAIControlled
             increment_kings_purse byzantium 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType turks and IsFactionAIControlled
             increment_kings_purse turks 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType moors and IsFactionAIControlled
             increment_kings_purse moors 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType egypt and IsFactionAIControlled
             increment_kings_purse egypt 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType timurids and IsFactionAIControlled
             increment_kings_purse timurids 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType mongols and IsFactionAIControlled
             increment_kings_purse mongols 2000
     end_monitor
     
     monitor_event FactionTurnStart FactionType aztecs and IsFactionAIControlled
             increment_kings_purse aztecs 2000
     end_monitor
     
    end_script
    I didnt see anything wrong with the models script, but I have a few questions. Is there anything in your log? Are you sure you have models named properly? And are you waiting for a character to become the new faction leader?

    I suggest a simple test. Create a blank script and insert this:

    Code:
     monitor_event FactionTurnEnd FactionIsLocal
      change_battle_model england leader edward_general
     end_monitor
    Play as england and see if the model changes after the first turn.

  12. #12

    Default Re: Script to increase king's purse for AI factions

    However if you remove the terminate_monitor line, it will add 2000 to whatever the current value is every turn.

    So after turn 1 3500
    Turn 2 5500
    Turn 3 7500
    Turn 4 9500
    Turn 5 11500
    That was what I was initially afraid of... well, then it CAN'T be working, as I am playing right now, and the money the AI would be raking in would be absurd...

  13. #13

    Default Re: Script to increase king's purse for AI factions

    Quote Originally Posted by Triumvere View Post
    That was what I was initially afraid of... well, then it CAN'T be working, as I am playing right now, and the money the AI would be raking in would be absurd...
    Ok, figured out what went wrong:

    I accidentally deleted "wait_monitors" from the end of the script, causing the entire thing to be non-functional. No balooning kings purse, no faction leader models, no mongol invasions, no nothing.

    It's fixed now. I'll give the kings purse another go.

    ___________________


    Update: Ok, so the script is running.... I added the terminate_monitor line, which is working properly. However "faction_is_ai_controled" is not... The kings purse script is giving the bonus to the player as well. Any ideas?
    Last edited by Triumvere; November 09, 2009 at 10:43 PM.

Posting Permissions

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