Results 1 to 30 of 82

Thread: alpaca's Script-O-Rama

Hybrid View

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

    Default Re: alpaca's Script-O-Rama

    This is the classic spawn_army hint, considering the fact that the docudemon explanation always stumps newbies:

    Code:
    spawn_army 
                        faction romans_julii
                        character	Foedus Chaerea, general, command 0, influence 0, management 0, subterfuge 0, age 20, , x 54, y 124
                        unit		roman generals guard cavalry,				soldiers 20 exp 9 armour 1 weapon_lvl 0
                        unit		roman legionary first cohort ii,				soldiers 40 exp 0 armour 0 weapon_lvl 0
                        unit		roman legionary cohort ii,				soldiers 60 exp 0 armour 0 weapon_lvl 0
                        unit		roman praetorian cohort i,				soldiers 60 exp 0 armour 0 weapon_lvl 0
    end
    What's changed is that there is a comma after every unit name. This comma is absent in docudemon example of spawn_army, thus causing endless crashes and headaches for those starting out.

    Great idea Alpaca, I should have a few more examples soon.
    Last edited by SigniferOne; 04-10-2007 at 22:13.

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Well spawn_army works like this now:
    Code:
    spawn_army
    		faction slave
    		character	Primus, named character, age 18, x 147, y 379
                    traits GoodCommander 1
    		unit		NE Catapult				exp 1 armour 0 weapon_lvl 0
    	end
    Not sure if the soldiers thing still works, the attributes are handled through traits now.
    Last edited by alpaca; 04-11-2007 at 13:09.

  3. #3

    Default Re: alpaca's Script-O-Rama

    Ok right, that's better syntax. But you forgot the comma, after unit name :)

  4. #4
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Nope, it's a working code example.

  5. #5

    Default Re: alpaca's Script-O-Rama

    Hmm ok well I'll test it out soon enough, this is puzzling for me. Meanwhile, I dug up Epistolary Richard's two scripting threads, which are frankly worth gold. I really think you should make a prominent link to them, or else incorporate them somehow: Beginner's and Intermediate Guide to scripting.

    There are some fascinating tidbits from the Intermediate Guide. For instance, say you want your script to automatically automerge all units for you, but there's only one problem -- there is no scripting command to automerge. No worries, because TW scripting allows you to call shortcuts! Thus, you can create a script to automerge, or to automatically call Ctrl+S to periodically save your campaign, or any other shortcut like that. Here's the code, from the Intermediate Guide:

    Quote Originally Posted by Stuie
    Code:
    monitor_event CharacterSelected FactionType romans_brutii
         and FactionIsLocal          
         call_object_shortcut campaign_hud automerge_units
    end_monitor
    
    monitor_event SettlementSelected FactionType romans_brutii          
         and FactionIsLocal          
         call_object_shortcut campaign_hud automerge_units
    end_monitor
    
    monitor_event CharacterSelected FactionType gauls          
         and FactionIsLocal          
         call_object_shortcut campaign_hud automerge_units
    end_monitor
    or if you want your script to speed things up,

    Quote Originally Posted by Myrddraal
    Code:
    here is a neat scripting command which I found whilst working on the MP campaign:
    
    call_object_shortcut
    
    Here is an example of the syntax:
    
    call_object_shortcut strat_ui speedup_ai
    
    the strat_ui bit is the category of the shortcut. If you open data\text\descr_shortcuts.txt and scroll to the bottom end, you'll find a list of the shortcuts with their categories to the right.
    Here's a list of all ui_elements that can be called: https://forums.totalwar.org/vb/showp...25&postcount=5

    One interesting thing from there is that you can have your script order a "order_halt" shortcut (Backspace), and trigger it whenever an enemy character becomes visible. Without this feature, normally your issued movement orders will be continued to full, even if enemies become visible in the meanwhile; else, you need to carefully watch all your characters' movements and quickly press backspace, not a pleasant alternative. Of course this script would need to be balanced, because you don't want it preventing your characters from movement altogether, when within sight of enemies. So you'd have the script disable itself after it first triggers.
    Last edited by SigniferOne; 04-11-2007 at 21:15.

  6. #6
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Yep I was planning to go through these again to see what I can incorporate here.
    Would be cool if you could explain a bit about the scripts you mentioned so I can copy&paste them into one of my above posts as examples, or about the call_shortcut as a concept (that was actually one I had planned but I am not at all averse to somebody else doing the work )

  7. #7

    Default Re: alpaca's Script-O-Rama

    I think it's the create_unit command that doesn't work if you leave out the comma after the unit name.
    It's not a map.

  8. #8

    Default Re: alpaca's Script-O-Rama

    Quote Originally Posted by alpaca
    Yep I was planning to go through these again to see what I can incorporate here.
    Would be cool if you could explain a bit about the scripts you mentioned so I can copy&paste them into one of my above posts as examples, or about the call_shortcut as a concept (that was actually one I had planned but I am not at all averse to somebody else doing the work )
    Sure, no problem. I'll do it in a little bit, when I get everything straightened out over here.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO