Page 1 of 4 1234 LastLast
Results 1 to 20 of 62

Thread: How-to: Spawn an army (spawn_army command: a closer look)

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

    Default How-to: Spawn an army (spawn_army command: a closer look)

    Why did I write this tutorial when there is one already by Turk?

    There are several serious bugs in Turk's example, so I felt a better explanation was in order. If I could, I would have removed the old one.

    Basic syntax:

    Code:
    spawn_army
        faction <faction type> [sub_faction <subfaction_type>]
        character <character name>, <character type>, age <age>, , x <x-coord>, y <y-coord>
        ; a list of 1-20 units, one per line
        unit <unit type>, [soldiers <n>] [exp <0-9>] [armor <0-3>] [weapon_lvl <0-3>]
    end
    Parameters:

    Parameters shown in <>'s are required. Parameters shown in []'s are optional and can be omitted. Anything after a semicolon is a comment.

    faction type - faction types are defined in descr_sm_factions.txt

    subfaction type - subfactions are defined in desc_rebel_factions.txt

    character name - Must be a valid male name for the above faction from the descr_names.txt file. Character name must at the very least consist of a first name. Last name is optional.

    character type - 'general' (i.e. captain) or 'named character'. A general is just a generic army captain. A named character has his own portrait and can be assigned traits/ancillaries (via additional commands).

    age - from 16 to ... whatever the maximum is

    x-coord and y-coord - coodinates on the strategy map where to spawn the army. To get coordinates under the current mouse position on the strategy map, open the Rome command shell by hitting the ~ key, then type in show_cursorstat and hit Enter.

    unit type - from export_descr_unit.txt. The EDU entry for the unit type must have the faction in its ownershp line. Also, unless the unit has the mercenary_unit attribute in EDU, the corresponding entry in descr_model_battle.txt (DMB) must have texture and model entries for that faction. IMPORTANT: The example of this command given in CA's scripting documentation (i.e. the docudemon_commands.txt file) is incorrect - it's missing commas after unit types. These commas are required.

    soldiers - where n is the number of soldiers to spawn for this unit.
    - n is an absolute value and doesn't auto-adjust no matter what the unit size is set to in the game's options. You can spawn a unit with 240 soldiers even when unit size is set to small (60 soldiers)
    - for the 1st (general's) unit, can be anywhere from 2 (soldier + general) to 240. For other units, 1-240.
    - if you ask for 0, you'll still get 1 (+1 more, if it's the general's unit)
    - if you ask for a number higher than the allowed max (value from the unit's soldiers line in EDU, multiplied by 4), only the max allowed number will actually spawn

    exp - Experience. Same as in-game. 0 for fresh recruits and up to 9 for battle-hardened veterans.

    armor - 0 for default, 1, 2, and 3 for bronze, silver, and gold armor upgrades correspondingly

    weapon_lvl - same as armor, but for weapons

    The maximum number of units per spawned army is 20 (full stack). The character leading it will be attached to the 1st unit on the list.


    Unused/Ignored parameters:

    Many (I would even say most) examples showing how to use the spawn_army command also include command, influence, management, and subterfuge parameters in the character line, like this...

    Code:
    spawn_army
        faction slave
        character Esugenos, named character, command 0, influence 0, management 0, subterfuge 0, age 40, , x 45, y 32
        unit generic rebel general, exp 9 armour 3 weapon_lvl 3
    end
    These 4 parameters are left-overs from some old version of the game's engine. They don't cause any harm, but they don't do anything either, no matter what you set them to. They're useless, so I say just skip them altogether. If you want to increase these 4 attributes, you can do so by giving the character traits/ancillaries via console_command give_trait and/or console_command give_ancillary commands.


    Spawning location rules:

    1. You cannot spawn an army on any water tile, including river crossings (though you can reposition it to a river crossing after spawning)
    2. If the coordinates where the army is supposed to spawn are already occupied by a diplomat, assassin, or spy, they will get out of the way to make room for the new army.
    3. If there is another army at those coordinates, the new army will spawn right on top of it
    4. If you spawn at the coordinates of a settlement, it will spawn on top of that settlement, but will not enter/attack it. Doesn't matter if the settlement is garrisoned or not, or if it's hostile/neutral/friendly.
    5. The game will let you spawn an army on a ground type that's not normally accessible (a mountain peak, or dense forest), but even though it will spawn, it may not be able to move.

    Warning about character-cloning CTDs:

    According to research that has been discussed at length here (http://www.twcenter.net/forums/showthread.php?t=418396), spawning characters for the player faction doesn't cause CTDs, but spawning a character for an AI faction that has a family tree set up in descr_strat.txt can cause a CTD -- if the character is adopted into the ruling family, he will be cloned, and when either he or the clone eventually dies, the game will crash and you will not be able to continue the campaign.

    Movement points:

    Upon spawning, the army's movement point gage will be full.


    Spawned armies and ambushing:

    If you spawn an army in a forested area, it will not be able to ambush enemy until next turn. Though, you could spawn it on an adjacent tile and use the move command to have it march to a forested area, then it will hide and can ambush immediately.

    Example of a complete script:

    Here is a script that will spawn an army at the beginning of player's turn 10:

    Code:
    script
    
    monitor_event FactionTurnStart FactionIsLocal
              and I_TurnNumber = 10
    
        ; In case there is an Esugenos already in game, kill him off. Otherwise, you
        ; might end up with 2 (or more) characters with the same name
        ; running around, confusing the player. :)
        console_command kill_character "Esugenos"
    
        spawn_army
            faction slave
            character Esugenos, named character, age 40, , x 45, y 32
            unit generic rebel general,
        end
    
        terminate_monitor
    
    end_monitor
    
    while I_TurnNumber < 9999
        suspend_unscripted_advice true
    end_while
    
    end_script
    What's wrong with Turk's example?

    - Do not try to spawn an army during the slave turn. It will cause a CTD.

    - You don't need to declare/set/check any counters to spawn armies. It's simply unnecessary. Any given turn number can only start once per faction.

    - Remember, declaring a monitor is not the same as executing it. If you use the spawn_army command in a monitor_event/monitor_conditions block, the script must include a loop before the end_script line, or else it will simply exit and your monitor will be thrown away before the code in it has a chance to detect the corresponding event/conditions and be run.
    Last edited by HouseOfHam; January 18, 2011 at 04:23 PM. Reason: Clarifying some details
    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

  2. #2

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Thanks for that it's much clearer, and good idea about using kill_character before spawning named_character - I think that could explain some problems I had with an earlier script crashing after a lot of named_character spawns.

    Only one point
    2. If the coordinates where the army is supposed to spawn are already occupied by another army, diplomat, assassin, or spy, they will get out of the way to make room for the new army.
    Isn't quite true. Probably works for the agents, but certainly doesn't totally work for armies. If the army is the same faction as the spawned army it won't try and get out of the way, you just end up with two on same spot... you also seem to be able to spawn spawned armies from different factions on top of each other, I'm not sure if there is a time factor in that, eg if that only happens before the ai has taken control of the first spawned army in some way.

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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    I'll experiment a bit more with it and update the 1st post with any new findings.
    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

  4. #4

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Quote Originally Posted by HouseOfHam View Post
    Warning about character names:

    Unless you're careful, you may accidentally spawn a character with the same name as an already existing one. When this happens, the game gets very confused, which eventually leads to a CTD. To reduce the probability of this happening, I recommend doing console_command kill_character before spawn_army, for example:
    was wondering about this one in the light of Aradan's findings about 'cloned characters' which cause CTD sometimes due to duplicate characters being created when a named character from descr_strat that wasn't in family tree gets adopted into family.... similar thing is likely to happen to script spawned named_characters. If that is in fact the problem then killing same name character before spawn isn't going to fix whole issue....

  5. #5
    Athenogoras's Avatar Campidoctor
    Join Date
    Apr 2007
    Location
    Sweden
    Posts
    1,785

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Perhaps you can help me.
    I want to add named legions to lotr-tw mod by Wlesmana.
    I want them to be available to Gondor after the Ring has been destroyed and the faction of Mordor subsequently destroyed(scripted).
    I want the "first cohorts"(citadel guards) to spawn in different cities after the player has managed to get control of certain regions(perhaps also only if named character with certain traits in in the city). I also want them to spawn with regionspecific names(as set in descr regions).
    Is this possible. Yes or No?
    Last edited by Athenogoras; February 08, 2009 at 02:49 AM.

  6. #6

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Named legions are not possible without the BI .exe, I believe, and even then you'd get the word "Legio" inevitably. Unless of course you add altogether different units (as in EDU entries).

  7. #7
    Athenogoras's Avatar Campidoctor
    Join Date
    Apr 2007
    Location
    Sweden
    Posts
    1,785

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Named legions are not possible without the BI .exe
    I think you can add them if you have 1.5 or 1.9. At least XGM(on Alexander) has implemented this.

    and even then you'd get the word "Legio" inevitably.
    Yes. This is unfortunate. BTW is it possible to remove the I,II,II,IV numbers in front of the legion names.

  8. #8

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    I didn't know named legions were possible without BI, thanks.

    The numbering is also hardcoded, I think.

  9. #9
    Athenogoras's Avatar Campidoctor
    Join Date
    Apr 2007
    Location
    Sweden
    Posts
    1,785

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Bump

    Rephrasing of question: Can a spawned "first cohort" have a legionary name(as in BI). I know I can mod it via the EDB and recruit it to get the name, but spawned via script?

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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    No idea. I've never messed with legionary names. If you try it, let me know the results.
    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
    Athenogoras's Avatar Campidoctor
    Join Date
    Apr 2007
    Location
    Sweden
    Posts
    1,785

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    TY HouseOfHam. I will let you know.

  12. #12
    DaVinci's Avatar TW Modder 2005-2016
    Patrician Artifex

    Join Date
    Apr 2005
    Location
    The plastic poisoned and d(r)ying surface of planet Earth in before Armageddon
    Posts
    15,365

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Quote Originally Posted by Athenogoras View Post
    Bump

    Rephrasing of question: Can a spawned "first cohort" have a legionary name(as in BI). I know I can mod it via the EDB and recruit it to get the name, but spawned via script?
    Yes, it can afaik. But needs the slot entry in edu. Every unit in edu can be spawned, normally ... seperate type and separate naming under dictionary should do the job. Of course they function then in the same wise as any other edu unit block
    Last edited by DaVinci; February 10, 2009 at 08:27 AM.
    #Anthropocene #not just Global Warming but Global Disaster, NASA #Deforestation #Plastic Emission #The Blob #Uninhabitable Earth #Savest Place On Earth #AMOC #ICAN #MIT study "Falsehoods Win" #Engineers of Chaos
    #"there can be no doubt about it: the enemy stands on the Right!" 1922, by Joseph Wirth.
    Rightwingers, like in the past the epitome of incompetence, except for evilness where they own the mastership.
    Iirc., already 2013 i spoke of "Renaissance of Fascism", it was accurate.
    #"Humanity is in ‘final exam’ as to whether or not it qualifies for continuance in universe." Buckminster Fuller
    Any chance for this exam? Very low, the established Anthropocentrism destroys the basis of existence.
    #My Modding #The Witcher 3: Lore Friendly Tweaks (LFT)
    #End, A diary of the Third World War (A.-A. Guha, 1983) - now, it started on 24th February 2022.

  13. #13
    DaVinci's Avatar TW Modder 2005-2016
    Patrician Artifex

    Join Date
    Apr 2005
    Location
    The plastic poisoned and d(r)ying surface of planet Earth in before Armageddon
    Posts
    15,365

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Quote Originally Posted by makanyane View Post
    was wondering about this one in the light of Aradan's findings about 'cloned characters' which cause CTD sometimes due to duplicate characters being created when a named character from descr_strat that wasn't in family tree gets adopted into family.... similar thing is likely to happen to script spawned named_characters. If that is in fact the problem then killing same name character before spawn isn't going to fix whole issue....
    Indeed. If the clone-character-issue is true, what i strongly believe, because the clone-character-fix prevents ChivTW from all former crashes (as i had non-family-characters en masse in descr_strat, then the kill character command script is necessary, and not only a recommendation.

    Btw., the clone-character-issue isn't due for the slave faction, at least not that i'm aware of, as long a modder has not created a family tree for the slave faction.
    Last edited by DaVinci; February 10, 2009 at 08:46 AM.
    #Anthropocene #not just Global Warming but Global Disaster, NASA #Deforestation #Plastic Emission #The Blob #Uninhabitable Earth #Savest Place On Earth #AMOC #ICAN #MIT study "Falsehoods Win" #Engineers of Chaos
    #"there can be no doubt about it: the enemy stands on the Right!" 1922, by Joseph Wirth.
    Rightwingers, like in the past the epitome of incompetence, except for evilness where they own the mastership.
    Iirc., already 2013 i spoke of "Renaissance of Fascism", it was accurate.
    #"Humanity is in ‘final exam’ as to whether or not it qualifies for continuance in universe." Buckminster Fuller
    Any chance for this exam? Very low, the established Anthropocentrism destroys the basis of existence.
    #My Modding #The Witcher 3: Lore Friendly Tweaks (LFT)
    #End, A diary of the Third World War (A.-A. Guha, 1983) - now, it started on 24th February 2022.

  14. #14

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Quote Originally Posted by HouseOfHam View Post
    The script must include a loop before the end_script line, or else it will simply exit and the monitor will be thrown away before the code in it gets a chance to run.
    If that's the case how does one explain the following code spawning a General character (or army is needed) repeatedly according to the set condition?

    Code:
    monitor_event PreFactionTurnStart FactionType scotland
     and I_TurnNumber > 2
     
     spawn_army 
     faction scotland
     character random_name, named character, age 30, x 102, y 174
     traits LoyaltyStarter 1 , GoodCommander 2 , ReligionStarter 1
      unit NE Bodyguard  exp 1 armour 1 weapon_lvl 0
     end
    end_monitor
    Ignore the army spawn syntax for now it's just an example to show after the specified turn an army is spawned every turn without the need of an "infinite" loop.

    In fact although I've not tested it given the above syntax I would put money on an infinite loop spawning NO armies at all... or maybe just one.. actually none at all if my understanding of how the game understands the script file is right but it's the 2nd hour of my scripting career so I may be wrong

    Anyways the point of this is a small sub-mod to stop the tedious "captain armies" with no proper General by spawning an AI general near the faction capital. With good Campaign AI the generals are mobilised instantly.

    I set up a loop and condition to only spawn a general every n turns but it appears the loop and counters need to be declared locally to the monitor to work at all. However I digress I am sure the infinite loop method is there for a reason but as shown it's not a well understood concept.
    "If we didn't have cruxifixion, this country'd be in a right bloody mess"

  15. #15

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    Your example looks like its from M2TW

    M2TW scripts are different in many respects from RTW scripts - in that its designed to have the background script running permanently and it also retains counter information when a saved game is re-loaded... beware of assuming what works in one will work in the other.

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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    ^-- What she said.

    There are many differences.

    - In M2TW, instead of an infinite loop, you'd have to use the wait_monitors command.
    - The random_name feature doesn't exist in RTW/BI.
    - Also, I'm pretty sure the traits have to be specified separately
    - As far as I can tell, RTW requires a comma after the unit name. I've yet to see the spawn_army command work without it.
    Last edited by HouseOfHam; April 25, 2009 at 10:22 PM.
    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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    is there a way that I could make the Ai recruite better armies?i play rs1.5c

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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    You mean, make it recruit balanced armies, rather than stack upon stack of cheap skirmishers?

    Some mods use recruitment scripts, but it would take a fair bit of work to write one for a mod with a lot of settlements. To demonstrate the concept, here's an example of such a script, from RTR VII:TIC

    Spoiler Alert, click show to read: 

    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; 4.0 Recruitment Script ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event UnitTrained TrueCondition
    
        ; 4.1 - Saguntum Army:------------------------
        if  SettlementName Saguntum
        and FactionType counter_faction
            if TrainedUnitCategory infantry
                console_command create_unit Saguntum "aor caetrati skirmishers" 2    ; Caetrati Skirmishers
                console_command create_unit Saguntum "merc caetrati falcata" 2        ; Caetrati Falcata
                console_command create_unit Saguntum "merc celtiberian scutum" 2    ; Iberian Elite Scutari Warriors
                console_command create_unit Saguntum "merc scutarii cavalry" 1        ; Iberian Scutarii Cavalry
                console_command create_unit Saguntum "rtr celtiberian cavalry" 1    ; Caetrati Cavalry
                console_command create_unit Saguntum "rtr cantabrian cavalry" 1        ; Cantabrian Cavalry
                ;1 Iberian Slinger recruited normally
                console_command add_money counter_faction, -6000
                console_command add_population Saguntum -700
            end_if
            
            if TrainedUnitCategory cavalry
                console_command create_unit Saguntum "merc balearic slinger" 1        ; Iberian Slinger
                console_command create_unit Saguntum "aor caetrati skirmishers" 2    ; Caetrati Skirmishers
                console_command create_unit Saguntum "merc caetrati falcata" 3        ; Caetrati Falcata
                console_command create_unit Saguntum "falcata scutarii" 2            ; Scutari Falcata
                console_command create_unit Saguntum "rtr celtiberian cavalry" 1    ; Caetrati Cavalry
                ;1 Caetrati Cavalry recruited normally
                console_command add_money counter_faction, -4000
                console_command add_population Saguntum -800
            end_if
        end_if
        
        ; 4.2 - Emporion Army:------------------------
        if SettlementName Emporion
            if TrainedUnitCategory infantry
                console_command create_unit Emporion "aor caetrati skirmishers" 2    ; Caetrati Skirmishers
                console_command create_unit Emporion "merc caetrati falcata" 2        ; Caetrati Falcata
                console_command create_unit Emporion "merc celtiberian scutum" 2    ; Iberian Elite Scutari Warriors
                console_command create_unit Emporion "merc scutarii cavalry" 1        ; Iberian Scutarii Cavalry
                console_command create_unit Emporion "rtr celtiberian cavalry" 1    ; Caetrati Cavalry
                console_command create_unit Emporion "rtr cantabrian cavalry" 1        ; Cantabrian Cavalry
                ;1 Iberian Slinger recruited normally
                console_command add_money counter_faction, -6000
                console_command add_population Saguntum -700
            end_if
            
            if TrainedUnitCategory cavalry
                console_command create_unit Emporion "merc balearic slinger" 1        ; Iberian Slinger
                console_command create_unit Emporion "aor caetrati skirmishers" 2    ; Caetrati Skirmishers
                console_command create_unit Emporion "merc caetrati falcata" 3        ; Caetrati Falcata
                console_command create_unit Emporion "falcata scutarii" 2            ; Scutari Falcata
                console_command create_unit Emporion "rtr celtiberian cavalry" 1    ; Caetrati Cavalry
                ;1 Caetrati Cavalry recruited normally
                console_command add_money counter_faction, -4000
                console_command add_population Emporion -800
            end_if
        end_if
        
        ; 4.3 - Lusitani Army:------------------------
        if  SettlementName Olisaipo
        and FactionType britons
            if TrainedUnitCategory infantry
                console_command create_unit Olisaipo "merc caetrati falcata" 4        ; Caetrati Falcata
                console_command create_unit Olisaipo "rtr caetrati ambakti" 5        ; Lusitanian Caetrati
                console_command create_unit Olisaipo "rtr celtiberian cavalry" 1    ; Caetrati Cavalry
                console_command create_unit Olisaipo "rtr cantabrian cavalry" 1        ; Cantabrian Cavalry
                ;1 Iberian Slinger recruited normally
                console_command add_money britons, -6000
                console_command add_population Olisaipo -700
            end_if
            
            if TrainedUnitCategory cavalry
                console_command create_unit Olisaipo "merc caetrati falcata" 1        ; Caetrati Falcata
                console_command create_unit Olisaipo "rtr caetrati ambakti" 4        ; Lusitanian Caetrati
                console_command create_unit Olisaipo "merc celtiberian scutarii" 1    ; Iberian Scutarii
                console_command create_unit Olisaipo "rtr cantabrian cavalry" 1        ; Cantabrian Cavalry
                console_command create_unit Olisaipo "rtr celtiberian cavalry" 2    ; Caetrati Cavalry
                ;1 Iberian Cavalry recruited normally
                console_command add_money britons, -4000
                console_command add_population Olisaipo -800
            end_if
        end_if
        
        ; 4.4 - Turdetania Army:------------------------
        if  SettlementName Illipa
        and FactionType mini_faction
            if UnitType merc balearic slinger
                console_command create_unit Illipa "aor caetrati skirmishers" 1        ; Caetrati Skirmishers
                console_command create_unit Illipa "merc caetrati falcata" 2        ; Caetrati Falcata
                console_command create_unit Illipa "falcata scutarii" 2                ; Scutarii Falcata
                console_command create_unit Illipa "merc celtiberian scutum" 1        ; Iberian Elite Scutarii Warriors
                console_command create_unit Illipa "merc caetrati cavalry" 1        ; Caetrati Cavalry
                console_command create_unit Illipa "rtr cantabrian cavalry" 1        ; Cantabrian Cavalry
                console_command create_unit Illipa "aor iberian cavalry" 1            ; Iberian Scutarii Cavalry
                console_command add_money mini_faction, -6000
                console_command add_population Illipa -700
            end_if
    
            if UnitType rtr celtiberian cavalry
                console_command create_unit Illipa "aor caetrati skirmishers" 3        ; Celtiberian Caetrati
                console_command create_unit Illipa "merc celtiberian scutarii" 4        ; Celtiberian Scutarii
                console_command create_unit Illipa "rtr celtiberian ambacti" 2        ; Celtiberian Ambacti
                console_command add_money mini_faction, -4000
                console_command add_population Illipa -800
            end_if
        end_if
    
    end_monitor        ; End of recruitment script


    As far as I'm aware, RS 1.5 doesn't have a background script, so if you want something like this, you'd have to add it yourself.
    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

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    this is actually from the other thread but posting here as its the more up to date one.
    Quote Originally Posted by HouseOfHam View Post
    Code:
    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
    if I use
    Code:
    	console_command create_unit "Pausanias of Sparta" "ARCADIAN" 10 1 1 1
    I get 5 units - if I change the 10 to 8 I still get 5 units
    if I use
    HTML Code:
    	console_command create_unit "Pausanias of Sparta" "ARCADIAN" 8 1 1 1
    	console_command create_unit "Pausanias of Sparta" "ARCADIAN" 8 1 1 1
    I get 10 units - I suspect there is a hardcoded something about the max number of units generated off one line, but for the sake of simplicity I'm going back to posting a line per unit - that's being used on existing army but I had similar problem previously when trying the shortcut way of generating a spawned army with duplicate units.... (this is with Alex.exe)

  20. #20
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: How-to: Spawn an army (spawn_army command: a closer look)

    I'm curious about the use of "TrueCondition" in the above recruitment script posted by HOH. What is it that this does? I was discussing it with GED the other day and wasn't seeing why it was any more advantageous to use TrueCondition than to just create an event with no conditions. Does RTW require a condition for each event, and thus it's legacy in M2? Or is the condition perhaps aiding the if statements, because I've never gotten a trigger-requiring condition to fire in an if statement.

Page 1 of 4 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
  •