Results 1 to 11 of 11

Thread: Garrison script.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Garrison script.

    I´m trying to set up a garrison script.
    I´m posting this for two reasons, first for help, also to put down what I am doing to better realize how this works myself.

    What I have done so far is to create this script for the show_me folder:

    script

    declare_show_me

    suspend_unscripted_advice true

    if I_SettlementOwner Umbar = sassanids

    console_command create_unit Umbar "harad umbarguard" 3 7 3 3
    console_command create_unit Umbar "harad umbarguard" 3 7 3 3
    console_command create_unit Umbar "harad umbarguard" 3 7 3 3
    console_command create_unit Umbar "harad umbarguard" 3 7 3 3
    console_command create_unit Umbar "harad umbarguard" 3 7 3 3
    console_command create_unit Umbar "harad redsandarcher" 3 7 3 3
    console_command create_unit Umbar "harad redsandarcher" 3 7 3 3
    console_command create_unit Umbar "harad redsandarcher" 3 7 3 3
    console_command create_unit Umbar "harad redsandarcher" 3 7 3 3
    console_command create_unit Umbar "harad redsandarcher" 3 7 3 3
    console_command create_unit Umbar "harad scarletshield" 3 7 3 3
    console_command create_unit Umbar "harad scarletshield" 3 7 3 3
    console_command create_unit Umbar "harad scarletshield" 3 7 3 3

    console_command add_population Umbar -2000

    end_if

    wait 3

    suspend_unscripted_advice false

    end_script


    I realize this is only the first part.
    Then I have to edit the export_descr_advice.txt
    There I need to add two things: This to the end of the file, this is the trigger:

    ;------------------------------------------
    Trigger Garrison_Umbar_Trigger_1
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction empire_east
    and I_SettlementOwner Umbar = sassanids
    and I_CharacterTypeNearTile empire_east, 2 291,157
    and FactionLeaderTrait InvadedUmbar = 0

    AdviceThread Garrison_umbar_Thread 1


    Then this to the start of the file:

    ;------------------------------------------
    AdviceThread Garrison_Umbar_Thread
    GameArea Campaign

    Item Garrison_Umbar_Text_01
    Suppressible n
    Uninhibitable
    Verbosity 0
    Threshold 1
    MaxRepeats 0
    RepeatInterval 1
    Attitude Excited
    Presentation Default
    Title Garrison_Umbar_Text_01_Title
    On_display scripts\show_me\Garrison_Umbar.txt
    Text Garrison_Umbar_Text_01_Text1

    All of those scripts I took from XGM and changed the relevant parts, since making this from scratch would be outside my abilities.

    I am sure there is something I am missing however.
    and I_CharacterTypeNearTile empire_east, 2 291,157
    For one, what does the number at the end mean?
    Is it the position of the city?

    I would be very thankful if someone could point me in the right direction, I´m a complete beginner in this.


  2. #2

    Default Re: Garrison script.

    Tried to run the game with these, failed to start, reason being line 34455 col 50 of export_descr_advice
    which is this 2 291,157 number. Must be the settlement position!
    How do I find this out on the map?

  3. #3
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: Garrison script.

    are you sure its complaining because the position isn't the settlement location? I thought you could set any location you wanted on one of those checks...

    when I've used that sort of trigger in script its been formatted like:
    and I_CharacterTypeNearTile greek_cities diplomat, 0 69,79
    I think you're missing the character type part... e.g. yours could have

    and I_CharacterTypeNearTile empire_east named_character, 2 291,157

    could you post the extract from XGM that you're working from, so we can compare the two?

    Code:
    ---------------------------------------------------
    Identifier:              I_CharacterTypeNearTile
    Trigger requirements:    
    Parameters:              faction, character type, distance in squares, x, z
    Sample use:              I_CharacterTypeNearTile romans_julii named_character, 10 48,30
    Description:             Is a particular character type of a faction near a particular tile?
    Battle or Strat:         Strat
    Class:                   I_CHARACTER_NEAR_TILE
    Implemented:             Yes
    Author:                  Guy
    Above is docudemon entry for that condition, your 2 is the distance in squares (you need 2 to cover squares that are 1 away on the diagonal), the x and y you should be able to set to anything within the map area, if you want that to be the settlement location, get back to working version, load campaign map in game. Press ` or whatever opens your Rome console, hover mouse over city and type
    show_cursorstat
    in the console, hit enter and it'll tell you co-ordinates.


    P.S. have you added entries for Garrison_Umbar_Text_01_Title etc to data/text/export_advice.txt?

  4. #4

    Default Re: Garrison script.

    ;------------------------------------------
    Trigger XGM_Garrison_Nisa_Trigger_30
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction dacia
    and I_SettlementOwner Nisa = parthia
    and I_CharacterTypeNearTile dacia general, 2 291,157
    and FactionLeaderTrait InvadedNisa = 0

    AdviceThread Garrison_Nisa_Thread 1


    This is the part I used.

    ;------------------------------------------
    Trigger Garrison_Umbar_Trigger_1
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction empire_east
    and I_SettlementOwner Umbar = sassanids
    and I_CharacterTypeNearTile empire_east, 2 291,157
    and FactionLeaderTrait InvadedUmbar = 0

    AdviceThread Garrison_umbar_Thread 1

    Ok, now it looks like this:

    ;------------------------------------------
    Trigger Garrison_Umbar_Trigger_1
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction empire_east
    and I_SettlementOwner Umbar = sassanids
    and I_CharacterTypeNearTile empire_east general, 2 291,157
    and FactionLeaderTrait InvadedUmbar = 0

    AdviceThread Garrison_Umbar_Thread 1


    But the error is at the InvadedUmbar part now. What does that part mean?
    To check if the character has attacked before?

    I want to set this so that if an army led by either a named general or just led by a regular unit puts the city under siege it spawns the garrison.

    And no, I had not edited the data/text/export_advice.txt file.
    Looking at that now.

  5. #5
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: Garrison script.

    to get it to work for general (regular unit) and named_character (named general)

    you'll need two triggers with different trigger names so
    Trigger Garrison_Umbar_Trigger_2
    with
    and I_CharacterTypeNearTile empire_east named_character 2 291,157
    in it (EDIT: unfortunately you can't say 'or' in condition)

    and FactionLeaderTrait InvadedUmbar = 0
    is checking if the faction leader has the trait "InvadedUmbar"

    if you haven't added an "InvadedUmbar" trait to
    export_descr_character_traits.txt
    that'll be what its upset about now...

    you need to look up XGM's InvadedNisa trait in that file and see how that works... if you add trait you'll need to also add trigger so leader gets it at right point, and also add text for it in data/text/export_VnVs.txt

    if you don't add the text entries you'll get crash when you view general with trait... and if you don't add text entries in data/text/export_advice.txt game will load but will CTD when the advice thread gets used.


    EDIT: it looks like XGM is using the trait so the script only triggers before the leader gets the trait... so stopping it happening all the way through the game... If you don't need to do that you can just take out the 'and FactionLeaderTrait InvadedUmbar = 0' line completely.

  6. #6

    Default Re: Garrison script.

    Ok, I changed this a bit.
    Instead of making a script for Umbar I changed it to Minas Ithil, so it only takes one turn for me to see if it works.
    This is how it looks now:

    script

    declare_show_me

    suspend_unscripted_advice true

    if I_SettlementOwner Minas_Ithil = empire_east_rebels

    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kingspear" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kinglongbow" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kinglongbow" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kinglongbow" 3 3 3 3
    console_command create_unit Minas_Ithil "mf kinglongbow" 3 3 3 3
    console_command create_unit Minas_Ithil "mf shadowrider" 3 3 3 3
    console_command create_unit Minas_Ithil "mf shadowrider" 3 3 3 3
    console_command create_unit Minas_Ithil "mf cultist" 3 3 3 3

    console_command add_population Minas_Ithil -2000

    end_if

    wait 1

    suspend_unscripted_advice false

    end_script

    Changed wait from 3 to 1.
    Then there are the two pieces of text in export_descr_advice:

    ;------------------------------------------
    AdviceThread Garrison_Minas_Ithil_Thread
    GameArea Campaign

    Item Garrison_Minas_Ithil_Text_01
    Suppressible n
    Uninhibitable
    Verbosity 0
    Threshold 1
    MaxRepeats 0
    RepeatInterval 1
    Attitude Excited
    Presentation Default
    Title Garrison_Minas_Ithil_Text_01_Title
    On_display scripts\show_me\Garrison_Minas_Ithil.txt
    Text Garrison_Minas_Ithil_Text_01_Text1


    ;------------------------------------------
    Trigger Garrison_Minas_Ithil_Trigger_1
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction empire_east
    and I_SettlementOwner Minas_Ithil = empire_east_rebels
    and I_CharacterTypeNearTile empire_east general, 2 291,157

    AdviceThread Garrison_Minas_Ithil_Thread 1


    Also added another one for named generals.
    ;------------------------------------------
    Trigger Garrison_Minas_Ithil_Trigger_2
    WhenToTest CharacterTurnStart

    Condition CharacterIsLocal
    and IsFactionLeader
    and I_LocalFaction empire_east
    and I_SettlementOwner Minas_Ithil = empire_east_rebels
    and I_CharacterTypeNearTile empire_east named_character, 2 291,157

    AdviceThread Garrison_Minas_Ithil_Thread 1


    I also edited the text/export_advice.txt file and added the appropriate pieces of text.
    ¬-------------------

    {Garrison_Minas_Ithil_Text_01_Title} Minas ithil garrison

    {Garrison_Minas_Ithil_Text_01_Text1}
    Minas Ithil is garrisoned. (click on "show me")


    However, nothing happens when I lay siege to the city.

  7. #7
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: Garrison script.

    Ok but you've still got
    2 291,157

    I know I said the co-ordinates didn't have to be city (eg it wouldn't stop game loading if they weren't)

    but fairly obviously if you want it to work when someone is standing next to Minas Ithil..... then the co-ordinates would need to be for Minas Ithil

Posting Permissions

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