Results 1 to 6 of 6

Thread: Endless Trait Script

  1. #1

    Default Endless Trait Script

    Hi, I've added a trait which acts as a surname giver via epithet. Because existing characters in descr_strat never got the epithet that went with the trait, I re-gave them the trait via campaign script.
    monitor_event FactionTurnStart FactionType uineill

    console_command give_trait "Lugid" bloodlineuineill 1

    console_command give_trait "Eoghan" bloodlineailech 1

    console_command give_trait "Conall" bloodlineailech 1

    But now this repeats every turn. As long as these characters are alive. Aaaaand, every time a character from that faction has the same name, they will also get it.
    How do I limit this script from firing every single turn?


  2. #2

    Default Re: Endless Trait Script

    You don't need to specify a faction for FactionTurnStart. If you just use FactionTurnStart (or even PreFactionTurnStart) with no other conditions then the effects of this monitor will fire at the start of the campaign, which I presume is what you want, rather than firing at the start of this uineill faction's turn (which means that these characters won't have their epithets during the first turns of any factions that come before uineill). If this monitor only needs to fire once, use terminate_monitor at the end just before end_monitor.

    Since all of these characters are spawned in descr_strat and are therefore known to us, they can and should be given unique labels and you should use these labels to identify them in the above monitor. Names are never a reliable way to identify individual characters. If you do insist on using names for something, know that quotation marks " are only needed if the name contains spaces, i.e.:

    console_command give_trait SingleWordName trait 1
    console_command give_trait "Multiple Word Name" trait 1
    Also, code should be enclosed in [code] [/code] rather than quotes.

  3. #3

    Default Re: Endless Trait Script

    Thank you, this is very helpful.

    I will use PreFactionTurnStart.
    I was using the FactionType as a specifier as some characters on descr_strat have the same name and I was not aware of unique labels. But, come to think of it, I think I've seen it in passing. It's in descr_strat, mentioned after the coordinates and before the custom portrait, right? Do they need to be present in another file except descr_strat before I can use them in the campaign script?

    terminate monitor
    tip is very much appreciated! This solved my problem, but the rest of your advice gave me many more possibilities! Thanks.

  4. #4

    Default Re: Endless Trait Script

    When you say this in campaign_script:

    monitor_event FactionTurnStart FactionType faction_name
    you are monitoring the start of some faction's turn and you're specifying which faction this is. Then, within this monitor, you're issuing console commands to give traits to some characters with certain names. The faction whose turn it is when you issue these console commands does not, in any way, change which characters the console commands act on. You can give traits (or do anything else allowed by script commands) to any character on the map during any faction's turn (or during any other event allowed by script conditions).

    Now, as for labels - I don't think the order of items on the 'character' line matters. I have always seen the name and type come first followed by everything else in random order. I usually put the label last but all of the following should be equally valid:

    character    Orodreth, named character, male, age 41, x 314, y 184, portrait Orodreth, hero_ability CAPTAIN, label orodreth_1  ;this is the order I typically use
    character    Orodreth, named character, male, label orodreth_1, x 314, y 184, age 41, portrait Orodreth, hero_ability CAPTAIN
    character    Orodreth, named character, male, x 314, y 184, portrait Orodreth, label orodreth_1, hero_ability CAPTAIN, age 41
    and you can add labels to characters spawned in campaign_script as well:

        faction timurids
        character        random_name, admiral, age 20, x 284, y 385, direction S, label fleet_1   ;here's an admiral with a label and a random name, do not attempt to use random_name in descr_strat as it doesn't work
        unit             merc cog            exp 0 armour 0 weapon_lvl 0
    The above is sufficient to assign labels to characters - they do not need to be set up in any other files.

    Labels are essential for scripting. Labels are usually unique and used to identify individual characters without ambiguity. Whereas the game randomly assigns names to new characters and we can spawn characters using random_name, labels are always assigned deliberately by us, not the game, which makes them ideal for identifying individuals. Labels do not need to be unique, but the only uses I can envision for assigning multiple characters the same label is for killing a group of characters using kill_character or performing some script action on a number of characters who are meant to represent the same character respawned over and over again (both of these scenarios can be handled with EOP without using duplicate labels). The only time you can ever be sure you have gotten the right character when using their name is if they are uniquely named, and even then I would recommend using label wherever possible.

  5. #5

    Default Re: Endless Trait Script

    I'm curious about the epithets: why don't they appear on the characters when you gave the trait via descr_strat? Is it because the epithet is only applied when gaining the trait, and not on character creation? And is there the same problem when creating characters via script, do they gain an epithet or not if given the relevant trait?
    Belovèse's Toolbox: export text files to spreadsheet, detailed unit stats
    Stainless Steel Historical Improvement Project (SSHIP) team member.
    Mini-mods: diplomacy and relation/reputation - detailled unit stats

  6. #6

    Default Re: Endless Trait Script

    Epithets added to characters using the traits line within spawn_army in campaign_script will be added correctly. So triggers and console commands are not necessary to add epithets.

    I've read that epithets added in descr_strat work only for the faction leader. But in my experience they never work in descr_strat for any character including the faction leader, whether the faction is using surnames or not. This indicates to me that it could be a parsing order issue.

Posting Permissions

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