Results 1 to 7 of 7

Thread: Conditional recruiting

Hybrid View

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

    Default Conditional recruiting

    Is it possible to have a building as a condition to recruit an unit? Meaning:

    recruit_pool "Andalusian Spearmen" 1 0.2 2 0 requires factions { russia, novgorod, } and event_counter HEAVY_MAIL_ARMOR 1 and hidden_resource aor_iberia and building_present_min_level smith heavy_armourer

    Thanks.

    First weigh the considerations, then take the risks. Moltke.

  2. #2

    Default Re: Conditional recruiting

    when in doubt just back up your files and try it and see if it works....

  3. #3

    Default Re: Conditional recruiting

    Well, you should try yourself, but I can give you the answer right now, you can't it will cause CTD's upon opening the building scroll.

    There is however a different way to achieve what you want to achieve ( but it will be a bit of work depending on howmany units you want to do this for) note that this will effectivly mean you will have a maxiumum available of 1

    put this entry in the barrack
    Code:
    "Andalusian Spearmen" 0.5   0.1 0.5  0  requires factions { russia,  novgorod, } and event_counter HEAVY_MAIL_ARMOR 1 and hidden_resource  aor_iberia
    and this entry in the heavy_armourer
    Code:
    "Andalusian Spearmen" 0.5   0.1 0.5  0  requires factions { russia,  novgorod, } and event_counter HEAVY_MAIL_ARMOR 1 and hidden_resource  aor_iberia
    This will give you 1 unit of Andalousian Spearmen if you have both the Heavy Armourer and the barracks in a settlement ( with a refresh of 0.2 ). Note that this unit won't show up in any of the buildings scrolls but it will become available for recruitment.

  4. #4

    Default Re: Conditional recruiting

    you can also do it via script... when a settlement is selected, or u open the building browser a script will check to ensure this building is in the currently selected settlement, if so, the script will allow set an event counter which will be read by the EDB and allow or disallow the units recruitment.

    There are a few small things to take into consideration when writing such a script, first, a player can bypass script events like this by simply opening a settlement that HAS the building and then clicking NEXT city, the event counter is already set... So, in that case u need yet another script to stop that!... This also does not work for the AI. Another script would be required seperatly for the AI, and most likely for each Faction, AND that script would play out differenly then it would for the player...

    Also, when allowing unit recruitment via script the refresh pools will be set and re set with the event counter. This can cause issues on large scale campaigns and u may find the unit NEVER refreshes. So thorough testing may be required and u may even have to use a seperate script for each individual unit or whatever the case may be...

    To answer ur question, yes, a building can be used as a pre condition... It would be a lot simpler to make that building affect the entire faction, as opposed to settlement by settlement basis... (such as a Town Hall being built in the capital allows a unique unit to be recruited faction wide)...
    ...longbows, in skilled hands, could reach further than trebuchets...

  5. #5

    Default Re: Conditional recruiting

    Thanks Ilmrik. In fact I was trying to find an easy way to make you first get the equipment and then recruit, but it doesn't exist.

    Via script sounds like a CTD looking for a place to happen. It would be easier to make the smith a precondition to barracks, and then I have to rearrange the recruitment depending on their armour. Looks funny getting plated men-at-arms when I have a tanner. Knights would be different, they equip themselves.

    On the Côte d’Azur the Italian invasion was held by a NCO and seven soldiers. A. Horne.

  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Conditional recruiting

    Quote Originally Posted by Tsarsies View Post
    you can also do it via script... when a settlement is selected, or u open the building browser a script will check to ensure this building is in the currently selected settlement, if so, the script will allow set an event counter which will be read by the EDB and allow or disallow the units recruitment.
    The event counters need to be set before the turn starts to allow a recruit pool to recharge, setting during the turn would do nothing except allow access to a unit pool that has nothing in it. So your script would also need to be setting recruit pools for every unit and settlement. Which means you can't have 'X turns to recruit', they'd either be present or not. Years ago Repman made a script like this to allow recruitment of cavalry dependant on character traits, 36k lines of it and that's just the cav...

    Quote Originally Posted by semmes View Post
    It would be easier to make the smith a precondition to barracks, and then I have to rearrange the recruitment depending on their armour.
    That's the way I'd probably do it.
    Last edited by Taiji; November 03, 2011 at 09:33 AM.

  7. #7

    Icon1 Re: Conditional recruiting

    If the ‘hidden resource’ is only use by one or two Provinces, you could try doing this:
    Spoiler Alert, click show to read: 
    Code:
    recruit_pool "Rohan Heavy Horsearchers"  0   0   3  0  requires factions { milan, } and hidden_resource fold
    Code:
    declare_counter practice_range_westfold
    declare_counter practice_range_eastfold
    declare_counter recruit_horsearchers_westfold
    declare_counter recruit_horsearchers_eastfold
    
    	monitor_event SettlementTurnStart SettlementName Westfold
    		and I_CompareCounter practice_range_westfold = 0
    		and SettlementBuildingExists >= practice_range
    		set_counter practice_range_westfold 1
    	end_monitor
    
    	monitor_event SettlementTurnStart SettlementName Westfold
    		and I_CompareCounter practice_range_westfold = 1
    		and not SettlementBuildingExists >= practice_range
    		set_counter practice_range_westfold 0
    	end_monitor
    
    	monitor_event SettlementTurnEnd SettlementName Westfold
    		and I_CompareCounter practice_range_westfold = 1
    		inc_counter recruit_horsearchers_westfold 1
      		if I_CompareCounter recruit_horsearchers_westfold = 4
    		inc_recruit_pool Westfold_Province 1 Rohan Heavy Horsearchers
    		set_counter recruit_horsearchers_westfold 0
       	end_if
    	end_monitor
    
    	monitor_event SettlementTurnStart SettlementName Eastfold
    		and I_EventCounter practice_range_eastfold = 0
    		and SettlementBuildingExists >= practice_range
    		set_event_counter practice_range_eastfold 1
    	end_monitor
    
    	monitor_event SettlementTurnStart SettlementName Eastfold
    		and I_EventCounter practice_range_eastfold = 1
    		and not SettlementBuildingExists >= practice_range
    		set_event_counter practice_range_eastfold 0
    	end_monitor
    
    	monitor_event SettlementTurnEnd SettlementName Eastfold
    		and I_EventCounter practice_range_eastfold = 1
    		inc_counter recruit_horsearchers_eastfold 1
      		if I_CompareCounter recruit_horsearchers_eastfold = 4
    		inc_recruit_pool Eastfold_Province 1 Rohan Heavy Horsearchers
    		set_counter recruit_horsearchers_eastfold 0
       	end_if
    	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
  •