Results 1 to 8 of 8

Thread: spawn_army in advisor scripts

  1. #1
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default spawn_army in advisor scripts

    Has anybody managed to use spawn_army in an advisor script?

    When I try to do it the script fails to parse with an "on an invalid tile" log error as soon as the advisor appears, disabling the "show me how" button in the process.

    Needless to say the tile is valid. I saw someone mention this in passing in another thread (Germanicu5 I think), suspecting that the script parser might be checking coordinates against some 'base' map instead of the actual map. I tried using some valid M2TW and RTW coordinates as well but it didn't help.

    It is strange behaviour, the fact that the parser is checking the coordinates (when the script is loaded). campaign_script does not behave this way.

  2. #2
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: spawn_army in advisor scripts

    What's the script and which line is causing the problems?
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  3. #3
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: spawn_army in advisor scripts

    Here is an example, whittled down to the bare essentials...

    Code:
    script
    
    ;close advisor
    select_ui_element advisor_dismiss_button
    simulate_mouse_click lclick_up
    while I_AdvisorVisible
    end_while
    
    suspend_unscripted_advice true
    declare_show_me
    
    spawn_army
    	faction england
    	character random_name, named character, age 18, x 96, y 145
    	unit Peasants	exp 0 armour 0 weapon_lvl 0
    end			
    
    end_script
    Advisor triggers etc...
    Spoiler Alert, click show to read: 
    Triggered by clicking the advice button on a unit info scroll.

    export_descr_advice.txt
    Code:
    ;------------------------------------------
    AdviceThread bgs_thread
        GameArea Campaign
    
        Item bgs_Text_01
            Uninhibitable
            Verbosity  0 
            Priority  5 
            Threshold  1 
            MaxRepeats  0 
            RepeatInterval  1 
            Attitude Normal
            Presentation Default
            Title bgs_Text_01_Title
            Script scripts/show_me/BodyguardSwitcher.txt
            Text bgs_Text_01_Text1
    
    
    ;------------------------------------------
    Trigger bgs_trigger
        WhenToTest ScrollAdviceRequested
    
        Condition ScrollAdviceRequested unit_info_scroll
     
        AdviceThread bgs_thread  1
    ...and commenting out the pre-existing trigger that's using "Condition ScrollAdviceRequested unit_info_scroll"


    export_advice.txt
    Code:
    {bgs_Text_01_Title}Bodyguard Switcher
    {bgs_Text_01_Text1}Click the "Show me how" button to begin...

    Error:
    Code:
    14:02:19.328 [game.script] [error] Script parsing error at line 14, column 65 in mods/SpawnPool/data/scripts/show_me/BodyguardSwitcher.txt
    Character 'random_name' is placed on an invalid tile.
    If I comment out the spawn_army block and put in "add_money england 10000" then no problem: the "show me how" button is now enabled and money is added. So it isn't a problem with the triggers, or anything else in the script.

    I also tried with a 'complete' character line, in case it was expecting RTW-like usage...
    Code:
    character random_name, named character, command 0, influence 0, management 0, age 40, , x 96, y 145
    ...with and without that 'empty' extra comma. Always the same result.

    EDIT: this is Kingdoms by the way.
    Last edited by Withwnar; October 23, 2011 at 01:25 AM.

  4. #4

    Icon1 Re: spawn_army in advisor scripts

    I also tried with a 'complete' character line, in case it was expecting RTW-like usage...
    Code:
    character random_name, named character, command 0, influence 0, management 0, age 40, , x 96, y 145
    ...with and without that 'empty' extra comma. Always the same result.
    age 40, , x 96, y 145

  5. #5
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: spawn_army in advisor scripts

    Sorry TNZ, not following you. How is that different to mine?

  6. #6

    Icon1 Re: spawn_army in advisor scripts

    Quote Originally Posted by Withwnar View Post
    Sorry TNZ, not following you. How is that different to mine?
    Withwnar: I think it should be:
    Code:
    age 40, x 96, y 145
    And not:
    Code:
    age 40, , x 96, y 145

  7. #7
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: spawn_army in advisor scripts

    I see, thanks. No, I did try that too ("with and without that 'empty' extra comma").

  8. #8
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: spawn_army in advisor scripts

    I am once again trying to get this to work and once again failing at every turn.

    Has anybody ever successfully used spawn_army in an advisor/show_me script in M2TW?

    spawn_character doesn't work either. For example, this script in a Bare_Geomod Kingdoms grand campaign...

    Code:
    spawn_character england, random_name, spy, age 18, x 157, y 140
    ...gives me this...

    Code:
    Character 'random_name' is placed on an invalid tile.

Posting Permissions

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