Results 1 to 13 of 13

Thread: New Garrison Script Demonstration

Hybrid View

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

    Icon1 New Garrison Script Demonstration

    The new garrison script has a major advantage over the one that Third Age 3.1 currently uses in that it destroy the units it creates when the siege is over.

    Unlike the old garrison script, the new one does not create the units when the settlement is first besieged. Instead, the units are created when the settlement is about to be assaulted (that when the battle deployment scroll appears). I should also mention, if you decided to call off the assault at that point, the garrison units are destroyed.

    The new garrison script only covers the Isengard faction. All the other factions are still using the old one.

    I'd like to thank, Withwnar for helping with the units, and Gigantus for the idea of using ‘GeneralAssaultsResidence’ as the monitor event for a garrison script:
    Spoiler Alert, click show to read: 
    Code:
    ;###### Isengard Garrison Script: By TNZ and Withwnar #######
    ;###### For TA 3.1 #######
    
    declare_counter france_garrison
    
    ;###### Isengard Garrison Script: Local vs AI #######
    
    	monitor_event GeneralAssaultsResidence FactionIsLocal
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Nan-Curunir_Province
        		and I_SettlementUnderSiege Nan-Curunir
    		create_unit Nan-Curunir, Garrison Orthanc Guard, num 4, exp 2, arm 0, wep 0
    		create_unit Nan-Curunir, Garrison Uruk-Hai Raiders, num 4, exp 2, arm 0, wep 0
    		create_unit Nan-Curunir, Garrison Uruk-Hai Archers, num 2, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence FactionIsLocal 
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Dunland_Province
        		and I_SettlementUnderSiege Dunland
    		create_unit Dunland, Garrison Dunlendings, num 4, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 2, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence FactionIsLocal
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Dunland-Hills_Province
        		and I_SettlementUnderSiege Dunland-Hills
    		create_unit Dunland-Hills, Garrison Dunlendings, num 4, exp 0, arm 0, wep 0
    		create_unit Dunland-Hills, Garrison Dunlending Axemen, num 2, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    ;###### Isengard Garrison Script: AI vs AI #######
    
    	monitor_event GeneralAssaultsResidence not FactionIsLocal
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Nan-Curunir_Province
        		and I_SettlementUnderSiege Nan-Curunir
    		create_unit Nan-Curunir, Garrison Orthanc Guard, num 6, exp 2, arm 0, wep 0
    		create_unit Nan-Curunir, Garrison Uruk-Hai Raiders, num 6, exp 2, arm 0, wep 0
    		create_unit Nan-Curunir, Garrison Uruk-Hai Archers, num 4, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence not FactionIsLocal 
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Dunland_Province
        		and I_SettlementUnderSiege Dunland
    		create_unit Dunland, Garrison Dunlendings, num 6, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 4, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence not FactionIsLocal
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Dunland-Hills_Province
        		and I_SettlementUnderSiege Dunland-Hills
    		create_unit Dunland-Hills, Garrison Dunlendings, num 6, exp 0, arm 0, wep 0
    		create_unit Dunland-Hills, Garrison Dunlending Axemen, num 4, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    ;###### Isengard Garrison Script: AI vs Local #######
    
    	monitor_event GeneralAssaultsResidence  not FactionIsLocal
    		and TargetFactionType france
    		and I_LocalFaction france
    		and IsTargetRegionOneOf Nan-Curunir_Province
        		and I_SettlementUnderSiege Nan-Curunir
    		create_unit Nan-Curunir, Garrison Orthanc Guard, num 2, exp 2, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence  not FactionIsLocal
    		and TargetFactionType france
    		and I_LocalFaction france
    		and IsTargetRegionOneOf Dunland_Province
        		and I_SettlementUnderSiege Dunland
    		create_unit Dunland, Garrison Dunlendings, num 2, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 1, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    	monitor_event GeneralAssaultsResidence  not FactionIsLocal
    		and TargetFactionType france
    		and I_LocalFaction france
    		and IsTargetRegionOneOf Dunland-Hills_Province
        		and I_SettlementUnderSiege Dunland-Hills
    		create_unit Dunland-Hills, Garrison Dunlendings, num 2, exp 0, arm 0, wep 0
    		create_unit Dunland-Hills, Garrison Dunlending Axemen, num 1, exp 0, arm 0, wep 0
    		set_counter france_garrison 1
    	end_monitor
    
    ;###### Isengard Garrison Script: Destroy France Garrison #######
    
    	monitor_event PostBattle IsRegionOneOf Nan-Curunir_Province, Dunland_Province, Dunland-Hills_Province
    		and I_CompareCounter france_garrison = 1
    		destroy_units france garrison_unit
    		set_counter france_garrison 0
    	end_monitor
    
    	monitor_event PreBattleWithdrawal IsRegionOneOf Nan-Curunir_Province, Dunland_Province, Dunland-Hills_Province
    		and I_CompareCounter france_garrison = 1
    		destroy_units france garrison_unit
    		set_counter france_garrison 0
    	end_monitor
    All the files needed to try it out are attached below:
    Last edited by TNZ; January 07, 2012 at 03:24 PM.

  2. #2
    francis86's Avatar Decanus
    Join Date
    May 2011
    Location
    Drummondville/Quebec
    Posts
    519

    Default Re: New Garrison script Demonstration

    what are the benefits of seeing the unit when the settlement is about to be assaulted

    srry my mind is not really good with all beer I drunk this week lol

  3. #3

    Icon1 Re: New Garrison script Demonstration

    Quote Originally Posted by francis86 View Post
    what are the benefits of seeing the unit when the settlement is about to be assaulted

    srry my mind is not really good with all beer I drunk this week lol
    Well for one it stops the AI using the garrison units aggressively, two it makes the script much easier to write.

  4. #4
    webba84's Avatar Artifex
    Join Date
    Sep 2011
    Location
    Staddle
    Posts
    6,921

    Default Re: New Garrison script Demonstration

    francis86 - you are probably going to regret posting that when you sober up

    TNZ - This looks like a very interesting idea! It would certainly limit the current way around the garrison script of assaulting first turn with catapults and better serve to fulfill the purpose of the garrison scripts at all (to help the ai defend its critical large settlements better) I like also that you are deleting the garrison units after the battle.

    So the script makes it harder to sneakily take important cities and at the same time doesn't mean the garrison script suddenly gives the ai a free, high level army. Balanced positives all round I feel.

    Will you be making it for the rest of the factions as well?

  5. #5
    TW_User's Avatar Libertus
    Join Date
    Jan 2010
    Location
    BW, Germany
    Posts
    59

    Default Re: New Garrison script Demonstration

    Good job, Deatheye used in his German mod "Choceur", too.
    Will you be making it for the rest of the factions as well?
    Yeah, that would be perfect.
    German Medieval: 2 Total War Freak and Modder

  6. #6

    Icon1 Re: New Garrison script Demonstration

    webba84: Because the new garrison script destroys the units it creates after the siege, you need to add new units to the ‘export_descr_unit’ file, exclusively for the garrison script to use, or you could end up destroying the faction’s field armies as well as the garrison you want to destroy.

    Unfortunately the ‘export_descr_unit’ file has a limit on how many units can be added to it. So to maintain efficient use of the limited spaces, we are talking about completely new units with new textures, so they can be used by as many of the factions as possible. This is, of course, further complicated by the fact we have multiple factions who can't share the same units.

    So if someone is prepared to do that, then, yes, I see no reason why it couldn't extend to all the factions, but doing that is way out of my skill set.

  7. #7
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: New Garrison script Demonstration

    Quote Originally Posted by TNZ View Post
    So to maintain efficient use of the limited spaces, we are talking about completely new units with new textures, so they can be used by as many of the factions as possible.
    As in textures without any specific faction's insignia or anything else that would identify them as being in the wrong faction.

  8. #8

    Default Re: New Garrison script Demonstration

    Quote Originally Posted by TNZ View Post

    Unfortunately the ‘export_descr_unit’ file has a limit on how many units can be added to it. So to maintain efficient use of the limited spaces, we are talking about completely new units with new textures, so they can be used by as many of the factions as possible. This is, of course, further complicated by the fact we have multiple factions who can't share the same units.
    Well an easy way to help with that, you can edit the Model DB to make all units available to all factions, just make them not buildable, ( and add mercenary_unit to the unit entry,) only placed by this garrison script.

    So if someone is prepared to do that, then, yes, I see no reason why it couldn't extend to all the factions, but doing that is way out of my skill set.
    UI already in each faction, so can be copy pasted, all you really need to do to further this is to change the Model DB ownership.
    “Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote.” Benjamin Franklin

  9. #9

    Default Re: New Garrison Script Demonstration

    Are you still working on this script?This is exaclty whats missing from the current vanilla game.And if you could add the city population to the script aswell that it will generate the army according to city size it would be perfect. I hope this works for player aswell?After that we only need to make the AI understand that they dont need to have huge armies on each city and make new Settler units for each faction like in Empire series, so instead of pro armies local farmers etc defend their home.

  10. #10

    Default Re: New Garrison script Demonstration

    hi, i take a look at the the files and noticed that one of the parts of the script it's for AI vs Local... does this mean that the human player also have a garrison script when attacked?? oh and another thing, does the script have some time to reload until it fires again or it's activated every time the settlement it's attacked??

    thk
    Last edited by LethaL; January 07, 2012 at 01:03 PM.

  11. #11

    Icon1 Re: New Garrison Script Demonstration

    LethaL: Yes, that bit gives the human player units. Every time the settlement is assaulted, the units are created.

  12. #12
    francis86's Avatar Decanus
    Join Date
    May 2011
    Location
    Drummondville/Quebec
    Posts
    519

    Default Re: New Garrison Script Demonstration

    Ho I understand,its really great and thats kind of stuff baron would like to put in his compilation I think

    Kind the same thing as empire,shogun 2 and napoleon,when ennemy attack a settlement,the local population help to defend the city

    does the number of garrison unit will depend of the city's population?

  13. #13

    Icon1 Re: New Garrison Script Demonstration

    Quote Originally Posted by francis86 View Post
    does the number of garrison unit will depend of the city's population?
    francis86: No, it doesn't, but it wouldn't be too hard to add the idea to the script:
    Spoiler Alert, click show to read: 
    Code:
    ;###### Isengard Garrison Script: Settlement Core Level #######
    
    declare_counter Dunland_Core_Level
    
    ;###### Dunland
    
    set_counter Dunland_Core_Level 2
    
    	monitor_event BuildingCompleted SettlementName Dunland
    		and SettlementBuildingFinished = stone_wall
    		set_counter Dunland_Core_Level 3
    	terminate_monitor
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementName Dunland
    		and SettlementBuildingFinished = large_stone_wall
    		set_counter Dunland_Core_Level 4
    	terminate_monitor
    	end_monitor
    
    	monitor_event BuildingCompleted SettlementName Dunland
    		and SettlementBuildingFinished = huge_stone_wall
    		set_counter Dunland_Core_Level 5
    	terminate_monitor
    	end_monitor
    
    ;###### Isengard Garrison Script: By TNZ and Withwnar #######
    ;###### For TA 3.1 #######
    
    declare_counter france_garrison
    
    	monitor_event GeneralAssaultsResidence FactionIsLocal 
    		and TargetFactionType france
    		and I_IsFactionAIControlled france
    		and IsTargetRegionOneOf Dunland_Province
        		and I_SettlementUnderSiege Dunland
    		if I_CompareCounter Dunland_Core_Level = 2
    		create_unit Dunland, Garrison Dunlendings, num 4, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 2, exp 0, arm 0, wep 0
    	end_if
    		if I_CompareCounter Dunland_Core_Level = 3
    		create_unit Dunland, Garrison Dunlendings, num 5, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 2, exp 0, arm 0, wep 0
    	end_if
    		if I_CompareCounter Dunland_Core_Level = 4
    		create_unit Dunland, Garrison Dunlendings, num 6, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 3, exp 0, arm 0, wep 0
    	end_if
    		if I_CompareCounter Dunland_Core_Level = 5
    		create_unit Dunland, Garrison Dunlendings, num 7, exp 0, arm 0, wep 0
    		create_unit Dunland, Garrison Dunlending Axemen, num 3, exp 0, arm 0, wep 0
    	end_if
    		set_counter france_garrison 1
    	end_monitor

Posting Permissions

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