Page 1 of 6 123456 LastLast
Results 1 to 20 of 107

Thread: How to add mercenaries.

  1. #1

    Default How to add mercenaries.

    I havn't found a toturial on this so hear goes.
    If you are unfamilier with making new units I suggest the you read this tutorial http://www.twcenter.net/forums/showthread.php?t=221097


    The Files you will be editing are


    data/Export_descr_unit


    data/unit_models/battle_models


    data/world/maps/campaign/descr_mercenaries.


    WARNING: this is not save-game compatible


    First open up Export_descr_unit


    Find the unit you want to make a merc (or create a new one), I will use this bombard


    Code:
    type             ME Monster Bombard
     dictionary       ME_Monster_Bombard      ; Monster Bombard
     category         siege
     class            missile
     voice_type       Heavy
     banner faction   main_missile
     banner holy      crusade
     soldier          ME_Monster_Bombard_Crew, 16, 1, 0.2
     engine           huge_bombard
     attributes       sea_faring, hardy, can_withdraw, gunpowder_unit, cannon, artillery
     formation        1.5, 1.5, 3, 3, 3, square
     stat_health      1, 0
     stat_pri         1, 1, no, 0, 0, melee, artillery_gunpowder, piercing, knife, 25, 1
     stat_pri_attr    no
     stat_sec         68, 3, monster_bombard_shot, 450, 20, siege_missile, artillery_gunpowder, blunt, none, 0, 1
     stat_sec_attr    ap, bp, area, launching
     stat_pri_armour  3, 1, 0, leather
     stat_sec_armour  0, 0, flesh
     stat_heat        1
     stat_ground      0, 0, 0, 0
     stat_mental      15, disciplined, highly_trained
     stat_charge_dist 10
     stat_fire_delay  0
     stat_food        60, 300
     stat_cost        1, 2500, 400, 100, 75, 1900, 4, 470
     armour_ug_levels 1
     armour_ug_models ME_Monster_Bombard_Crew
     ownership        turks, kwarezm
     era 2            turks, kwarezm
     recruit_priority_offset    -10
    add this
    Code:
     type             ME Monster Bombard
     dictionary       ME_Monster_Bombard      ; Monster Bombard
     category         siege
     class            missile
     voice_type       Heavy
     banner faction   main_missile
     banner holy      crusade
     soldier          ME_Monster_Bombard_Crew, 16, 1, 0.2
     engine           huge_bombard
     attributes       sea_faring, hardy, can_withdraw, gunpowder_unit, cannon, artillery, mercenary_unit
     formation        1.5, 1.5, 3, 3, 3, square
     stat_health      1, 0
     stat_pri         1, 1, no, 0, 0, melee, artillery_gunpowder, piercing, knife, 25, 1
     stat_pri_attr    no
     stat_sec         68, 3, monster_bombard_shot, 450, 20, siege_missile, artillery_gunpowder, blunt, none, 0, 1
     stat_sec_attr    ap, bp, area, launching
     stat_pri_armour  3, 1, 0, leather
     stat_sec_armour  0, 0, flesh
     stat_heat        1
     stat_ground      0, 0, 0, 0
     stat_mental      15, disciplined, highly_trained
     stat_charge_dist 10
     stat_fire_delay  0
     stat_food        60, 300
     stat_cost        1, 2500, 400, 100, 75, 1900, 4, 470
     armour_ug_levels 1
     armour_ug_models ME_Monster_Bombard_Crew
     ownership        turks, kwarezm, slave
     era 2            turks, kwarezm
     recruit_priority_offset    -10
    you must add the mercenary_unit line to the attributes, and the ownership factions must include the slave faction


    Next, open up battle_models and find the entry for the unit
    Code:
    23 me_monster_bombard_crew
     1 3
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod0.mesh 121
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod1.mesh 1225
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod2.mesh 6400
     4
     5 moors
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_moors.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/moors_ME_Monster_Bombard_Crew_sprite.spr
     5 egypt
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_egypt.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/egypt_ME_Monster_Bombard_Crew_sprite.spr
     5 turks
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_turks.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/turks_ME_Monster_Bombard_Crew_sprite.spr
     7 kwarezm
     87 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_kwarezm.texture
     87 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal2.texture
     53 unit_sprites/moors_ME_Monster_Bombard_Crew_sprite.spr
     4
     5 moors
     66 unit_models/AttachmentSets/Final Middle Eastern_moors_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_moors_norm.texture 0  
     5 egypt
     66 unit_models/AttachmentSets/Final Middle Eastern_egypt_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_egypt_norm.texture 0  
     5 turks
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_norm.texture 0  
     7 kwarezm
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_norm.texture 0
     1
     4 None
     22 MTW2_Crew_Huge_Bombard 0  
     1
     18 MTW2_Knife_Primary 0
     16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    (if you do not know how to edit the battle_models file please read this tutorial: http://forums.totalwar.org/vb/showthread.php?t=79455)


    add an entry for the mercs, as shown here:
    Code:
    23 me_monster_bombard_crew
     1 3
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod0.mesh 121
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod1.mesh 1225
     77 unit_models/_Units/ME_Light_Mail_Heavy_Mail/me_monster_bombard_crew_lod2.mesh 6400
     5
     5 moors
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_moors.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/moors_ME_Monster_Bombard_Crew_sprite.spr
     5 egypt
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_egypt.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/egypt_ME_Monster_Bombard_Crew_sprite.spr
     5 turks
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_turks.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     53 unit_sprites/turks_ME_Monster_Bombard_Crew_sprite.spr
     7 kwarezm
     87 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_kwarezm.texture
     87 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal2.texture
     53 unit_sprites/moors_ME_Monster_Bombard_Crew_sprite.spr
     4 merc
     85 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_mercs.texture
     86 unit_models/_Units/ME_Light_Mail_Heavy_Mail/textures/mtw2_ME_light_mail_normal.texture
     52 unit_sprites/merc_ME_Monster_Bombard_Crew_sprite.spr
     5
     5 moors
     66 unit_models/AttachmentSets/Final Middle Eastern_moors_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_moors_norm.texture 0  
     5 egypt
     66 unit_models/AttachmentSets/Final Middle Eastern_egypt_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_egypt_norm.texture 0  
     5 turks
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_norm.texture 0  
     7 kwarezm
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_diff.texture
     66 unit_models/AttachmentSets/Final Middle Eastern_turks_norm.texture 0
     4 merc
     65 unit_models/AttachmentSets/Final Middle Eastern_merc_diff.texture
     65 unit_models/AttachmentSets/Final Middle Eastern_merc_norm.texture 0  
     1
     4 None
     22 MTW2_Crew_Huge_Bombard 0  
     1
     18 MTW2_Knife_Primary 0
     16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    Make sure that the textures exist(or else all your new mercenaries won't have a skin, just a shining silver soldier) and if you make a new skin you will have to create a sprite using the method in this thread: http://www.twcenter.net/forums/showthread.php?t=97254


    Next, open up descr_mercenaries.


    find the region that you want to make this avalible


    Code:
    pool Arabia
         regions Medina_Province Mosul_Province Baghdad_Province Basra_Province Mecca_Province Al-Mu'miniya_Province Qarisiya_Province Ahvaz_Province
         unit Bedouin Cavalry        exp 1 cost 630 replenish 0.04 - 0.13 max 2 initial 1 religions { islam }
         unit Bedouin Camel Riders    exp 2 cost 920 replenish 0.04 - 0.13 max 2 initial 1 religions { islam }
         unit Kwarizmian Cavalry        exp 1 cost 1020 replenish 0.06 - 0.18 max 3 initial 0 end_year 1400 events { mongols_invasion_warn }
         unit Ghazis                    exp 1 cost 100 replenish 0.18 - 0.5 max 4 initial 1 religions { islam } crusading
         unit Mutatawwi'a            exp 1 cost 60 replenish 0.08 - 0.25 max 3 initial 1 religions { islam } crusading
         unit Turkomans Mercs        exp 1 cost 740 replenish 0.06 - 0.18 max 2 initial 1 religions { islam }
         unit Elephants             exp 1 cost 2675 replenish 0.02 - 0.04 max 1 initial 0  events { gunpowder_discovered }
         unit Afghan Javelinmen      exp 1 cost 920 replenish 0.02 - 0.06 max 1 initial 1 religions { islam }
             unit Mercenary Saracens      exp 0 cost 780 replenish 0.06 - 0.18 max 2 initial 0
    Now, you might be saying "whoa,whoa, what does this mean?"


    The pool line mearly tells the game what the name of the pool is.


    The regions line tells it what regions are in this particular mercenary pool (you can find the region names in data/world/maps/base/descr_regions.)


    This next line i will break down into smaller chunks:


    Code:
     unit Mercenary Saracens      exp 0 cost 780 replenish 0.06 - 0.18 max 2 initial 0
    The unit means the name of the entry in export_descr_unit, in ths case ME Monster Bombard


    The exp line means the level of experiance that the unit has. This can be anything from 0(no experience) to 9(three gold cheverons of experience)


    The cost line is the number of florins needed to purchese the unit.


    The replenish line tells the game how soon the unit will replenish itself. Experiment with this to find out what best suits you. for example, a value of 0.1-0.25 means that the unit will replenish in anywhere from 4 to 10 turns.


    Max is the maximum amout of this unit type avalible at any one time.


    Initial is the number of the unit avalible at the beginning of the campaign.


    Code:
    Events { gunpowder_discovered }
    You can also make the unit avalible after a certain event, like the black death, mongols, or gunpowder. (check you data/world/maps/campaign/imperial_campaign/descr_events file for a list of events). Also, the "religions { islam } crusading" means that the unit is only availible on crusade(or jihad if you are a muslim faction), and only to factions with that religion.

    Adding this line
    Code:
    events { faction1_allied_faction2 }
    (just put the factions of your choice in) will make your mercenary avalible only if two factions are allied. (Note: this only works with kingdoms)


    Finnally, copy and paste the unit cards that you want into the folder "merc" in data/ui/unit_info and /units.


    And that should do it.
    Last edited by Squid; July 23, 2010 at 11:33 PM.


    "Do you know, my son, with what little understanding the world is ruled?"Pope Julius III
    Want to add your own mercenaries? Read my Tutorial

  2. #2

    Default Re: How to add mercenaries.

    Nice tutorial! This should be the definitive guide for the descr_mercenaries.

    Coder on Dark Ages: Roman Revival, the alternate history mod for BI.

    Under the Patronage of Augustus Lucifer, member of the House of Ward.

  3. #3

    Default Re: How to add mercenaries.

    Quote Originally Posted by Mythic_Commodore View Post
    Nice tutorial! This should be the definitive guide for the descr_mercenaries.
    Thank you.
    You have no idea how much that means to me.
    Last edited by impspy; April 11, 2009 at 05:29 PM.


    "Do you know, my son, with what little understanding the world is ruled?"Pope Julius III
    Want to add your own mercenaries? Read my Tutorial

  4. #4
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,830
    Blog Entries
    24

    Default Re: How to add mercenaries.

    May I add that you forgot to mention that you will have to check if these texture files exist, else you will have 'silversurfers' in battle? And the sprite you set there will need to be created as well in a case like that.




  5. #5

    Default Re: How to add mercenaries.

    Quote Originally Posted by gigantus View Post
    May I add that you forgot to mention that you will have to check if these texture files exist, else you will have 'silversurfers' in battle? And the sprite you set there will need to be created as well in a case like that.
    Revised with gigantus' suggestion


    "Do you know, my son, with what little understanding the world is ruled?"Pope Julius III
    Want to add your own mercenaries? Read my Tutorial

  6. #6
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,697

    Default Re: How to add mercenaries.

    Interesting. Re-affirms what I already knew, but a useful tutorial for someone not acquainted with the mercenary file.

    I think one thing about this and I could be wrong, is don't mercenary units not appear on the rosters of the factions they are given to in custom battles? To my knowledge this is the Achilles Heel of the AOR System, not being able to specify for which factions it will appear in custom battle and which can just recruit it AOR in the campaign.

    If I'm wrong about that, then it's good news, and would be glad to hear it.

  7. #7

    Default Re: How to add mercenaries.

    They only appear for custom battle if ownership of that unit has been given to the faction, which only occurs in an AOR system. Of course, there's always no_custom.

    Coder on Dark Ages: Roman Revival, the alternate history mod for BI.

    Under the Patronage of Augustus Lucifer, member of the House of Ward.

  8. #8

    Default Re: How to add mercenaries.

    Quote Originally Posted by Augustus Lucifer View Post
    Interesting. Re-affirms what I already knew, but a useful tutorial for someone not acquainted with the mercenary file.

    I think one thing about this and I could be wrong, is don't mercenary units not appear on the rosters of the factions they are given to in custom battles? To my knowledge this is the Achilles Heel of the AOR System, not being able to specify for which factions it will appear in custom battle and which can just recruit it AOR in the campaign.

    If I'm wrong about that, then it's good news, and would be glad to hear it.

    No, they work:


    "Do you know, my son, with what little understanding the world is ruled?"Pope Julius III
    Want to add your own mercenaries? Read my Tutorial

  9. #9
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,697

    Default Re: How to add mercenaries.

    Quote Originally Posted by Mythic_Commodore View Post
    They only appear for custom battle if ownership of that unit has been given to the faction, which only occurs in an AOR system. Of course, there's always no_custom.
    Yes that is what I meant. I mean in the AOR system, one can't for instance make a mercenary unit, allow all to recruit it on the campaign map, but then only allow the home faction to recruit it in custom battles. That's the one fatal flaw in the system that makes it hard to work with. Could have been easily remedied by having a line for custom battle ownership separate of campaign ownership.

  10. #10

    Default Re: How to add mercenaries.

    Nice tutorial impspy,just added english huscarls to the english roster with two quick changes,going to try and add the novorogrod units to the english roster now as love the skins for that faction.

  11. #11
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,633

    Default Re: How to add mercenaries.

    Quote Originally Posted by Augustus Lucifer View Post
    Could have been easily remedied by having a line for custom battle ownership separate of campaign ownership.
    But there is:

    Code:
    ; era 0,            Optional List of factions that use this in multiplayer era 0
    ; era 1,            Optional List of factions that use this in multiplayer era 1
    ; era 2,            Optional List of factions that use this in multiplayer era 2

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  12. #12
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: How to add mercenaries.

    Quote Originally Posted by Augustus Lucifer View Post
    Yes that is what I meant. I mean in the AOR system, one can't for instance make a mercenary unit, allow all to recruit it on the campaign map, but then only allow the home faction to recruit it in custom battles. That's the one fatal flaw in the system that makes it hard to work with. Could have been easily remedied by having a line for custom battle ownership separate of campaign ownership.
    You can cheat a little to make it not show up. Since, I believe, all faction get 100 units in custom battles, make the mercs listed anytime after the 100th unit in EDU for factions you don't want to be able to recruit it in custom battles and before the 100th for those factions you do want to be able to recruit it. This is a lot of micromanagement and won't work for factions with fewer than 100 units.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  13. #13
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,697

    Default Re: How to add mercenaries.

    I should hope all factions would have fewer than 100 units, that's a lot.

    Well, I guess it depends on the types of units being developed. I'm not a fan of generic units anywhere, so if it isn't faction-specific it's region-specific and those are unlikely to add up to 100. I guess if a mod had a bunch of units that everyone could recruit, like the token 'Feudal Knights' unit, or 'Man At Arms', all those silly units that show up all over, it'd work. Interesting tidbit no less.
    Last edited by Augustus Lucifer; October 02, 2009 at 04:30 AM.

  14. #14
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,739
    Blog Entries
    3

    Default Re: How to add mercenaries.

    Just my RTW experience, but most full RTW conversions have close to or over 100 units for many of their factions.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  15. #15
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,697

    Default Re: How to add mercenaries.

    Quote Originally Posted by Sqυιd View Post
    Just my RTW experience, but most full RTW conversions have close to or over 100 units for many of their factions.
    Hm, guess it depends on the allowances, I've never seen it but then I don't play a lot of mods. The way I think of it is if I have 15 factions with 20 unique units each, that's 300 slots, so I'd need to let a faction have over half of the remaining regional or AOR units in order to get that 100 threshold. I suppose that would happen if no_custom wasn't used, IMO it gets a bit convoluted if I can recruit Scythian Mercs as Rome in a custom battle, but that's just me. That's one of the downsides to a full AOR system though, if people are making things like roman legions recruitable by all in the campaign, that'd require as you say a bunch of units in the custom battles. It should be easier to provide a different EDU for custom battles, maybe it is but I'm not aware how.
    Last edited by Augustus Lucifer; October 02, 2009 at 06:50 PM.

  16. #16
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,830
    Blog Entries
    24

    Default Re: How to add mercenaries.

    I usually have the habit of assigning no_custom to AoR units. Else the custom battle roster is completely swamped.




  17. #17

    Default Re: How to add mercenaries.

    Quote Originally Posted by impspy View Post
    Adding this line
    Code:
    events { faction1_allied_faction2 }
    (just put the factions of your choice in) will make your mercenary avalible only if two factions are allied. (Note: this only works with kingdoms)
    I am wondering if you can help me expand on this.

    events TEST (1)
    I've simply tried to use this;
    Code:
    events { sicily_allied_milan }
    No changes made to the any other file.
    I make some initial troops, set the descr_strat faction relationships to allied, load the game and check the alliance exists, click next turn to ensure the event is in effect, but my general can not see the mercs in that region .
    I exit, delete this
    Code:
    events { sicily_allied_milan }
    and go back and load the game, I can see the merc unit!

    Conclusion:
    The “events { Faction1_allied_Faction2 }” does not work.

    events TEST (2)
    This test includes a script in the campaign script;
    Code:
    monitor_event PreFactionTurnStart FactionType milan
      set_event_counter milan_turn 1
      end_monitor
      monitor_event FactionTurnEnd FactionType milan
      set_event_counter milan_turn 0
      end_monitor
    I add this this to the merc line;
    Code:
    events { milan_turn }
    I make some initial troops (same unit as last time), load the game, click next turn to ensure the event is in effect, but my general can not see the mercs in that region again! .
    I exit, delete the line in the merc line and go back and load the game, I can see the merc unit again!

    Conclusion:
    The events line also does not work for set_event_counter events in campaign_script

    events TEST (3)
    This test was testing the event in the descr_events file in the campaign folder that you mention for gunpowder;


    Conclusion:
    The events line works perfectly for events in the descr_events

  18. #18

    Default Re: How to add mercenaries.

    Quote Originally Posted by Archaon View Post
    I am wondering if you can help me expand on this.

    events TEST (1)
    I've simply tried to use this;
    Code:
    events { sicily_allied_milan }
    No changes made to the any other file.
    I make some initial troops, set the descr_strat faction relationships to allied, load the game and check the alliance exists, click next turn to ensure the event is in effect, but my general can not see the mercs in that region .
    I exit, delete this
    Code:
    events { sicily_allied_milan }
    and go back and load the game, I can see the merc unit!

    Conclusion:
    The “events { Faction1_allied_Faction2 }” does not work.

    events TEST (2)
    This test includes a script in the campaign script;
    Code:
    monitor_event PreFactionTurnStart FactionType milan
      set_event_counter milan_turn 1
      end_monitor
      monitor_event FactionTurnEnd FactionType milan
      set_event_counter milan_turn 0
      end_monitor
    I add this this to the merc line;
    Code:
    events { milan_turn }
    I make some initial troops (same unit as last time), load the game, click next turn to ensure the event is in effect, but my general can not see the mercs in that region again! .
    I exit, delete the line in the merc line and go back and load the game, I can see the merc unit again!

    Conclusion:
    The events line also does not work for set_event_counter events in campaign_script

    events TEST (3)
    This test was testing the event in the descr_events file in the campaign folder that you mention for gunpowder;


    Conclusion:
    The events line works perfectly for events in the descr_events
    I tested the allied event and u r right it doesn't work.

    However a event from the CS works but with a little difference.
    I placed the this in my campaign script.
    Spoiler Alert, click show to read: 
    monitor_conditions I_SettlementOwner London = england
    and I_EventCounter x_y == 0
    add_events
    event counter x_y
    date 0
    end_add_events
    end_monitor

    monitor_conditions not I_SettlementOwner London = england
    and I_EventCounter x_y == 1
    set_event_counter x_y 0
    end_monitor

    And placed this line under descr_merc....txt file
    Spoiler Alert, click show to read: 
    pool England_Wales
    regions London_Province Nottingham_Province York_Province Caernarvon_Province Lanceston_Province
    unit Mercenary Spearmen exp 9 cost 660 replenish 0.08 - 0.25 max 4 initial 1 events { x_y }


    And it worked perfectly.
    I didn't had to click the next turn coz London was in the hands of England already.
    Try this bro it will help solve ur modding problem.

    Edit 1
    Ok i also thought i should post this for the newbies who want to make a merc unit available only when certain 2 factions ally with each other.

    1) I choose a random counter say x_y.
    2) I put this event under descr_mercenaries.txt file. Like this for Galloglaich
    Code:
    unit Galloglaich            exp 0 cost 830 replenish 0.08 - 0.25  max 4 initial 1 events { x_y }
    3) I place this small script in the campaign_script.txt file.
    Code:
    monitor_event FactionAllianceDeclared FactionType england
        and TargetFactionType france
        set_event_counter x_y 1
        end_monitor
    
    monitor_event FactionBreakAlliance FactionType england
        and TargetFactionType france
        and I_EventCounter x_y == 1
        set_event_counter x_y 0
        end_monitor
    4) It's done. Now the merc unit will only be available when France and England are Allied.

    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).
    Last edited by Ishan; July 23, 2010 at 11:59 PM.

  19. #19

    Default Re: How to add mercenaries.

    Quote Originally Posted by Ishan View Post
    add_events
    event counter x_y
    date 0
    end_add_events
    I knew this!
    Cant believe i forgot that this is what exports an 'event' fromthe CS..
    *frustration*
    I've only included that code in several of my mods..

    Ah well, at least these post confirms they work (which no i see they do) except for the "faction1_allied_faction2". Which by the way is easily fixed with more CS lol so 'technically' "faction1_allied_faction2" is working it just needs supprt form a monitor in the CS.

    This has now opened pandoras box, i will be the evil lord of the descr_mercinaries !!! Muhahahaha!

    thx Ishan +rep for your insight

  20. #20

    Default Re: How to add mercenaries.

    Glad to help bro. And have to say u were the one with the insight not me.

Page 1 of 6 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
  •