Results 1 to 30 of 102

Thread: A Beginner's Guide to Scripting & Scripting "How To"s

Hybrid View

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

    Default How to: Create units ~ including unique units

    How to: Create units ~ including unique units

    The Client Kingdoms mod uses this in order to generate the troops the player is offered though there are many, many other uses.

    Here's a sample script:
    Code:
    script
    console_command create_unit Campus_Scythii "barb infantry briton" 4
    end_script
    In this case when the script is activated 4 units of the Briton Warband will be created in Campus Scythii.

    It need not necessarily be a settlement, you can also use a character name. This example comes from the Prologue script.

    Code:
    script
    console_command create_unit "Gaius Julius" "roman velite" 2
    end_script
    RomeShell provide these parameters:
    Code:
    create_unit (settlement/character_name) (unit_id) (opt: how many)(opt: exp/armour/weapon)
    Here's the relevant points
    - the troop description corresponds to their Type line in export_descr_unit
    - character names must be in "quotes", settlements not
    - double or triple-barrelled settlement names must have an _ instead of spaces
    - importantly, the troops become owned by whoever controls the settlement or the character's faction, there is no need for a faction to be able to build the unit or even have ownership in export_descr_unit.

    This gives us the potential to have unique units appear not just at the beginning of the game but also as it progresses as you can trigger this script based on date, the capture of a particular settlement, the construction of a building or anything else specified amongst the event identifiers.

    And as no changes are needed to export_descr_unit it means that custom battles and bribery are completely unchanged.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  2. #2

    Default How to: Capture Settlements

    How to: Capture Settlements

    This script ousts whatever garrison is in the settlement and gives it to the local faction (ie, the player's faction)

    Code:
    script
    console_command capture_settlement Londinium
    end_script
    It can be used in conjunction with the create_unit command to provide an instant garrison loyal to the player, or equally with a negative add_money that would represent the player purchasing the settlement or sponsoring an uprising.

    Because this command only gives the settlement to the player, it can't be used on the player's own settlements.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  3. #3

    Default How to: Create Buildings

    How to: Create Buildings


    Code:
    script
    console_command create_building Londinium muster_field
    end_script
    The building name is referenced from the entry export_descr_buildings.

    There are no limitations on which buildings can be given to which faction - even buildings which aren't normally available (such as Royal Barracks or Amphitheatres for the Britons). You can even have duplicate buildings.

    Combined with a date trigger, this allows you to build a unique building at a specific time in the game and therefore could be used for "Wonder"-like buildings.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  4. #4
    Member Member Jason's Avatar
    Join Date
    May 2005
    Location
    Ft. Worth, Texas
    Posts
    30

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Ok please pardon my newbishness but I have never done a mod before and I am trying out what you have outlined here in this thread.

    This btw was a very well written thread and I found it very easy to understand with only one problem. It doesnt appear to work for me. Im not sure why.

    I have no other mods on my system, just the vanilla game, with patch 1.2 installed.

    Now as far as I can tell the problem resides in the line:

    Script scripts\show_me\mo_money.txt

    that is put in the advicethread portion of the file export_descr_advice.


    When I install this line in the file and then save, Rome will start up, show me the first Activision screen and then promptly crash to desktop.

    When I take the line out and save it plays as normal.

    I have been over the lines very carefully in an attempt to spot any typos or other stupid things that might have caused the problem and as far as I can tell I have followed your directions to the letter (litterally).

    I have even gone so far as to compare my line with other Script lines in other advicethread sections to see if I messed up my syntax somewhere but to no avail.


  5. #5
    Magister Vitae Senior Member Kraxis's Avatar
    Join Date
    Feb 2002
    Location
    Frederiksberg, Denmark
    Posts
    7,129

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Interesting, but will the change of ownership always end up in favour of the player? I was thinking along the lines of a city changing hands to another at some point (obviously early).
    You may not care about war, but war cares about you!


  6. #6

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Jason - I'm sorry to hear you're having problems. I've noticed that the board formatting has put a couple of spaces in between Title and Text1, but that doesn't sound like what's going wrong if just removing the script line gets it working again.

    Can you use show_err in your shortcut line and tell me what the error message is (if there is one)?

    Kraxis - yes, it's always in favour of the player as far as I can tell but maybe there's an optional ownership parameters in there.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  7. #7
    is not a senior Member Meneldil's Avatar
    Join Date
    Aug 2004
    Location
    France
    Posts
    3,074

    Default Re : A Beginner's Guide to Scripting & Scripting "How To"s

    My question might sound obvious, but I'm trying to create a script that would order a AI character to attack a given settlements during AI turn, but I can't really find out what I should do. Is it a campaign or a show me script ?

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