Results 1 to 3 of 3

Thread: Post battle recruitment (for example Necromancy or Slavery)

  1. #1
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Post battle recruitment (for example Necromancy or Slavery)

    After some lengthy testing I managed to add the ability to raise the dead enemies after battle (for necromancy). That didnt work (NumEnemiesInBattle triggers and so on dont work, and plenty other issues), but I managed to make it working by checking the number of executed enemies.

    This is how it works, using merceny pools. First you need to set one in descr_mercenaries, for example like this
    Code:
    pool Imperial_City_Province
        regions Imperial_City_Province
        unit Merc Zombies    exp 0 cost 350 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_a }
        unit Merc Skeletons    exp 0 cost 400 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_b }
        unit Merc Zombies    exp 0 cost 350 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_b }
        unit Merc Skeleton Archers        exp 0 cost 450 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_c }
        unit Merc Skeletons    exp 0 cost 400 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_c }
        unit Merc Zombies    exp 0 cost 350 replenish 0.99 - 1.01 max 1 initial 1 events { necromancer_recruit_c }    
        ....
    You likely want this work everywhere, so you should add this pool to every province separately. Hence, for your other merc pools to work correctly, you should make a pool for every region (hence 199 or how many you have)

    A minor trait part (that marks the general that just fought the battle)
    Code:
        ;------------------------------------------
    Trait Necromancer_battle
        Characters family
           Hidden
    
    
        Level Necromancer_battle
             Description No_more_booty_desc
            EffectsDescription No_more_booty_effects_desc
            Threshold  1
    
       ;--------------------------------------------
    Trigger necrobattle_acquire
     WhenToTest GeneralPrisonersRansomedCaptor
    
    
     Condition IsGeneral
           and Trait Necromancer >= 1
           and NumCapturedSoldiers > 249 
    
    
     Affects Necromancer_battle 1 Chance 100
    
      ;--------------------------------------------
    Trigger necrobattle_remove_after_battle
     WhenToTest CharacterSelected
    
     Condition IsGeneral
           and Trait Necromancer_battle = 1
    
     Affects Necromancer_battle -1 Chance 100
     
    ;--------------------------------------------
    Trigger necrobattle_just_to_be_sure
     WhenToTest CharacterTurnEnd
    
     Condition IsGeneral
           and Trait Necromancer_battle = 1
    
     Affects Necromancer_battle -1 Chance 100
    Now the script part

    Code:
    monitor_event GeneralPrisonersRansomedCaptor RansomType execute   ; This I believe is pretty straightforward... It simply checks how many men did you execute
         and Trait Necromancer >= 1
         and NumCapturedSoldiers < 501 
         and NumCapturedSoldiers > 249 
            
            set_event_counter p_necromancer_recruit_a 1
    
    end_monitor
    
    
    monitor_event GeneralPrisonersRansomedCaptor RansomType execute
         and Trait Necromancer >= 1
         and NumCapturedSoldiers < 751 
         and NumCapturedSoldiers > 500 
            
            set_event_counter p_necromancer_recruit_b 1
    
    end_monitor
    
    monitor_event GeneralPrisonersRansomedCaptor RansomType execute
         and Trait Necromancer >= 1
         and NumCapturedSoldiers < 1001 
         and NumCapturedSoldiers > 750 
            
            set_event_counter p_necromancer_recruit_c 1
    
    end_monitor
    
    ..... d, e, ....
    
    
    ;;;;; ENABLING ABD DISABLING RECRUITMENT ;;;;;;;;;;;;
    
    
    monitor_event CharacterSelected IsGeneral
        and Trait Necromancer >= 1                              ; A trait check for necromancer ability
        and Trait Necromancer_battle > 0                   ; A trait that only a character that just fought the battle has, to ensure that you cant do it for other characters elsewhere
        
            
        if I_EventCounter p_necromancer_recruit_a = 1
            set_event_counter necromancer_recruit_a 1       ; This enabled the merc pool
        end_if
        
        if I_EventCounter p_necromancer_recruit_b = 1
            set_event_counter necromancer_recruit_b 1
        end_if
        
        if I_EventCounter p_necromancer_recruit_c = 1
            set_event_counter necromancer_recruit_c 1
        end_if    
        
        campaign_wait 1.0                                            ; This setting with prerequisite counter and campaign_wait may be a bit confusing, but it archives what we want. Recruiting only for the character that fought the battle. Without the wait, the next part would disable the recruitment the moment you click on the character, hence you wouldnt be able to recruit any units.
        
        if I_EventCounter necromancer_recruit_a = 1
            set_event_counter necromancer_recruit_a 0        ; This disables the pool...
            set_event_counter p_necromancer_recruit_a 0  ; And also disables the the prerequisite even counter
        end_if
        
        if I_EventCounter necromancer_recruit_b = 1
            set_event_counter necromancer_recruit_b 0
            set_event_counter p_necromancer_recruit_b 0
        end_if
        
        if I_EventCounter necromancer_recruit_c = 1
            set_event_counter necromancer_recruit_c 0
            set_event_counter p_necromancer_recruit_c 0
    
        end_if
    
            ....
    
    
    end_monitor
    
    
    monitor_event CharacterSelected IsGeneral         ;This disables the prerequsite counter (and hence also the recruitment) if you click on any other character
        and not Trait Necromancer >= 1 
        and not Trait Necromancer_battle = 1
        
        if I_EventCounter p_necromancer_recruit_a = 1
            set_event_counter p_necromancer_recruit_a 0
        end_if
        
        if I_EventCounter p_necromancer_recruit_b = 1
            set_event_counter p_necromancer_recruit_b 0
        end_if
        
        if I_EventCounter p_necromancer_recruit_c = 1
            set_event_counter p_necromancer_recruit_c 0
        end_if
    
           .....
        
    end_monitor
    This works the way, that if the first character you click on after battle is the necromancer that just fought a battle, in the merc pool you are able to recruit the amount of undead units depending on how many enemies you executed (sometimes it shows up on second, not first afaik). If you click again on the character after that, the merc pool is already gone. If you first click on any other character, even if he is necromancer, he cant recruit any undead units (even if he is in the same region) and you loose the chance to recruit those units via the character that you were meant to.

    Therefore, this enables recruitment for the general that just fought the battle, has the required ability and have executed enough enemies.

    See the preview from my mod https://www.moddb.com/mods/unofficia...ndead#imagebox ( Lich is the highest rank of necromancer)


    My requirements are pretty strick ( I dont want any other character to be able to recruit), you might want to have lower reqirements, depending on what you want to do. Maybe you would be happy just with enabling a recruitment pool inside a settlement.

    Obviously would be good changing description of exexute button (in tooltips.txt)


    There are definitely also other ways how to use it, for example for slavery (when a slaver character captures enemies from a specific (or any ) faction), possibly some loyalists, and so on.
    Last edited by Jadli; April 18, 2021 at 01:26 PM.

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

    Default Re: Post battle recruitment (for example Necromancy or Slavery)

    Thanks for tutorial! Thought about similar method for recruiting deserters from enemy army after large battle for Westeros submod. Or spawning them as rebel army after battle.

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

  3. #3
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Post battle recruitment (for example Necromancy or Slavery)

    Video on how to raise the executed enemies after battle https://www.moddb.com/mods/unofficia...-a-necromancer

Posting Permissions

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