Page 2 of 4 FirstFirst 1234 LastLast
Results 21 to 40 of 70

Thread: How to:Script spawn armies(make your own spartacus and hannibal!)

Hybrid View

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

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    It is not possible, unfortunately. All spawned named characters will be generals.

  2. #2

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Hmm.. i tryed using this example only with 4turns/year script in BI and the game crashes before i can enter stratigic map. Any one managed to get 4turns per year in BI by using script?

  3. #3

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)



    Busy!!!

  4. #4

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    where do i save my scirpt? can you be more pecific on the saving bit and how to work out the x and y? for amerteurs like me?
    Last edited by Ojf; January 31, 2008 at 01:08 PM.

  5. #5

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Slave armies

    Is there an issue with spawning slave armies, ie for the slave faction ?

    I have a script that works perfectly for normal factions, but always CTDs for slave.

    I have used various combinations of general/named character, mercenary units, newly created slave units etc, but no luck.

    Suggestions welcomed...

    monitor_event FactionTurnStart FactionType slave
    and I_TurnNumber = 33

    spawn_army
    faction slave
    character Orrhos, named character, command 1, influence 0, management 0, subterfuge 0, age 30, , x 223, y 7
    unit slave rebel, exp 4 armour 0 weapon_lvl 0
    end

    terminate_monitor
    end_monitor

  6. #6
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    The spawn_army command itself doesn't have a problem with faction slave. I used it in the RTR VII:TIC script and it works just fine.

    Possible reasons for CTD:
    - mismatch in the unit name and that in EDU
    - doing things during the slave turn?
    - name is not in the list of rebel names (descr_names.txt and text\names.txt)
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  7. #7
    Legio's Avatar EMPRESS OF ALL THINGS
    Moderator Emeritus Content Emeritus

    Join Date
    Mar 2008
    Location
    Chlοëtopia
    Posts
    43,774

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    I made a script, but I do not know where to save it, someone else asked this question too. I looked at all the links you posted and read over all the articles in the thread and I still do not get it. Anyway, here it is:


    script
    monitor_event FactionTurnStart FactionType parthia
    and I_TurnNumber = 2
    if spawn_armyA=0
    spawn_army
    faction parthia
    character Thuxra, named character, command 5, influence 5, management 3, subterfuge 2, age 38, , x 256, y 80
    ancillaries galloper
    unit hillmen, exp 5 armour 0 weapon_lvl 2
    unit hillmen, exp 5 armour 0 weapon_lvl 2
    unit east camel cataphract, exp 5 armour 0 weapon_lvl 2
    unit east camel cataphract, exp 5 armour 0 weapon_lvl 0
    unit east onager, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east archer, exp 3 armour 0 weapon_lvl 0
    unit east heavy cataphract, exp 3 armour 0 weapon_lvl 0
    unit east heavy cataphract, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    set_counter spawn_armyA 1
    end_if

  8. #8
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Have you read other tutorials in this forum??

    Your code needs a few small fixes:
    1. You need to declare counters before you use them
    2. Use I_CompareCounter when comparing counter value to a constant
    3. This is not descr_strat.txt, so you cannot use the spawn_army command to add ancillaries. Have to use a separate console_command for that.
    4. AFAIK, the spawn army command does not really set command, management, influence, or subterfuge attribute, so it doesn't really matter what numbers you put there. To set those, you'd need to give the character some traits to increase them to the desired levels.

    ps: Please, use the code tag to preserve formatting. Trying to read unformatted code is about as pleasant as tryingtoreadaphrasewrittenlikethis.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  9. #9

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    I have a question Ham,how would the monitor_event condition look for a army to spawn when a certain faction captures a settlement.I downloaded Ultimate Docudemons for some help on how to get it working but no luck

  10. #10
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Detect and spawn immediately:
    Code:
    monitor_event GeneralCaptureSettlement SettlementName = certain_settlement
                  and FactionType = certain_faction
      spawn_army
        ...
      end
    end_monitor
    or, check at the beginning of the every turn:
    Code:
    monitor_event SettlementTurnStart I_SettlementOwner = certain_faction
      spawn_army
        ...
      end
    end_monitor
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  11. #11

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    ham i have a issue i cant get my armies to spawn

    HTML Code:
    declare_counter spawn_armyB 1
    set_counter spawn_armyB 1
    declare_counter spawn_armyC 0
    set_counter spawn_armyC 1
    
    monitor_event FactionTurnEnd FactionType romans_julii
    and I_TurnNumber = 2
    spawn_army
    faction romans_julii
    character Luca, named character, command 6, influence 6, management 7, subterfuge 0, age 29, , x 96, y 84
    unit        roman generals guard cavalry early                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    end
    
    terminate_monitor
    end_monitor
    monitor_event FactionTurnEnd FactionType romans_julii
    and I_CompareCounter spawn_armyB = 0
    and I_TurnNumber = 3
    
    if spawn_armyB=0
    
    spawn_army
    faction romans_julii
    character Nero, named character, command 6, influence 6, management 7, subterfuge 0, age 29, , x 89, y 90
    unit        roman generals guard cavalry early                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman hastati                exp 1 armour 0 weapon_lvl 0
    unit        roman velite                exp 2 armour 0 weapon_lvl 0
    unit        roman slinger                exp 2 armour 0 weapon_lvl 0
    set_counter spawn_armyB 1
    end_if
    
    terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionType romans_julii
    and I_LocalFaction romans_julii
    and I_TurnNumber = 22
    
    if spawn_armyC=0
    
    spawn_army
    faction gauls
    character Belenus, named character, command 2, influence 6, management 3, subterfuge 2, age 38, , x 112, y 192
    unit        barb chieftain cavalry early gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband sword gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband sword gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband sword gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband sword gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        barb infantry gaul                exp 0 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        warband spearmen gaul                exp 3 armour 0 weapon_lvl 0
    unit        barb berserker german                exp 0 armour 0 weapon_lvl 0
    set_counter spawn_armyC 1
    end_if
    
    terminate_monitor
    end_monitor
    
    

  12. #12
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Code:
    monitor_event FactionTurnEnd FactionType romans_julii
              and I_TurnNumber = 2
    
      spawn_army
        faction romans_julii
        character Luca, named character, command 6, influence 6, management 7, subterfuge 0, age 29, , x 96, y 84
        unit roman generals guard cavalry early, exp 1 armour 0 weapon_lvl 0
      end
    
      console_command create_unit "Luca" "roman hastati" 12 1 0 0
      console_command create_unit "Luca" "roman velite" 3 2 0 0
      console_command create_unit "Luca" "roman slinger" 3 2 0 0
      terminate_monitor
    end_monitor
    
    monitor_event FactionTurnEnd FactionType romans_julii
              and I_TurnNumber = 3
    
      spawn_army
        faction romans_julii
        character Nero, named character, command 6, influence 6, management 7, subterfuge 0, age 29, , x 89, y 90
        unit roman generals guard cavalry early, exp 1 armour 0 weapon_lvl 0
      end
    
      console_command create_unit "Nero" "roman hastati" 12 1 0 0
      console_command create_unit "Nero" "roman velite" 3 2 0 0
      console_command create_unit "Nero" "roman slinger" 3 2 0 0
      terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionType romans_julii
              and I_LocalFaction romans_julii
              and I_TurnNumber = 22
    
      spawn_army
        faction gauls
        character Belenus, named character, command 2, influence 6, management 3, subterfuge 2, age 38, , x 112, y 192
        unit barb chieftain cavalry early gaul, exp 3 armour 0 weapon_lvl 0
      end
    
      console_command create_unit "Belenus" "warband sword gaul" 3 3 0 0
      console_command create_unit "Belenus" "warband spearmen gaul" 6 3 0 0
      console_command create_unit "Belenus" "barb infantry gaul" 8 0 0 0
      console_command create_unit "Belenus" "barb berserker german" 1 0 0 0
      terminate_monitor
    end_monitor
    1. Don't need counters. You can only get the FactionTurnStart and FactionTurnEnd events once per turn per faction.
    2. Command, influence, management, and subterfuge values are ignored. Use console_command give_trait to produce the desired effects.
    3. Need to put commas after unit names when using spawn_army (different from descr_strat.txt)
    4. When spawning an army with a lot of identical units, it's faster to first spawn the general, then use console_command create_unit to give him multiple units, instead of listing them out individually.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  13. #13

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Besides, if that faction has already enough named characters, according to some internal parameter that the program uses, then the army will simply not spawn. So, if the characters are not historically necessary, spawn them as generals as it is safer.

  14. #14
    Caligula Caesar's Avatar Horse Lord
    Join Date
    Dec 2008
    Location
    England
    Posts
    5,510

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    I can't get this army to spawn:

    script
    monitor_event FactionTurnStart FactionType britons
    and not I_LocalFaction britons
    and I_TurnNumber = 20
    spawn_army
    faction britons
    character Arapeithes, named character, command 5, influence 5, management 3, subterfuge 2, age 38, , x 322, y 125
    unit barb chieftain cavalry scythian, exp 3 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    end_if

    terminate_monitor
    end_monitor
    end_script

    Do I need a trigger? If so, what would it look like?

  15. #15
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    you should also have 'end', not end_if at the end of your spawn
    spawn_army
    faction britons
    character Arapeithes, named character, command 5, influence 5, management 3, subterfuge 2, age 38, , x 322, y 125
    unit barb chieftain cavalry scythian, exp 3 armour 0 weapon_lvl 2......
    ........
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    end
    having the end_if there without a starting if should be giving you an error message, if its not done that you might also find you're not actually yet getting it to start the script at all, how are you triggering the script?

  16. #16
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    You're letting the script terminate - very common pitfall. Add this before the end_script line:

    Code:
    while I_TurnNumber < 9999
        suspend_unscripted_advice true
    end_while
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  17. #17
    Caligula Caesar's Avatar Horse Lord
    Join Date
    Dec 2008
    Location
    England
    Posts
    5,510

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    OK, I updated the script. Now it looks like this:

    script
    monitor_event FactionTurnStart FactionType britons
    and not I_LocalFaction britons
    and I_TurnNumber = 2
    spawn_army
    faction britons
    character Arapeithes, named character, command 5, influence 5, management 3, subterfuge 2, age 38, , x 322, y 125
    unit barb chieftain cavalry scythian, exp 3 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 2
    unit sarmatian archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian noble cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian heavy cavalry, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    unit sarmatian horse archer, exp 1 armour 0 weapon_lvl 0
    end

    terminate_monitor
    end_monitor
    while I_TurnNumber < 9999
    suspend_unscripted_advice true
    end_while
    end_script


    Here are the triggers:

    AdviceThread Saka_Thread 1
    GameArea Campaign
    Item Saka_Thread 1
    Suppressible y
    Uninhibitable
    Verbosity 3
    Threshold 1
    MaxRepeats 0
    RepeatInterval 3
    Attitude Normal
    Presentation Default
    Parameter CharacterName
    Title Saka
    Script scripts\show_me\Saka_Armies.txt
    Text 4tpy_Text_01_Text1

    Trigger 3704_Saka_Trigger1
    WhenToTest SettlementSelected
    AdviceThread Saka_Thread 1

  18. #18
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    - I wouldn't make the AdviceThread suppressible. If they suppress it, it will stop working (until you remove the preferences\advice file).

    - Instead of Script scripts\show_me\Saka_Armies.txt, I'd recommend using OnDisplay scripts\show_me\Saka_Armies.txt, then the script will start as soon as the player clicks on the advisor portrait, without having to click on the 'Show me how' button.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  19. #19
    Caligula Caesar's Avatar Horse Lord
    Join Date
    Dec 2008
    Location
    England
    Posts
    5,510

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    BTW, it still isn't working. And putting OnDisplay there instead of Script causes an error message.

  20. #20
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: How to:Script spawn armies(make your own spartacus and hannibal!)

    Oops, I meant On_display

    How are you starting the script?
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

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