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
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

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

    The above tutorials did not work for me - try putting your script inside an existing script file (then deleting the old text) and using that advice thread to activate it. In other words, do not change anything but the contents of the script file you choose.
    "One of the most sophisticated Total War mods ever developed..."

  2. #2
    Speaker of Truth Senior Member Moros's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    13,469

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

    Okay I'm a newby when it comes to scripts but I'm trying to learn.
    When I just tried doing the simpelist of things I got a bug I can't explain.

    if not I_LocalFaction romans_senate
    console_command add_money romans_senate, 30000
    end_if
    This is the part of the script it's all about, it's the first thee lines of a campaignscript called by the descr_strat. Show_err gives this:
    error in balablabla/imperial campaign/campaign_script line 3 collumn something
    Don't understand this token: "end_if".
    Last edited by Moros; 08-01-2007 at 18:54.

  3. #3
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

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

    The first line of a script must be "script", and you should also conclude with "end_script". Try

    Code:
    script
    if not I_LocalFaction romans_senate
        console_command add_money romans_senate, 30000
    end_if
    end_script
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  4. #4
    Speaker of Truth Senior Member Moros's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    13,469

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

    Does a campaign script loaded form the Descr_strat also need script at the start? The EB one for example doesn't...
    I did have end_script though.

    EDIT:
    Same error message though.

  5. #5
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

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

    Quote Originally Posted by Moros
    Does a campaign script loaded form the Descr_strat also need script at the start?
    No, that's a bit different. In that case the "script" command actually appears in descr_strat.txt. You should have something like this at the end:

    Code:
    script
    campaign_script.txt
    Sorry Moros, I don't see what the problem is, and as you're probably aware, the code looks very familiar.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  6. #6
    Speaker of Truth Senior Member Moros's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    13,469

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

    Yes I know. It looks familiar. You gotta learn it and start with something simple and something you can compare, no? Also I have it like you have in the descr_strat.txt, that's why I had no script in the script itself.

    This is wierd, I guess I'll just restart completely maybe that'll help. Thanks for the help though!

  7. #7
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

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

    kinda new to the TW scripting and more into M2 at the moment, but try this ...


    Code:
    if FactionType romans_senate

    G

  8. #8
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

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

    No, Moros wishes to give this faction money only if it isn't controlled by the player. Substituting FactionType for I_LocalFaction won't make this distinction.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  9. #9
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

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

    yep, thats what I'm refering to, afaik you're not refering to a faction with just "[faction]", but need to use "FactionType [faction]".

    anyway thats what the docudemon files make me believe ...


    G

  10. #10
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

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

    No. Here's the docudemon entry:

    Code:
    ---------------------------------------------------
    Identifier:              I_LocalFaction
    Trigger requirements:    
    Parameters:              faction
    Sample use:              I_LocalFaction romans_julii
    Description:             Is the faction the local faction?
    Battle or Strat:         Either
    Class:                   I_LOCAL_FACTION
    Implemented:             Yes
    Author:                  Guy
    In fact, the FactionType condition has a trigger requirement, so it's not useful in this situation.

    The thing is, this expression:

    Code:
    if not I_LocalFaction romans_julii
        console_command add_money romans_julii, 30000
    end_if
    is used in EB. I just tested it to make sure, and it's working.
    Last edited by Atilius; 08-09-2007 at 03:38.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



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