Results 1 to 12 of 12

Thread: Creating Garrison Script.

Hybrid View

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

    Default Re: Creating Garrison Script.

    Bardo, i got confused a bit with your instructions :(.
    Could you please just clarify this for me.
    Am i right here:

    [city name = map name = Acre, faction1 = sassanids, faction 2 = franks, unit name = crusader latin knigts (just for testing)]

    Code:
    script
    This For each Settlement
    Code:
    declare_counter AcreBesiged
    set_counter AcreBesiged 0
    Repeat For Each Faction
    Code:
    monitor_event FactionTurnEnd FactionType sassanids
    and I_LocalFaction sassanids
    
    ;;;;;;;Repeat For Each Settlement;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       if I_CompareCounter AcreBesiged = 0
          and not I_SettlementOwner Acre = sassanids
          if I_CharacterTypeNearTile sassanids general,  2 151,162
             set_counter AcreBesiged 1
          end_if
          if I_CharacterTypeNearTile sassanids family,  2 151,162
             set_counter AcreBesiged 1
          end_if
       end_if
       if I_CompareCounter AcreBesiged = 2
          and not I_CharacterTypeNearTile sassanids family, 2 151,162
          and not I_CharacterTypeNearTile sassanids general, 2 151,162
          set_counter AcreBesiged 0
       end_if
    ;;;;;;;^^^Repeat for Each Settlement^^^;;;;;;;;;;;;;;;;;;;;
    
    end_monitor
    This Monitor For Every Settlement
    Code:
    monitor_event SettlementTurnEnd SettlementName Acre
       and I_CompareCounter AcreBesiged = 1
       and GarrisonSettlementRatio < 0.5
          if I_SettlementOwner Acre = sassanids
             console_command create_unit Acre "crusader latin knights" 4
             console_command add_money -2000       
             console_command add_population Acre -1500
          end_if
          if I_SettlementOwner Acre = franks
             console_command create_unit Acre "crusader latin knights" 4
             console_command add_money -2000       
             console_command add_population Acre -1500
          end_if
          if I_SettlementOwner Acre = slave
             console_command create_unit Acre "crusader latin knights" 4
             console_command add_money -2000       
             console_command add_population Acre -1500
          end_if
          set_counter AcreBesiged 2
    end_monitor
    Code:
    while TrueCondition
    end_while
    
    end_script
    Did i understand your instructions correctly?
    Thanks Bardo.

  2. #2

    Default Re: Creating Garrison Script.

    Bardo
    Thanks bro, i made it work!
    The problem was i forgot to add
    "declare_counter loop
    set_counter loop 0" in the begginning

    and

    "while I_CompareCounter loop = 0
    end_while
    end_script

    in the end".

    Also thanks a lot for letting me use your kind. It was very kind of you. Hopefully it is going to be included in a new patch for the Crusades!
    Now i'm gonna have to copy it for all the factions))) A lot of boring work to do))

  3. #3

    Default Re: Creating Garrison Script.

    Did i understand your instructions correctly?
    Yes, you understood right.

    Also thanks a lot for letting me use your kind.
    No problem, man. In fact, mine is just an evolution from LorDBula's.
    And I'm happy if my work is useful to other people.

    The problem was i forgot to add...
    Weird, because this code has the same effect:
    Code:
    while TrueCondition
    end_while
    than that:
    Code:
    declare_counter loop
    set_counter loop 0
    while I_CompareCounter loop = 0
    end_while
    Now i'm gonna have to copy it for all the factions))) A lot of boring work to do))
    I agree... really boring.

    You can pm me if you have some other doubt, or if you find some bug in the script.

  4. #4

    Default Re: Creating Garrison Script.

    I followed Bardo's guide and it works. Thanks!
    Last edited by Hoginator01; 09-03-2010 at 20:39.
    Respectfully,

    Hoginator01

  5. #5

    Default Re: Creating Garrison Script.

    Note I find that garrison script too complicated and hard to maintain, since it needs all the settlement names and coordinates. If I would have to create a garrison script now, from scratch, I would use one based on this simpler method:

    Code:
    monitor_event CharacterTurnEndInSettlement FactionType [faction name]
       and IsUnderSiege
       and SettlementName [settlement MAP name]
    
          console_command create_unit [settlement INTERNAL name] "[unit name]" 1
    
    end_monitor
    The limitation is it only works if there is a named character inside the city, but you only need to write one monitor per city.
    It would be easy to add one named charater at each city, and to give them a trait with penalty to movement points to avoid AI move them.

    I already used this method for siege of Helm's Deep in our mod and it works. I would just need to add a counter to avoid the script being triggered every turn.

    I tried to place other useful info about scripts here:
    http://www.twcenter.net/forums/showthread.php?t=300345
    Last edited by Bardo; 09-03-2010 at 21:43.

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