Results 1 to 6 of 6

Thread: Need help with Garrison script

Hybrid View

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

    Default Need help with Garrison script

    Hi!

    This is the first time I am writing to the forum so I apologize for my English! I have tried to write a script to create garrisons in some cities when they are besieged. I have tried something like this:

    monitor_event SettlementTurnStart SettlementName London
    and not I_settlementUnderSiege London
    set_counter London_siege 1
    end_monitor


    monitor_event SettlementTurnStart SettlementName London
    and I_CompareCounter London_siege = 1
    and I_SettlementOwner London=england
    and I_SettlementUnderSiege London
    and not SettlementIsLocal

    create_unit London, Town Militia, num 3, exp 0, arm 1, wep 0
    console_command add_money england, -510
    create_unit London, Archer Militia, num 3, exp 0, arm 1, wep 0
    console_command add_money england, -440
    create_unit London, Armored Sergeants, num 2, exp 1, arm 1, wep 1
    console_command add_money england, -600
    create_unit London, Longbowmen, num 2, exp 2, arm 0, wep 0
    console_command add_money england, -2200
    create_unit London, Dismounted English Knights, num 1, exp 1, arm 1, wep 1
    console_command add_money england, -800
    create_unit London, Dismounted Feudal Knights, num 1, exp 1, arm 1, wep 1
    console_command add_money england, -1800

    set_counter London_siege 0
    end_monitor
    Basically it works, except one thing. I want the garrison to be created only if the settlement owner is England (in the case of London). For some reason this is not work and the garrison is created even if the settlement owner is someone else. Do you have any idea about the problem?

  2. #2
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Need help with Garrison script

    Try adding spaces before and after the equality sign in your condition. I think these need to be there because the game splits the string at the positions of the spaces.

    No thing is everything. Every thing is nothing.

  3. #3

    Default Re: Need help with Garrison script

    You might also want to try moving the line 'and I_CompareCounter London_siege = 1' below the line 'and not SettlementIsLocal'.

    I believe the game tends to prefer similar conditions together. and considering all the conditions you have refer to 'settlement' except for the compare counter. so try moving the compare counter line down below them.
    ...longbows, in skilled hands, could reach further than trebuchets...

  4. #4
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Need help with Garrison script

    Quote Originally Posted by Tsarsies View Post
    You might also want to try moving the line 'and I_CompareCounter London_siege = 1' below the line 'and not SettlementIsLocal'.

    I believe the game tends to prefer similar conditions together. and considering all the conditions you have refer to 'settlement' except for the compare counter. so try moving the compare counter line down below them.
    This shouldn't matter. In my experience (and from a logical point of view, obviously), "and" conditions can be in any order you like them to be.

    No thing is everything. Every thing is nothing.

  5. #5

    Default Re: Need help with Garrison script

    This line as no spaces between London=england

    "and I_SettlementOwner London=england"


  6. #6

    Default Re: Need help with Garrison script

    Try adding spaces before and after the equality sign in your condition. I think these need to be there because the game splits the string at the positions of the spaces.
    Yes! It works! Thanks Alpaca

Posting Permissions

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