Results 1 to 19 of 19

Thread: Characters Labels Overhaul (scripting capabilities improvement)(outdated)

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

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Characters Labels Overhaul (scripting capabilities improvement)(outdated)

    youneuouy asked me to help him with testing this feature in scripts and also if I could explain to others how it works, so lets look into it.

    Characters Labels Overhaul (scripting capabilities improvement)
    M2TW Engine Overhaul Project v1.16

    For starters, lets briefly talk about labels. Labels can be given only to starting characters in descr_strat or characters spawned on events in campaign_script, they can have only one label, and through those labels you can do many interesting actions with them (and their armies). You can use the label in several console commands, as well as in scripting. So basically, as long you knew the label (or a name) of those characters, you could do many things with them.

    However, for perfect scripting that is not enough, as when you want to create more elaborate features and events, you usually need something that has a wider use and can target any character in the map at any time, not just starting (or spawned) characters. Such things, if not impossible, usually required insane amount of scripting to get it to work un some imperfect way.

    Being able to assign labels to any characters whenever you want is something that would improve and all this, and mainly bring completely new features into scripting. And that is exactly what this next update of the M2TW Engine Overhaul Project (v1.16) does!

    1. Setting up your cfg file

    The first step is to download the tool and extract it into your mod. To get all its featurs to work, you have to edit your mod launcher (the .bat file) and write to its beginning "start applyHotSeatToolPatches.bat". Most of features you can set up in "limits.youneuoycfg". However, to set up labels, you have to go to youneuoy_Data folder, in which you can find "labels.youneuoycfg" and "labels_immutable.youneuoycfg". Those two are the files we are going to work with.
    (and logs for each cfg you can find in the logs)

    In "labels.youneuoycfg" you can set up your new precious labels and most importantly triggers for them. So lets looks into how to do it:
    The basic structure is
    Code:
    label name
    priority 
    number of conditions that must be true
    conditions
    The Label name has three lines.
    - The first must be always the same, and must be saying "label:". It tells the program a new label section is starting.
    - The Second line is for how will the label be referred to in the logs. Moreless something to help you remember what its supposed to be doing.
    - Third and the most important line is the code name of the lebel. The word by which will you call the characters with the labels, thus, the most important. It must be one word.
    So it can look something like this:
    Code:
    label:
    My New Precious label
    my_new_precious_label
    The Priority tells the program which label is more important. A new label will overwrite the old label, so inevitably, you will end up many labels and there will be some important ones you will not want to be overriden by less important ones. Or for example you will have a sequence of labels, where you first need a character to get a first label, then second and so on.
    - You tell the program what priority each label has simpy by a number. The higher number the higher priority. To be precise, if a character receives.
    So for example:
    Code:
    label:
    My New Precious label
    my_new_precious_label
    1
    ..
    Code:
    label:
    My New Precious label 2
    my_new_precious_label_2
    0
    ...
    If character has my_new_precious_label, it will not be overwritten by my_new_precious_label_2.

    The next line is the number of conditions that must be true. Simply as for priority, you just write a number. If your trigger has only one condition, you write 1, if it has 3 conditions, you write 3. So for example:
    Code:
    label:
    My New Precious label
    my_new_precious_label
    1
    2
    ..
    Lets elaborate the conditions, the essential part. Each condition must have three lines.
    - The first line is the type of condition. That can be:
    "passed turns" - the numbers of turns since the beginning of the game after which will this condition come true.
    "name" - name of a character.
    "trait" - a trait that a character must have. You can't specify the level of the trait. It means that the condition will come true for any level of the trait.
    "ancillary" - an ancillary a character must have
    "label" - a label that a character must have (it will be overwritten by the new label)
    "4_coords" - This one is an exception and has 6 lines in total. By this you you specify coordinates in which a character must be for the condition to come true.

    - The second line is a number and it can have 3 values, telling is whether this condition must be true
    "0" - this means this condition is optional
    "1" - this condition is mandatory
    "2" - this means the condition is forbidden to come true

    - The third line specifies what code name will it the trigger look for, based on the type of condition. So you will write there a name of a character, or name of a trait, or a name of ancillary, or a name of label. For 4_coords you write there x and y coordinates into 4 lines in this order: xmin, ymax, xmax, ymin. (you can write the min and max to be the same, to check only 1 tile).

    So a whole working label trigger can look like this

    Code:
    label:
    My New Precious label
    my_new_precious_label
    1
    2
    label
    1
    my_new_precious_label_2
    4_coords
    1
    77
    111
    77
    111
    So if a character has my new_precious_label_2 and is standng on x 77, y 111, he will receive my_new_precious_label

    We only used mandatory conditions, lets see how to use optional ones:

    Code:
    label:
    My New Precious label
    my_new_precious_label
    1
    2
    label
    1
    my_new_precious_label_2
    ancillary
    0
    sword
    ancillary
    0
    shield
    Now we have 3 conditions. The number of conditions that must come true is 2, so only 2 of them must be true. However, as "label" has value 1, and both ancillaries have value 0, it means for a character to receive my_new_precious_label he must have my_new_precious_label_2 and either sword or shield ancillary.

    We can also forbid some conditions to come true, like this:

    Code:
    label:
    My New Precious label
    my_new_precious_label
    1
    2
    label
    1
    my_new_precious_label_2
    ancillary
    0
    sword
    ancillary
    0
    shield
    trait
    2
    too_old
    So now, the same as above is valid. However if a character has any level of "too_old" trait, he will not receive my_new_precious_label.


    Thats it! Now you should know all the posibilites of the file.

    Hint - Make sure there are no emtpy spaces after any of the lines with the trigger. Then it all would stop working.

    Hint 2 - There can be more triggers for the same label.

    In the other file, "labels_immutable.youneuoycfg", you simply write labels that cannot be overwritten by other your new labels. Why? Well, if you have some existing labels that are already part of various scripts, events and so on, you dont want to override them. Simply write one per each line.

    There is a video by youneuoy covering most of this:
    Spoiler Alert, click show to read: 



    2. Setting up campaign_script

    Thats all nice, but to actually use it, you naturally have to go into campaign_script and create some scripts utilizing it. I assume most of you know how to do some scripting, so I suppose I dont need to talk that much about it. (and Im not one the best scripters anyway)

    There is one big but, you need to be aware of. Eventhough numerous characters can now share the same label, the game will always consider only the first one to have it. So if you will have 10 characters who you want to kill (because they received the label based on your trigger), and you write "console_command kill_character my_new_precious_label", it will kill only the first one.

    So either we will have to make more insane script codes to fix the new issue we just created and make it work for all of the labelled characters somehow, or youneuoy will figure it out somehow. And he did .

    If into your script (or if you just open console panel in game) write this:
    "give_trait my_new_precious_label try_change_this_label"
    It will erase the label! Thus, after you use this character for an action, you should write this, so his my_new_precious_label us eras, and it can be used for another labelled character in line.
    A visual example in another video by youneuoy
    Spoiler Alert, click show to read: 


    Alternatively, you can also use this:
    "give_trait my_new_precious_label try_change_this_label_to:newlabel"
    That will change a label of existing character with label my_new_precious_label (still the first one in line) into a new label, called "newlabel". That can in part replace the cfg file, for some cases.

    Both of those lines will say report an error, that a character with this label doesnt exist, but its all fine. The scripts will still work fine.

    Alright, now to the scripting itself. Im pretty confident, you will want to make something, that can happen several times, not just once. So your script should look something like this:
    Code:
    monitor_event ....
         ....
         do something
         ....
    end_monitor
    Its essential that there is no "terminate_monitor". Otherwise the event would fire just once.


    So lets try to make a meaningful script. I think it might be better to avoid "usual" types of monitor_events that trigger at the beginning/end of turn, as I assume those might trigger just once eventhough you might have more labelled characters. Havent had time to test it properly though, I assume it might work when written smartly.

    So we should rather use monitor_events that get triggered when we do or click on something. Some examples I can think of

    Code:
    monitor_event CharacterSelected CharacterIsLocal
          and I_EventCounter Lets_murder_someone > 0
          and I_CharacterExists my_new_precious_label
    
                kill_character my_new_precious_label
                set_counter  Lets_murder_someone 0
    end_monitor
    Assuming my_new_precious_label was someone that deserved it, something smart done in cfg.
    See, here we didnt even have to use that command for removing label, as the character died

    or somethng like this:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
          and AgentType = priest 
          and I_CharacterExists priest_ready_to_promotion
    
               give_ancillary priest_ready_to_promotion cardinal
               give_trait priest_ready_to_promotion try_change_this_label
    end_monitor
    or somethng like this:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
          and IsFactionLeader 
          and I_FactionLeaderTrait kingship = 3
          
          remove_ancillary faction_leader duke
          give_ancillary faction_leader king
    
          create_unit faction_leader "Mailed Knights" 3 3 3 3
          create_unit faction_leader "Mailed Knights" 3 3 3 3
          create_unit faction_leader "Mailed Knights" 3 3 3 3
    end_monitor
    or like this:
    (of course assuming you would have some nice trigger for obtaitning traitor label)
    Code:
    monitor_event FactionTurnStart FactionIsLocal
          and I_CharacterExists traitor
          and I_EvenCounter Civil_War = 1
          and not FactionBuildingExists > cathedral
    
        spawn_army
                    faction slave, sub_faction england
                    character random_name, named character, age 34, x 302, y 290
                    traits LoyaltyStarter 1 , GoodCommander 2 , ReligionStarter 1 , GoodAttacker 1 
                    unit        Rebels                exp 9 armour 0 weapon_lvl 0
                    unit        Rebels                exp 9 armour 0 weapon_lvl 0
                    unit        Rebels                exp 9 armour 0 weapon_lvl 0
                    unit        Rebels                exp 9 armour 0 weapon_lvl 0
                    unit        Rebels                exp 9 armour 0 weapon_lvl 0
        end
      
    end_monitor

    Well, there of course many other better ways to use it, just something I could think of right now. I likely also made some mistake in it, so let me know to fix it

    3. Implementing in your mod - Show examples

    This feature possibly bring new amazing scripts that were not possible at all before. I suggest everyone who has some ideas how to use it, or already used it, show your examples so we can discover new scripting possibilites!

    Some examples of my own, I managed to implement in short time in my mod TES mod.

    - Crafting an alchemy potion from ingredients

    cfg part
    Code:
    label:
    potion making 1
    potion1
    1
    3
    ancillary
    1
    torchbug_thorax
    ancillary
    1
    spider_egg
    ancillary
    1
    scrib_jelly
    ancillary
    2
    potion_hitpoints_1

    script part:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
        and AgentType = merchant
         (and HasAncType torchbug_thorax)
         (and HasAncType spider_egg)
         (and HasAncType scrib_jelly)
        and I_CharacterExists potion1
        
        remove_ancillary potion1 torchbug_thorax
        remove_ancillary potion1 spider_egg
        remove_ancillary potion1 scrib_jelly
        give_ancillary potion1 potion_hitpoints_1
        give_trait potion1 try_change_this_label
            
    end_monitor
    That is true crafting in real time! Hardly possible before for any merchant/alchemyst.



    - And lets conclude with some new ways how to torment our machines

    cfg part
    Code:
    label:
    TES label 1
    testestlabel
    0
    2
    passed_Turns
    1
    1
    ancillary
    1
    Almalexia
    
    label:
    TES label 2
    testestlabel2
    1
    2
    4_coords
    1
    332
    192
    332
    192
    label
    1
    testestlabel
    
    label:
    TES label 3
    testestlabel
    1
    2
    4_coords
    1
    370
    156
    370
    156
    label
    1
    testestlabel2

    script part:
    Code:
    monitor_event FactionTurnStart FactionIsLocal
            and I_CharacterExists testestlabel
        
            repostion_character testestlabel, 332, 192
            
    end_monitor 
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_CharacterExists testestlabel2
        
            repostion_character testestlabel2, 370, 156
            
    end_monitor

    (yes, could have been just script using "try_change_this_label_to:testestlabel2" but I made it before the function was there, so at least some more examples of how can it look like tp help you out...

    Share your own examples of or ideas how to use it!
    Last edited by Jadli; May 15, 2020 at 08:49 AM.

  2. #2

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Thank you for the guide .

    Quote Originally Posted by Jadli
    Alternatively, you can also use this:
    "give_trait my_new_precious_label try_change_this_label_to:newlabel"
    That will change a label of existing character with label my_new_precious_label (still the first one in line) into a new label, called "newlabel". That can in part replace the cfg file, for some cases.
    Does the label replaced will be yet available next (i mean immedialty)? And does it make a difference if this original label is given via script?

    More concretely, let's say that i make spawn a character via script with the label "alpha", and that i change this one for "bravo" before to kill bravo. Will i be able to use again "alpha" and "bravo" immediatly after?

    Quote Originally Posted by Jadli
    I likely also made some mistake in it, so let me know to fix it
    In the scripts of "2. Setting up campaign_script", give_trait, give_ancillary and remove_ancillary feel alone without a "console_command" before them .

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

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by Erken View Post
    Thank you for the guide .

    Does the label replaced will be yet available next (i mean immedialty)? And does it make a difference if this original label is given via script?

    More concretely, let's say that i make spawn a character via script with the label "alpha", and that i change this one for "bravo" before to kill bravo. Will i be able to use again "alpha" and "bravo" immediatly after?
    If you use "give_trait oldlabel try_change_label(_to:newlabel), that takes effect immediately . Youneuoy made this to sort the original issue, where one couldnt have used more characters with the same label than the first one.
    So yes, you will be able to use it immediately after, possibly unlimited times per turn. Whereas the assigning label through the labels.youneuoycfg happens only once in turn, always before begining of your next turn I believe


    Quote Originally Posted by Erken View Post
    In the scripts of "2. Setting up campaign_script", give_trait, give_ancillary and remove_ancillary feel alone without a "console_command" before them .
    Yea, exactly what I said Thanks

  4. #4

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    A little script repeating an action (here give an ancillary) for every character using a same label ("alpha"). It simply illustrates the necessity of removing/changing the label once the action has been performed. Otherwise only one character will be affected: the one having the highest priority (no idea what determines this one though).
    Code:
    monitor_event PreFactionTurnStart FactionIsLocal
        inc_event_counter e_HotSeatTool 1
    end_monitor
        
    monitor_event EventCounter EventCounterType e_HotSeatTool
        campaign_wait 1
            if I_CharacterExists alpha
                console_command give_ancillary alpha bard
                console_command give_trait alpha try_change_this_label
            end_if
            if I_CharacterExists alpha
                inc_event_counter e_Repeat 1
            end_if
    end_monitor
        
    monitor_event EventCounter EventCounterType e_Repeat
        campaign_wait 1
        inc_event_counter e_HotSeatTool 1
    end_monitor

  5. #5

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by Erken View Post
    A little script repeating an action (here give an ancillary) for every character using a same label ("alpha"). It simply illustrates the necessity of removing/changing the label once the action has been performed. Otherwise only one character will be affected: the one having the highest priority (no idea what determines this one though).
    The game is looking for the first character in the list with such a label, that's all.
    The priority in the config file determines the label that will be given to the character if he has the same conditions for several of them at once.

  6. #6
    franky317's Avatar Libertus
    Join Date
    Jul 2011
    Location
    Rieti, (Ita)
    Posts
    99

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    this is how I used the labels to be able to kill the heir and to be able to choose him .

    first of all :


    open the labels_youenuoycfg file and insert the following strings:

    Spoiler Alert, click show to read: 
    label:
    test label heir
    label_heir1
    1
    1
    trait
    1
    Factionheir



    So each faction heir will have the label: label_heir1.

    Part 2 :

    from Bellum Crucis 6.3 onwards, there is already an ancillary that almost always allows to designate the future heir.
    if you use another mod without it you will have to create a special ancillary.
    Spoiler Alert, click show to read: 
    open export_descr_ancillaries and copy this ancillary top of page:


    ;------------------------------------------
    Ancillary custom_heir
    Type custom_heir
    Transferable 1
    Image tokus_kingmaker.tga
    Description custom_heir_desc ------>to be added in data / text / export_ancillaries
    EffectsDescription custom_heir_effects_desc ------>to be added in data / text / export_ancillaries
    Effect Authority 20
    Effect Loyalty 2

    and at the end of the page:


    ;------------------------------------------
    Trigger custom_heir1
    WhenToTest CharacterTurnEnd


    Condition IsGeneral
    and IsFactionLeader
    and FactionIsLocal
    and not FactionwideAncillaryExists custom_heir
    and not CharFactionType papal_states
    and not CharFactionType slave


    AcquireAncillary custom_heir chance 100


    Now let's write the actual script:
    Let's go to your campaign's campaign_script and write like this:

    Spoiler Alert, click show to read: 
    ;;;;;;SCELTA EREDE


    declare_counter erede_c
    set_counter erede_c 1


    monitor_event ButtonPressed ButtonPressed family_tree_zoom_to_button
    if I_CompareCounter erede_c = 1
    set_counter erede_c 2
    end_if
    end_monitor


    ;Assassinare Erede-


    monitor_event CharacterSelected CharacterIsLocal
    and not IsFactionLeader
    and not IsFactionHeir
    if I_CompareCounter erede_c = 2
    historic_event custom_heir
    console_command give_ancillary this custom_heir
    set_counter erede_c 3
    end_if
    end_monitor


    monitor_event FactionTurnStart FactionIsLocal
    and I_CompareCounter erede_c = 3
    historic_event assassino_erede true factions { all, }
    set_counter erede_c 4
    end_monitor


    monitor_event FactionTurnEnd FactionIsLocal
    and I_EventCounter assassino_erede_accepted = 1
    and I_CompareCounter erede_c = 4
    console_command kill_character label_heir1
    set_event_counter assassino_erede_accepted 0
    set_counter erede_c 1
    end_monitor



    let's not forget in data / text to modify the historic_events file:

    Spoiler Alert, click show to read: 
    {CUSTOM_HEIR_BODY}Mio signore, la successione dinastica rappresenta un argomento di fondamentale importanza per l'amministrazione del vostro regno. Designare il Vostro erede non significa solo conferire un titolo di grande prestigio ad uno dei vostri familiari ma equivale a scegliere chi un giorno siederà sul trono che vi è appartenuto di diritto. Da questa scelta dipende il futuro del Regno, starà al vostro successore portarlo alla gloria... o alla distruzione! Per tanto non vi è che una soluzione... trattare la questione con gran delicatezza e scegliere con gran cura! Chi avrà in mano le chiavi del regno sarà il principale artefice del suo futuro! \n\nTutta via, mio sovrano, esistono delle leggi alle quali anche Voi, per volere di Dio, dovete sottostare, così come i Vostri predecessori fin dal 510 anno in cui Clodoveo I re dei franchi le fece redigere. Lo stesso sarà per chi verrà dopo di Voi. Questa raccolta di antichissime norme giuridiche, messa per iscritto da Clodoveo I ma a lui preesistente, costituisce la principale fonte del diritto in materia delle successioni dinastiche prende il nome di "Lex Salica" (Legge Salica).\n\nEssa stabilisce che « Nessuna terra (salica) può essere ereditata da una donna, ma tutta la terra spetta ai figli maschi » (« De terra vero nulla (salica) in muliere hereditas non pertinebit, sed ad virilem sexum qui fratres fuerint tota terra pertineat»). La successione passa quindi per via maschile. La "via femminile" ne è esclusa salvo nel caso in cui la prima si sia estinta e quindi non vi siano successori maschi in grado di avanzare pretese.\n\nPertanto la Legge Salica impone che:\n\n- La corona in possesso del sovrano che abbia dei figli debba, alla sua morte, essere trasmessa ai suoi discendenti in linea diretta. Il primo ad essere chiamato in causa sarà il figlio primogenito maschio che sia già maggiorenne, in quanto Erede Legittimo per diritto di sangue! Questa norma non ammette eccezioni e verrà applicata che voi lo vogliate o no, a meno che al momento della nomina dell'erede il figlio del sovrano sia ancora minorenne e pertanto non in grado di assolvere i suoi compiti.\n\n- In caso di morte dell'Erede Legittimo, se questi ha un fratello che sia anch'esso maggiorenne la corona passerà a quest'ultimo per diritto di sangue. La stessa cosa avviene se è stato adottato dal sovrano, nonostante non sia esattamente di "sangue reale".\n\n- In caso di morte del sovrano, salirà al trono l'erede da lui già designato in precedenza. Tuttavia anche in presenza di fratelli (di sangue o no) la scelta potrà ricadere su qualsiasi familiare dell'albero genealogico "reale", sempre qualora il nuovo re non abbia già figli maschi maggiorenni che possano pretendere al trono in qualità di Eredi Legittimi... in caso contrario qualsiasi familiare appartenente alla famiglia potrà essere "elevato" ad erede al trono. Tuttavia sarebbe saggio scegliere membri interni della propria dinastia regnante per non "sradicarla" dal trono e mantenerla al potere... ma questa decisione spetterà solo a Voi. Nulla nella legge vi vieta, in questo caso, di scegliere chi ritenete più idoneo ad assolvere l'onore e l'onere di far da guida al vostro popolo!\n\n- Il Sovrano che non abbia figli maschi e quindi Eredi Legittimi non potrà pertanto passare la corona ai suoi discendenti essendone privo. In questo caso la corona potrà essere affidata a qualsiasi familiare membro della vostra dinastia o del vostro albero genealogico che sia vivo e maggiorenne, secondo il Vostro giudizio.\n\nQualsiasi decisioni Voi prenderete, secondo le leggi e l'aiuto di Dio, possano esse portare gloria, onore e prosperità al nostro regno!
    {CUSTOM_HEIR_TITLE}Lex Salica
    {ASSASSINO_EREDE_BODY}Compiendo questo atto, sceglierai tu il tuo prossimo erede , ma ti macchierai di un grave crimine.... sperando che il tuo segreto resta tale....
    {ASSASSINO_EREDE_TITLE}Vuoi uccidere il tuo erede


    is a basic script, many things can be added when killing the heir.


    example: riots, riots, faction split etc. etc.
    just have a little imagination :-)


    and for those who have not seen the video in the other post here it is again here:


  7. #7

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Could it be possible to add "label" as condition? So that when a character has just received the label "alpha", if he meets further in the file the conditions for another label, then it can be changed for "bravo". It would allow to combine simultaneous actions at the same time without adding "extra actions just in the case" for labels. The priority is useful when some actions linked to labels can be delayed, but in the other cases it becomes problematic.

    Otherwise, i am at 281 labels at this time, and i have no problem.

  8. #8
    Louis Lux's Avatar Into the Light
    Patrician

    Join Date
    Aug 2008
    Location
    London
    Posts
    4,708

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    In m2tw the only way to give generals a custom battle model is via the descr_strat or by spawning a character via the campaign script.

    Would it be possible to give all generals with a specific trait a custom battle model via labels?

  9. #9
    ekusik's Avatar Foederatus
    Join Date
    May 2014
    Location
    Islands of Nine Provinces
    Posts
    48

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    I forgot complete knowledge about this. But at least, faction leader and faction heir can have custom battle model via campagin_script.
    example from TheraV4
    ; spain

    monitor_event BecomesFactionHeir FactionType spain

    change_battle_model spain heir spanish_viceroy

    end_monitor

    monitor_event BecomesFactionLeader FactionType spain

    change_battle_model spain leader spanish_viceold

    end_monitor
    I personally think if I use export_descr_character_traits (ie. Trait Elladan: that have Effect Level 4 and connect to strat_model elladan in descr_character) as script trigger, It made me change battle_model via script without spawning new character. But I forget I tried it or not.

    An example found from Aragorn RPG. It use trait as trigger.
    monitor_event CharacterTurnStart CharacterIsLocal and AgentType = named character
    and Trait Aragorn >= 1
    and IsRegionOneOf Harrowdale_Province
    and I_CompareCounter army_dead = 1
    historic_event army_dead2
    change_battle_model turks leader elessar

    console_command give_trait kingdead1 KingDead 1
    console_command give_trait kingdead1 hero_ability25 1
    set_counter army_dead2 1
    terminate_monitor
    end_monitor
    I wonder it would work for generals that have "Province Lord" trait.
    Last edited by ekusik; July 13, 2020 at 08:23 AM.

  10. #10

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by ekusik View Post
    I forgot complete knowledge about this. But at least, faction leader and faction heir can have custom battle model via campagin_script.
    example from TheraV4


    I personally think if I use export_descr_character_traits (ie. Trait Elladan: that have Effect Level 4 and connect to strat_model elladan in descr_character) as script trigger, It made me change battle_model via script without spawning new character. But I forget I tried it or not.
    What an interesting command, I did not know what it was. I'll see if I can do something with it. Does this command change animation?
    Louis Lux,
    I do not know if this can be done and if there are corresponding commands in the scripts. If they are not, then I will try to do something.
    Last edited by youneuoy; July 13, 2020 at 07:54 AM.
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  11. #11
    Louis Lux's Avatar Into the Light
    Patrician

    Join Date
    Aug 2008
    Location
    London
    Posts
    4,708

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    I know about heir and faction leader but I'm wondering for regular generals.
    Changing strat map models is not a problem but changing the battle model via campaign_script.txt is a problem.
    So perhaps labels could be a solution.

  12. #12
    Louis Lux's Avatar Into the Light
    Patrician

    Join Date
    Aug 2008
    Location
    London
    Posts
    4,708

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Does this command change animation?
    No, it changes the 3D model of the general in the battle map. It only works for the faction leader and the faction heir. If it worked on regular generals that would be amazing.

  13. #13

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by Louis Lux View Post
    No, it changes the 3D model of the general in the battle map. It only works for the faction leader and the faction heir. If it worked on regular generals that would be amazing.
    Are there ways to change the animation?
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  14. #14

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Louis Lux
    ,
    ekusik
    :
    Ok, I can make a model change (but not using scripts, the setting will be in a .cfg file. Have you seen how this is done in the program with other things? I could do it the same way, and the model change itself should be done not after end turn but on Army deployment screen on a strategic map (when one army attacks another)). The criterion for the change can be made traits, faction, label, anything else - for this I need only your suggestions and my time. And of course, I would like to see a practical embodiment of this
    Will it fit?
    Last edited by youneuoy; July 13, 2020 at 08:41 AM.
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  15. #15
    Louis Lux's Avatar Into the Light
    Patrician

    Join Date
    Aug 2008
    Location
    London
    Posts
    4,708

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Yes that would work. If you can do it through a trait that would be great. This would be for DCI and use family tree traits, example:

    Trait
    Code:
    Trait RhovanionFamilyTree     Characters family
    
        Level FritigernTree
            Description FritigernTree_desc
            EffectsDescription FritigernTree_effects_desc
            Threshold 1
    
            Effect Authority 1
            Effect Level 1


    Trigger
    Code:
    Trigger RhovanionFamilyTreeTrigger1
        WhenToTest CharacterComesOfAge
    
        Condition FactionType scotland
                and FatherTrait RhovanionFamilyTree == 1
    
        Affects RhovanionFamilyTree 1  Chance  100


  16. #16

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by Louis Lux View Post
    Yes that would work. If you can do it through a trait that would be great. This would be for DCI and use family tree traits, example:

    Trait
    Code:
    Trait RhovanionFamilyTree     Characters family
    
        Level FritigernTree
            Description FritigernTree_desc
            EffectsDescription FritigernTree_effects_desc
            Threshold 1
    
            Effect Authority 1
            Effect Level 1


    Trigger
    Code:
    Trigger RhovanionFamilyTreeTrigger1
        WhenToTest CharacterComesOfAge
    
        Condition FactionType scotland
                and FatherTrait RhovanionFamilyTree == 1
    
        Affects RhovanionFamilyTree 1  Chance  100

    Ok, I’ll try to do this as soon as possible, after which I will give a link to the test version of the program.
    Also, in a few days I will transfer messages from here to the topic of discussions of the new functionality of the program, it seems to me that here it is offtopic.
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  17. #17

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Quote Originally Posted by Louis Lux View Post
    Yes that would work. If you can do it through a trait that would be great. This would be for DCI and use family tree traits, example:
    I did it, and in my opinion it turned out cool. A little later I’ll make an instruction and give a link to the test version (until tomorrow).
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  18. #18

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    Louis Lux
    ,
    Done. Link: https://www.twcenter.net/forums/show...1#post15933751
    You can also change the models of the heir, ruler, etc. (with a large number of change options, depending on the trait, turn number, anything). It also works faster than a script - I recommend using this particular method. I am waiting for feedback.


    I will transfer these messages a little later.
    People always have been the foolish victims of deception and self-deception in politics, and they always will be, until they have learned to seek out the interests of some class or other behind all moral, religious, political and social phrases, declarations and promises
    medieval 2 total war engine overhaul project

  19. #19

    Default Re: Characters Labels Overhaul (scripting capabilities improvement)

    A little script using the label system to simulate civilian ships: when an agent is positioned on a port, he's teleported near an opposite port at the beginning of the next turn. Thus straits can be crossed without mobilizing a war fleet, and historical maritim routes can be represented. I use it only for agents to avoid conflicts with other labels, but of course it can also be adapted for bodyguards.

    (The point of arrival is never the opposite port but one of the tile around, since reposition_character would not work properly otherwise.)

    The trait used by the agents:

    Code:
    ;------------------------------------------
    Trait CanUseCivilianShips
        Characters spy, assassin, diplomat
        Hidden
        
        Level CanUseCivilianShips_A
            Description Hidden_desc
            EffectsDescription Hidden_effects_desc
            Threshold  1
    Code:
    ;------------------------------------------
    Trigger CanUseCivilianShips_1
        WhenToTest CharacterTurnEnd
            
        Condition CharacterIsLocal
            and Trait CanUseCivilianShips = 0
            
        Affects CanUseCivilianShips  1  Chance  100
    One of the labels:

    Code:
    ;------------------------------------------
    label:
    Ferry Albion - Aremorika
    fry_1
    3
    2
    trait
    1
    CanUseCivilianShips
    4_coords
    1
    66
    231
    66
    231
    The script:
    Code:
    monitor_event CharacterTurnStart CharacterIsLocal
        if I_CharacterExists fry_1
            reposition_character fry_1, 69, 221
            console_command give_trait fry_1 try_change_this_label
        end_if
        if I_CharacterExists fry_2
            reposition_character fry_2, 66, 232
            console_command give_trait fry_2 try_change_this_label
        end_if
        if I_CharacterExists fry_3
            reposition_character fry_3, 85, 229
            console_command give_trait fry_3 try_change_this_label
        end_if
        
        [...]
        
    end_monitor
    A trait with a movement penalty could also be given to the character before removing the label, but in my case crossings are very short (max just a few days), so it's not necessary.

Posting Permissions

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