Page 4 of 6 FirstFirst 123456 LastLast
Results 61 to 80 of 112

Thread: How to add mercenaries.

  1. #61
    Lifthrasir's Avatar "Capre" Dunkerquois
    Patrician Moderator Emeritus

    Join Date
    Jan 2010
    Location
    City of Jan Baert
    Posts
    13,950
    Blog Entries
    4

    Default Re: How to add mercenaries.

    Hi all, I want to change the mercenaries recruitable in Scotland for SSMAP submod. I want to make a difference between the units recruitable in Iverness (Highlands) and in Edinburgh (Lowlands).
    Basically, during the Early Era, I want to add some Norse mercenaries recruitable in Iverness plus some Scots units like Scots Pike Militia while in Edinburgh, I will add some mercenary frankish knights (low replenish rate), mercenary knights and sergeants swordsmen, may be a few crossbowmen.

    1st: can I create a pool called Scotland_Highlands with Iverness province only and another pool named Scotland_Lowlands with Edinburgh province?

    2nd: if I add a Scot unit as mercenary unit as well, do I just need to modify the EDU accordingly (I mean without considering the points mentioned in this thread)?

    I thank you in advance.
    Under the patronage of Flinn, proud patron of Jadli, from the Heresy Vault of the Imperial House of Hader

  2. #62

  3. #63
    Lifthrasir's Avatar "Capre" Dunkerquois
    Patrician Moderator Emeritus

    Join Date
    Jan 2010
    Location
    City of Jan Baert
    Posts
    13,950
    Blog Entries
    4

    Default Re: How to add mercenaries.

    I've found the answer regarding my 2nd question but I'm still not sure regarding the pool. If I understood it correctly, there's nothing special and I can create and rename pools depending on my needs as long the province name is correct.
    Under the patronage of Flinn, proud patron of Jadli, from the Heresy Vault of the Imperial House of Hader

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

    Default Re: How to add mercenaries.

    Yep, you can define your own pools.

  5. #65
    Lifthrasir's Avatar "Capre" Dunkerquois
    Patrician Moderator Emeritus

    Join Date
    Jan 2010
    Location
    City of Jan Baert
    Posts
    13,950
    Blog Entries
    4

    Default Re: How to add mercenaries.

    Many thanks, guys. That's great and gives me a lot of opportunities
    Under the patronage of Flinn, proud patron of Jadli, from the Heresy Vault of the Imperial House of Hader

  6. #66
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: How to add mercenaries.

    Can i give mercenary unit non-merc texture? I created a italian cavalry militia mercenary unit, and give it textures for both model and attachmentsets from venice unit, as well as sprite. But at the battlefield, soldiers are still silver.

  7. #67

    Default Re: How to add mercenaries.

    Hi,i have a problem with mercenaries,all of them in Twothrones 1.1 mod;i have added some of them with this tutorila but my generals can't recruit because the Great helm button is inactive,anyone can help me??

  8. #68
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: How to add mercenaries.

    Quote Originally Posted by Hellvard View Post
    Can i give mercenary unit non-merc texture? I created a italian cavalry militia mercenary unit, and give it textures for both model and attachmentsets from venice unit, as well as sprite. But at the battlefield, soldiers are still silver.
    The texture doesn't matter, but it has to be in the merc faction section in the modeldb
    Quote Originally Posted by geeno View Post
    Hi,i have a problem with mercenaries,all of them in Twothrones 1.1 mod;i have added some of them with this tutorila but my generals can't recruit because the Great helm button is inactive,anyone can help me??
    Maybe the region your general is in is not entered in descr_mercenaries










  9. #69

    Default Re: How to add mercenaries.

    Thanks i will try!

  10. #70

    Default Re: How to add mercenaries.

    Am trying to get faction specific mercs working; tried this sort of method
    Quote Originally Posted by Ishan View Post
    To make it more interesting we can now also make a merc unit available to only England when it allies with France.
    So need to add one more event:-
    First make the event (e_o) faction specific:
    Code:
    monitor_event PreFactionTurnStart FactionType england
            set_event_counter  e_o 1
            end_monitor
    monitor_event FactionTurnEnd FactionType england
            and I_EventCounter   e_o == 1
            set_event_counter  e_o 0
            end_monitor
    Now all you have to do is add this event along with x_y in descr_mercenaries.txt file like this
    Code:
    unit Galloglaich            exp 0 cost 830 replenish 0.08 - 0.25  max 4  initial 1 events { x_y e_o }
    And we are done. Now when the 2 factions are Allies(France and England in the above case) only England can recruit this merc unit i.e.(Galloglaich).
    actual code was
    Code:
    monitor_event PreFactionTurnStart FactionType egypt
            if I_EventCounter   egypt_merc_turn == 0
    		console_command create_unit Salient "citlev_naugir" 1 0 0 0
    	end_if
            if I_EventCounter   egypt_merc_turn == 1
    		console_command create_unit Salient "citlev_ashapr" 1 0 0 0
    	end_if
    	set_event_counter egypt_merc_turn 1
    end_monitor
    
    monitor_event FactionTurnEnd FactionType egypt
            if I_EventCounter   egypt_merc_turn == 1
    		console_command create_unit Salient "citlev_feddys" 1 0 0 0
    	end_if
            if I_EventCounter   egypt_merc_turn == 0
    		console_command create_unit Salient "citlev_ashapr" 1 0 0 0
    	end_if
    	set_event_counter egypt_merc_turn 0
    end_monitor
    &
    Code:
    	unit ferakine	exp 0 cost 830 replenish 0.9 - 1.95  max 4 initial 1 events { egypt_merc_turn }
    The initial 1 merc unit did turn up available to egypt only, but it never replenished - I stuck the console_command units in to check the counter was setting to right values and it was (i.e. 0 at start of turn and 1 at end, before it re-sets) - I tried the higher replenish values in case the pool was resetting each time the counter zero'd but that hasn't helped.

    tried also
    Quote Originally Posted by Gigantus View Post
    I have actually used this type of coding (with normal counters) for 1648 to make faction specific coding easier. Instead of wrangling with the faction name and it's coding, you simply use the event counter in the code:
    declare_counter reichs_fraktion ; belongs to a confedaration or not
    declare_counter katholisch ; catholic faction or not
    ;--- Schweden ---
    declare_counter england_turn
    monitor_event PreFactionTurnStart FactionType england
    set_counter england_turn 1
    set_counter reichs_fraktion 0
    set_counter katholisch 0
    end_monitor
    monitor_event FactionTurnEnd FactionType england
    set_counter england_turn 0
    end_monitor
    type method with my code;
    Code:
    declare_counter egypt_merc_turn
    monitor_event PreFactionTurnStart FactionType egypt
    	set_counter egypt_merc_turn 1
    end_monitor
    monitor_event FactionTurnEnd FactionType egypt
    	set_counter egypt_merc_turn 0
    end_monitor
    and don't get the merc at all

    any ideas?

  11. #71
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: How to add mercenaries.

    It appears that merc recruiting has the same restrictions here as EDU recruiting: recruiting based on event counters that 'reset' every round will reset the recruit pool every time to zero, hence a unit will get stuck in the recruitment slot.

    I was under the impression that events in descr_mercenaries cannot be reset...










  12. #72

    Default Re: How to add mercenaries.

    getting more confused now - have just tried;

    Code:
    	set_event_counter egypt_merc_turn 0
    
    monitor_event PreFactionTurnStart FactionType egypt
            and I_EventCounter   egypt_merc_turn == 0
    	and I_TurnNumber = 2
    	set_event_counter egypt_merc_turn 1
    	console_command create_unit Salient "citlev_naugir" 1 0 0 0
    end_monitor
    
    monitor_event PreFactionTurnStart FactionType egypt
            and I_EventCounter   egypt_merc_turn == 1
    	and I_TurnNumber = 5
    	console_command create_unit Salient "citlev_ashapr" 1 0 0 0
    	set_event_counter egypt_merc_turn 0
    end_monitor
    
    monitor_event PreFactionTurnStart FactionType egypt
            and I_EventCounter   egypt_merc_turn == 0
    	and I_TurnNumber = 8
    	console_command create_unit Salient "ferakine" 1 0 0 0
    	set_event_counter egypt_merc_turn 1
    end_monitor
    with
    Code:
    	unit ferakine	exp 0 cost 830 replenish 1.0 - 1.01  max 4 initial 0 events { egypt_merc_turn }
    I didn't buy the mercs that turned up and total pool gave me;
    1 @ turn 3 (so 1 turn after the event was switched on)
    2 @ turn 4
    0 (the unbought one's disappeared at turn 5)
    3 @ turn 8 when it triggered again - and yup the event definitely reset/reactivated the merc's

  13. #73
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: How to add mercenaries.

    Thanks for confirming that.

    Your intial pool was zero and it replenished at one per turn, your findings are correct. I am surprised that the recruit pool wasn't reset, though.










  14. #74

    Default Re: How to add mercenaries.

    haha

    problem (obviously now) is that the replenish pool is set at some stage not within Egypt's turn, I tried slave turn and that didn't help anyway
    reverse psychology and turning it off for other factions looks like it works;


    Code:
    	set_event_counter egypt_merc_turn 1
    
    monitor_event PreFactionTurnStart FactionType egypt
    	set_event_counter egypt_merc_turn 1
    end_monitor
    
    monitor_event PreFactionTurnStart not FactionType egypt
    	set_event_counter egypt_merc_turn 0
    end_monitor
    
    monitor_event FactionTurnEnd TrueCondition
    	set_event_counter egypt_merc_turn 1
    end_monitor
    and pool does clock up with fractions of a unit

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

    Default Re: How to add mercenaries.

    Good one makanyane. . It seems to me that the first monitor isn't needed though.

  16. #76

    Default Re: How to add mercenaries.

    Thanks Withwnar, haven't tested but am sure you're right.

    am wondering now if similar thing would be the answer to the EDU recruitment sticking that Gigantus mentioned, but can't think of an example at the moment that would use that...

  17. #77
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: How to add mercenaries.

    Recruiting based on the presence of governor comes to mind. Works for buildings as they don't have a pool. Doesn't work if the governor leaves or the monitor resets every round to test for the presence. Underneath the script we used in PDeR:

    Code:
    monitor_event FactionTurnEnd FactionIsLocal
       set_event_counter governor_present 1
    end_monitor
    
    monitor_event SettlementSelected GovernorInResidence
       and FactionIsLocal
       set_event_counter governor_present 1
    end_monitor
    
    monitor_event SettlementSelected not GovernorInResidence
       and FactionIsLocal
       set_event_counter governor_present 0
    end_monitor










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

    Default Re: How to add mercenaries.

    I did some experimenting. Apparently the pool replenishing is done at the end of the slave turn so the event counter needs to be 1 at that time, i.e. set to 1 in a [FactionTurnEnd FactionType slave] monitor.

    That is what yours is doing, makanyane, because it is set to 1 at the end of every faction's turn, including slave. So a slightly different way to write it could be...

    Code:
    monitor_event PreFactionTurnStart FactionType egypt
      set_event_counter egypt_merc_turn 1
    end_monitor
    
    monitor_event PreFactionTurnStart not FactionType egypt
      set_event_counter egypt_merc_turn 0
    end_monitor
    
    monitor_event FactionTurnEnd FactionType slave
      set_event_counter egypt_merc_turn 1
    end_monitor
    It amounts to exactly the same thing of course. The [set_event_counter egypt_merc_turn 1] initialisation line isn't needed so has been dropped here.

    I tested it to confirm that the merc line ONLY works for egypt: all good.

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

    Default Re: How to add mercenaries.

    EDB event_counters need to be set before SettlementTurnStart.

    Because characters recruit mercs I'd anticipate that with mercs the event_counter probably needs setting anywhere before the current faction's CharacterTurnStart and after the previous faction's.

    Suggest avoiding PreFactionTurnStart if you can.

  20. #80
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: How to add mercenaries.

    Got strange and unexpected problem with adding mercenaries. I add new units from another mods and make some of them mercs, then I test added unit in custom battle, I set this current new unit for battle and test animation and others. So, when I test mercenary units I have invisible captain model with this unit in battle. When I remove attribute mercenary_unit in EDB - everything is ok, captain is visible in battle. How to fix this?

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Page 4 of 6 FirstFirst 123456 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
  •