Results 1 to 3 of 3

Thread: Basic Character Specialization

  1. #1
    Meneth's Avatar I mod, therefore I am
    Join Date
    Jul 2010
    Location
    Oslo, Norway
    Posts
    5,531

    Default Basic Character Specialization

    This tutorial will let you create a basic, expandable character specialization system.
    Files Affected


    • Export_descr_character_traits.txt
    • Export_VnVs.txt

    Part 1 - Making the traits
    Start by creating a governor and a general trait. The effects and amount of levels can be whatever you feel like. Having a NoGoingBackLevel also works, but then a character can't re-specialize. Example:
    Code:
    Trait Governor
        Characters family
        AntiTraits General
        
        Level Governor
            Description Governor_desc
            EffectsDescription Governor_effects_desc
            GainMessage Governor_desc
            Threshold 2
            
            Effect Law 1
            Effect TaxCollection 5
            Effect MovementPoints -2
            Effect TroopMorale -1
            
        Level GoodGovernor
            Description GoodGovernor_desc
            EffectsDescription GoodGovernor_effects_desc
            GainMessage GoodGovernor_desc
            Threshold 4
            
            Effect Law 1
            Effect TaxCollection 10
            Effect Unrest -1
            Effect Command -1
            Effect MovementPoints -4
            Effect TroopMorale -1
            
    ;------------------------------------------
    Trait General
        Characters family
        AntiTraits Governor
        
        Level General
            Description General_desc
            EffectsDescription General_effects_desc
            GainMessage General_desc
            Threshold 2
    
            Effect Law -1
            Effect TaxCollection -5
            Effect MovementPoints 1
            Effect TroopMorale 1
            
        Level GoodGeneral
            Description GoodGeneral_desc
            EffectsDescription GoodGeneral_effects_desc
            GainMessage GoodGeneral_desc
            Threshold 4
            
            Effect Law -1
            Effect TaxCollection -10
            Effect Unrest 1
            Effect Command 1
            Effect MovementPoints 2
            Effect TroopMorale 1
    This will make a character more suited to either governing or military command.
    Part 2 - Making the triggers
    Then, two triggers are needed. The chances can be whatever you feel like. Example:
    Code:
    Trigger Governor
    WhenToTest CharacterTurnEnd
    
    Condition EndedInSettlement
        and Trait Governor < 2
        and RemainingMPPercentage = 100
    
    Affects Governor 1 Chance 75
    
    ;--------------------------------------------
    Trigger General
    WhenToTest CharacterTurnEnd
    
    Condition not EndedInSettlement
        and Trait General < 2
    
    Affects General 1 Chance 75
    This will make a character gain Governor specialization if he's in a settlement, or general specialization if he's out in the field. This will gradually make him better at one of the two tasks.
    Part 3 - making some descriptions
    You shouldn't need any help with this part.
    (Optional)Part 4 - expansion
    This system can easily be expanded upon by adding more levels to each of the traits, or adding more traits. The triggers can then be re-worked so that characters get to a certain level if a specific building is present for example, or if taxes are high, or they recruit a lot of units, just to mention a few possibilities.
    One could make huge trait trees if one felt like it, with in-depth specialization and various effects.

  2. #2
    Semisalis
    Join Date
    Sep 2011
    Location
    New Zealand
    Posts
    412

    Default Re: Basic Character Specialization

    I hope it is acceptable for me to expand on a previous tutorial. Thanks to the Meneth for introducing me to the concept of character specialization.

    What I would like to introduce is character specialization that requires a character to be in a settlement for a number of turns. This is done by assigning a trait that increases as the character remains stationary

    This code assumes you are using a 4 turn per year mod. Traits are assigned at the end of the turn.

    Spoiler for First we create the counting traits

    Open your export_descr_character_traits.txt with Notepad++ or Notepad

    There is a Trait for being stationary in the settlement and a trait that reduces the stationary trait.
    Note that I have not used MovingCharacter as an antitrait although it is possible to do this. The reason I have done this is so that the character will only lose one level instead of two levels of trait if they both move and end a turn outside a settlement (as opposed to either or)
    Code:
    Trait StationaryInSettlement
        Characters family
        ;AntiTraits MovingCharacter
        
            Level TurnsInSettlementOne
            Description TurnsInSettlementOne_desc
            EffectsDescription TurnsInSettlementOne_effects_desc
            Threshold  1
    
            Level TurnsInSettlementTwo
            Description TurnsInSettlementOne_desc
            EffectsDescription TurnsInSettlementOne_effects_desc
            Threshold  2
            
            Level TurnsInSettlement3
            Description TurnsInSettlementOne_desc
            EffectsDescription TurnsInSettlementOne_effects_desc
            Threshold  3
            
            Level TurnsInSettlement4            ; highest level is number of turns per year 
            Description TurnsInSettlementOne_desc
            EffectsDescription TurnsInSettlementOne_effects_desc
            Threshold  4
    
    ;---------------------------------------------------------------
    Trait MovingCharacter
        Characters family
        ;AntiTraits StationaryInSettlement
        Hidden
        
            Level Character_Moved
            Description Character_Moved_desc
            EffectsDescription Character_Moved_effects_desc
            Threshold  1
    At this point you need to remember to also create descriptions for these traits in the export_vnvs.txt file


    Next we create triggers. These triggers will label the character if they are stationary in a settlement. The character will lose levels of the StationaryInSettlement if they use movement points or if they end a turn outside a settlement.
    I have created the trigger to reduce the trait slowly rather than immediately return it to zero because I felt it was unfair if a character to lose all their benefits if they had to come out of a settlement for a single turn to deal with rebels
    Spoiler for Create triggers

    These triggers need to go above the other triggers they affect. In writing this tutorial I have just realised i have done this wrong in my own modding!!!
    Code:
    Trigger No_Move_From_Settlement
        WhenToTest CharacterTurnEnd
        
        Condition EndedInSettlement
              and RemainingMPPercentage > 95         ; note this needs to be changed from 100% to 95% for  anyone following above tutorial, 100% won't work consistently
              and Trait StationaryInSettlement < 4    ; use number of turns per year here
    
        Affects StationaryInSettlement 1 Chance 100
    ;--------------------------------------------------------------    
    Trigger No_Move_From_Settlement2
        WhenToTest CharacterTurnEnd
        
        Condition EndedInSettlement
              and RemainingMPPercentage > 95
              and Trait MovingCharacter > 0
    
        Affects MovingCharacter -1 Chance 100
    ;---------------------------------------------------------------
    Trigger Moved_From_Settlement
        WhenToTest CharacterTurnEnd
        
        Condition RemainingMPPercentage <= 95
        and Trait MovingCharacter < 1
    
        Affects MovingCharacter    1 Chance 100
    
    ;---------------------------------------------------------------
    Trigger Moved_From_Settlement2
        WhenToTest CharacterTurnEnd
        
        Condition not EndedInSettlement
        and Trait MovingCharacter < 1
    
        Affects MovingCharacter    1 Chance 100
    ;--------------------------------------------------------------
    Trigger characterismoving
        WhenToTest CharacterTurnEnd
        
        Condition Trait MovingCharacter > 0
        and Trait StationaryInSettlement > 0
        
        Affects StationaryInSettlement -1 Chance 100
    ;--------------------------------------------------------------
    Trigger removemovemarker                        ; kk removing this trait after all its work is done
        WhenToTest CharacterTurnEnd
        
        Condition Trait MovingCharacter > 0
            
        Affects MovingCharacter -1 Chance 100
    For the mod I have been working on the movement points of the characters change from turn to turn based on the seasons and other factors. If this is the case for your mod then you need to use a movement point percentage of 40% not 95% or the counting won't work properly


    Spoiler for Lastly, adjust the triggers for your admin skills

    Using the example trait above

    Code:
    Trigger Governor
    WhenToTest CharacterTurnEnd
    
    Condition EndedInSettlement
        and Trait Governor < 2
        and Trait StationaryInSettlement >= 3    ; this is one less level than a full year because traits added at end turn
        and Trait General < 2                    ; add this so your characters choose between being high level general or governor
    Affects Governor 1 Chance 75
    
    ;--------------------------------------------
    Trigger General
    WhenToTest CharacterTurnEnd
    
    Condition PostBattle                ; I have changed this to post battle as this is the same as in the game
        and Trait General < 2
        and Trait Governor < 2        ; add this so your characters choose between being high level general or governor
    
    Affects General 1 Chance 75

    Spoiler for Note regards in game traits

    The traits that I have modded this for in the actual game are GoodCommander for generals (also logistic and strategic skill if your mod has it). For admin skills I have modded GoodAdministrator, GoodFarmer, GoodMiner and GoodTaxman

    In the game the Chance of acquiring traits are fairly low so I have generally multiplied them by 3 (for 3 turns) and by 2 if they are relatively high (> 15%)


    Don't adjust bad traits, this allows your characters' skills to decay so they can "retrain" in the future

    Spoiler for More Advanced Usage

    It is possible to have the Traits cycle every year and award skills on an anniversary. I think this is a bad idea because of the issue of your governor occasionally having to leave the settlement to deal with other issues such as rebels. Simply adjust your triggers for awarding Governor or GoodAdministrator so that condition is
    StationaryInSettlement = 4

    To do this simply create a trigger that resets the Trait to level 1 each year

    First change the counter trigger to be one more than your number of turns per year and then add a reset trigger straight below that

    Code:
    Trigger No_Move_From_Settlement
        WhenToTest CharacterTurnEnd
        
        Condition EndedInSettlement
              and RemainingMPPercentage > 95        
              and Trait StationaryInSettlement < 5    ; change this to one more than turns per year
    
        Affects StationaryInSettlement 1 Chance 100
    
    Trigger resetstationary
        WhenToTest CharacterTurnEnd
        
        Condition EndedInSettlement
        and Trait StationaryInSettlement = 5   ; use number of turns per year here
    
        Affects StationaryInSettlement -4 Chance 100
    It is also possible to make the choice to reduce the StationaryInSettlement trait to zero on any movement. Simply put in multiple triggers to reduce value. Again I have not done this as I think it is unfair for the character to lose all that progress in one go.
    Last edited by Col.KanKrusha; September 17, 2014 at 02:52 AM. Reason: fixing spoilers
    ~ Too soon old, too late smart ~

  3. #3

    Default Re: Basic Character Specialization

    thanks guys! exactly what i had been looking for the past couple of hours! just a clear up question, does the campaign difficulty level affect chances of your characters gaining traits in any way?

Posting Permissions

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