Results 1 to 5 of 5

Thread: This is how you use give_ancillary and remove_ancillary in a script.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    tornnight's Avatar Forum Bot
    Join Date
    Dec 2006
    Location
    Virginia, U.S.A.
    Posts
    1,755

    Default This is how you use give_ancillary and remove_ancillary in a script.

    I was trying to figure out how to add and remove ancillaries via script since that has always been a desire for modders.

    Well this works. But before you get too excited, it has limitations.

    1. Only works with the active player faction because only the player can have a selected character.
    2. Only 1 character can be selected per turn. So if two characters will get through the conditions, only 1 will actually be selected and get the ancillary. I imagine if you do this incorrectly, you could assign a ancillary to an unintended character.

    I'm sure give_trait / remove_trait will also work the same way.

    Tested with MTW2 1.2 Leaked Patch

    monitor_event CharacterTurnStart Trait Leadership > 0
    and not HasAncType leader_anc

    e_select_character
    console_command give_ancillary this leadership_anc_1
    end_monitor

    monitor_event CharacterTurnStart Trait Leadership > 0
    and HasAncType leader_anc

    e_select_character
    console_command remove_ancillary this leadership_anc_1
    end_monitor
    "The first casualty when war comes, is truth." - Hiram Johnson
    Developer of The Long Road Modification

  2. #2
    Indefinitely Banned
    Join Date
    Jun 2006
    Location
    Calgary, Canada
    Posts
    13,967

    Default Re: This is how you use give_ancillary and remove_ancillary in a script.

    YES! Thank you! Its limited but I've been trying to find out how to do this for a while now. + rep

  3. #3
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: This is how you use give_ancillary and remove_ancillary in a script.

    Ok I am reviving this thread as I have been testing some stuff with e_select_character with the Kingdoms .exe.

    There seem to be a LOT of bugs/restrictions.

    This works:
    Spoiler Alert, click show to read: 
    monitor_event CharacterTurnStart FacionIsLocal
    and IsFactionLeader
    and I_TurnNumber > 1

    add_money andor 20000

    e_select_character
    console_command give_trait this Drink

    end_monitor

    However if another trait happens to fire, it fails. I ran this several times, the money added every time so I know the trigger was firing, about 1/2 the time I get the Severe trait on the 2nd turn, and the Drink trait doesnt get added. On the 3rd turn it will add Drink if it didnt get added on the 2nd turn.

    I added the I_TurnNumber > 1 because otherwise it fires as soon as the game starts. Changing it from FactionTurnStart to FactionTurnEnd still adds the money, actually it adds the money twice, but never adds the trait. I assume it adds the money twice because the e_select calls the character in the middle of the turn processing, wierd.




    This works, with the same problem if another trait fires, it adds both traits just fine. Adding more traits seems to work, I added 5 and it ran.
    Spoiler Alert, click show to read: 
    monitor_event CharacterTurnStart FacionIsLocal
    and IsFactionLeader
    and I_TurnNumber > 1

    add_money andor 20000

    e_select_character
    console_command give_trait this Drink
    console_command give_trait this AISightBonus
    end_monitor



    Ok I just discovered something that makes this an entire waste of time. I only have two characters on my map, my faction leader, and my priest. If you have the priest selected when you click End Turn, it adds the traits to the priest. If you have no character selected, it never adds the traits. You also cannot use other commands like reposition_character.

  4. #4
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: This is how you use give_ancillary and remove_ancillary in a script.

    That command doesn't work properly with most events. I think there are some with which it works reasonably well (something like assassination iirc) but it doesn't work on CharacterTurnStart or something in my opinion

    No thing is everything. Every thing is nothing.

  5. #5
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: This is how you use give_ancillary and remove_ancillary in a script.

    Yeah I was trying to get a good list of what it does and doesnt work with, but it seems that having the character actually selected on the map screws everything up. Since we cant really control what is selected when End Turn is clicked, we cant reliably predict whats going to happen.

Posting Permissions

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