Page 1 of 3 123 LastLast
Results 1 to 20 of 58

Thread: Garrison Script

Hybrid View

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

    Default Garrison Script

    Tutorial for a Garrisonscript


    Open campaign_script.txt
    This is the code, which we implent in campaign_script.txt

    Code:
    ;=========================================================================================
    
    
    ;---------- Counter ----------
    
    declare_counter rome_siege
    
    
    ;---------- Garrionscript ----------
     
    monitor_conditions not I_SettlementUnderSiege Rome            
            set_counter rome_siege 0
    end_monitor
    
    monitor_conditions I_SettlementUnderSiege Rome            
            and I_CompareCounter rome_siege = 0
    
    if I_SettlementOwner Rome = papal_states                    
        create_unit Rome, peasant, num 2, exp 2, arm 1, wep 0
    end_if        
    
    set_counter rome_siege 1
    
    end_monitor
    First we set the counter rome_siege to 0.
    If Rome is now under siege ("I_SettlementUnderSiege Rome" ) and is controlled by the papal states ("if I_SettlementOwner Rome = papal_states"), we spawn 2 Peasants ("num 2") with 2 experience (maximum 9) 1 Weaponupgrade (maximum 9) and no Armourupgrade (maximum 9) in Rome.
    Now we set the counter rome_siege to 1, because we don't want to spawn the troops two times

    Congrats, you have no written a full functional Garrisonscript.

    Now you can implent some nice features like, if Arabs siege Rome you Spawn more troops etc.


    Code:
    ;=========================================================================================
    
    
    ;---------- Counter ----------
    
    declare_counter rome_siege
    
    
    ;---------- Garrionscript ----------
     
    monitor_conditions not I_SettlementUnderSiege Rome            
            set_counter rome_siege 0
    end_monitor
    
    monitor_conditions I_SettlementUnderSiege Rome            
            and I_CompareCounter rome_siege = 0
    
    if I_SettlementOwner Rome = papal_states 
    and I_FactionBesieging egypt                  
        create_unit Rome, Feudal Knights, num 4, exp 2, arm 5, wep 5
    end_if        
    
    set_counter rome_siege 1
    
    end_monitor
    The small additonial line "and I_FactionBesieging egypt" give the game all inforamtions ehich are needed.



    You can also make more conditions.
    For example if it is a citadel better units will spawn:


    Code:
    ;=========================================================================================
    
    ;---------- Counter ----------
    
    declare_counter rome_siege
    
    ;---------- Garrionscript ----------
    
    
    monitor_conditions not I_SettlementUnderSiege Rome            
            set_counter rome_siege 0
    end_monitor
    
    monitor_conditions I_SettlementUnderSiege Rome            
            and I_CompareCounter rome_siege = 0
    
    
    if I_SettlementOwner Rome = papal_states 
    and I_FactionBesieging egypt                  
    and SettlementBuildingExists = citadel    
        create_unit Rome, Feudal Knights, num 4, exp 2, arm 5, wep 5
        create_unit Rome, Armored Sergeants, num 4, exp 2, arm 5, wep 5
    end_if        
    
    set_counter rome_siege 1
    end_monitor
    I hope this small Tutorial will help

    regards weissnicht

  2. #2

    Default Re: Garrisonscript

    Hey, very nice tutorial. +rep(when i have 50 posts)

  3. #3

  4. #4
    Userpro's Avatar =RAE= HostedMod Creator
    Join Date
    Jul 2008
    Location
    regno germanicum, teutonical forest
    Posts
    1,673

    Default Re: Garrison Script

    Well done - the very first tutorial about integrating a garrison script!
    Visit our TWC M2TW-Kingdoms Hosted Mods Forum for...

    !!! RAE Development stopped --- read last Statement here !!!
    M2TW-Kingdoms Mod Creator REDEO AD EXORDIUM ( RAE )
    Progress: 95% internal final beta release - 85% official release
    RAE TWC-Wiki Eagle Standard interview ... RAE.net Homepage ... RAE TWZ-Germany
    Proudly Sega & Steam Boycotter since ETW! See why here or this petition
    Sorry for bad english here, there and in my tutorials > advanced horde invasion & hide/unhide stratmap-ui & Beginners modding



  5. #5

  6. #6

    Default Re: Garrison Script

    +rep
    Nice tutorial.

    You should check out my garrison script for additional ideas as i figured out a way to incorporate every settlment (199 is max) every faction (31 is max i think) and every unit (500 units is max i believe) into the one script and it causes no turn lag. I wrote the script for Stainless Steel originally and then helped King Kong adopt it for TATW. You can even have different units spawn depending on what year it is in game or what events have fired during the game. It is a very versatile garrison script.
    ...longbows, in skilled hands, could reach further than trebuchets...

  7. #7

    Default Re: Garrison Script

    I've already checked your great garrisonscript. Maybe I will adapt some infos from it and will implent them in this tut

  8. #8

    Default Re: Garrison Script

    Quote Originally Posted by weissnicht View Post

    Now you can implent some nice features like, if Arabs siege Rome you Spawn more troops etc.


    Code:
    ;=========================================================================================
    
    
    ;---------- Counter ----------
    
    declare_counter rome_siege
    
    
    ;---------- Garrionscript ----------
     
    monitor_conditions not I_SettlementUnderSiege Rome            
            set_counter rome_siege 0
    end_monitor
    
    monitor_conditions I_SettlementUnderSiege Rome            
            and I_CompareCounter rome_siege = 0
    
    if I_SettlementOwner Rome = papal_states 
    and I_FactionBesieging egypt                  
        create_unit Rome, Feudal Knights, num 4, exp 2, arm 5, wep 5
    end_if        
    
    set_counter rome_siege 1
    
    end_monitor
    The small additonial line "and I_FactionBesieging egypt" give the game all inforamtions ehich are needed.


    Nice tutorial , but i have one question...

    if I want make garrison for Rome if this city under siege by one of Islamic Faction such as : Turks, Egypt, Moors ?

    What I have to make 3 garrison scripts one by one ? Or is there any other solution without making 3 garrison script, but only 1 garrison script ?

    example :

    if I_SettlementOwner Rome = papal_states
    and I_FactionBesieging egypt, turks, moors

    Can the script works ?
    Last edited by longbowmen100; February 20, 2010 at 07:11 PM.

  9. #9
    IZob's Avatar Citizen
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    9,829

    Default Re: Garrison Script

    I would think just adding in the comma for eg: "and I_FactionBesieging egypt, turks, moors, hre, venice" etc... that should work. You can alwasy try it out/test it.
    Contact me on Steam: steamcommunity.com/id/IZob/ or send a PM.

  10. #10

    Default Re: Garrison Script

    Yeah, try it out (you can script an army and let them attack rome) or you write 3 different garrison scripts for Rome, when besieged by moors, turks or egypt etc.

    Nice tutorial , but i have one question...
    Thank you
    You can pay in €uro or rep

  11. #11

    Default Re: Garrison Script

    I have tried but not work.
    "and I_FactionBesieging egypt, turks, moors, hre, venice"


  12. #12

    Default Re: Garrison Script

    Then you have to write different scripts for each settlement.
    But I will try to find a way to make one Code per settlement

  13. #13
    yujote's Avatar Semisalis
    Join Date
    Jun 2010
    Location
    Indianapolis, Indiana
    Posts
    404

    Default Re: Garrison Script

    will this work with Third age Total war?
    Check Out My Gaming Blog! (Help Wanted)

  14. #14

  15. #15
    HELLEKIN's Avatar Miles
    Join Date
    Nov 2007
    Location
    LISBON - PORTUGAL
    Posts
    396

    Default Re: Garrison Script

    hello,everyone,i would like to know if this works in vanilla?many thanks in advance
    Homo Homini Lupus

  16. #16

    Default Re: Garrison Script

    Hi. After the siege, would the free garrison units disband a la Empire and Shogun 2, or would they remain in the city? If the latter, is there a way to automatically disband them after the city is saved?

  17. #17
    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: Garrison Script

    You could edit this monitor to 'retire' garrison units (which requires additional EDU slots where you give a custom attribute to those units that you spawn):

    Code:
    monitor_conditions not I_SettlementUnderSiege Rome                     
            set_counter rome_siege 0
            destroy_units [faction] [custom attribute]
     end_monitor










  18. #18
    Badger-dude's Avatar Primicerius
    Join Date
    Sep 2005
    Location
    United Kingdom
    Posts
    3,033

    Default Re: Garrison Script

    If the garrison already is full (20 units), will the script:

    1) Spawn adjacent
    or
    2) Spawn nothing?

  19. #19
    Vegas_Bear's Avatar Biarchus
    Join Date
    Sep 2005
    Location
    Las Vegas, NV
    Posts
    605

    Default Re: Garrison Script

    Quote Originally Posted by Badger-dude View Post
    If the garrison already is full (20 units), will the script:

    1) Spawn adjacent
    or
    2) Spawn nothing?
    If under siege, nothing.

    VB

  20. #20
    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: Garrison Script

    The spawn will add units to the garrison and when the limit is reached, nothing will happen after that.










Page 1 of 3 123 LastLast

Posting Permissions

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