Results 1 to 30 of 116

Thread: An Intermediate Guide to Scripting

Hybrid View

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

    Default Re: An Intermediate Guide to Scripting

    I put command line to export_descr_advise.txt, but when I press F1 and activate advisor, the <show me> button did not highlighted so I cannot click it to start scripts. What is wrong?

  2. #2

    Default Re: An Intermediate Guide to Scripting

    Did the correct advisor speech bubble appear? The Show Me How button doesn't become available until the speech bubble appears.

    Post the advice thread that you added the script line to in export_descr_advice.
    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
    J-23 Member Hans Kloss's Avatar
    Join Date
    Oct 2003
    Location
    Richmond upon Thames
    Posts
    245

    Default Re: An Intermediate Guide to Scripting

    Richard
    As I have got not experience whatsover in scripting I have copy edited your your script:

    HTML Code:
    script
    declare_counter loop
    set_counter loop 0
    monitor_event FactionTurnStart FactionType sassanids
    
    if I_SettlementOwner Dumatha = sassanids
    console_command create_unit Dumatha "merc cata" 1
    console_command create_unit Dumatha "merc veteranii" 1
    end_if
    
    if I_SettlementOwner Erewan = sassanids
    console_command create_unit Erewan "elite cata" 1
    end_if
    terminate_monitor
    end_monitor
    while I_CompareCounter loop = 0
    end_while
    end_script
    That works but despite press F1 button it only works once.When I remove terminate_monitor I get new units created on every turn.Could you kindly tell me what line needs to be change for the unit to be created only upon pressing F1.I guess that could be also way of having message appearing advising player he can get new units.Also is there a line that could replace "Sassanids" with something like "all except Romans"

  4. #4

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by dzsagon
    I put command line to export_descr_advise.txt, but when I press F1 and activate advisor, the <show me> button did not highlighted so I cannot click it to start scripts. What is wrong?
    I solved the problem. If a script has any syntax error, the <show me how> button did not highlighted, not allows to run a script. Now my scripts run, but not wery well:(

    script
    declare_counter state
    set_counter state 0
    declare_counter loop
    set_counter loop 0

    console_command add_money -100; just for test to scripts really runs

    monitor_event FactionTurnStart FactionType Egypt
    and FactionIsLocal
    and FactionHasAllies

    if DiplomaticStanceFromFaction pontus >= Hostile
    set_counter state 1
    console_command add_money 2000; just for test to scripts really runs
    end_if

    if DiplomaticStanceFromFaction pontus < Hostile
    set_counter state 0
    console_command add_money -2000; just for test to scripts really runs
    end_if

    end_monitor

    monitor_event FactionTurnStart EgyptFactionType Numidia
    and not FactionIsLocal
    and DiplomaticStanceFromFaction pontus <= Hostile
    and I_CompareCounter state = 1

    console_command diplomatic_stance numidia pontus war

    end_monitor

    while I_CompareCounter loop = 0
    end_while

    end_script

    My allies is Nubidia. If I declare war with pontus I want to Nubidia declares war to. But the script not doing this.

  5. #5
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: An Intermediate Guide to Scripting

    If that is a direct copy&paste from your script then this line is part of the problem:
    Code:
    monitor_event FactionTurnStart EgyptFactionType Numidia
    Then, there are the if lines in the first monitor.
    Code:
     monitor_event FactionTurnStart FactionType Egypt
    and FactionIsLocal
    and FactionHasAllies
    
    if DiplomaticStanceFromFaction pontus >= Hostile
    DiplomaticStanceFromFaction requires exported parametres from a monitor, so it will no work if it is not tied to the monitor with ands. You'll have to split the monitor in two. This is how the other monitor should begin:
    Code:
    monitor_event FactionTurnStart FactionType Egypt
    and FactionIsLocal
    and FactionHasAllies
    and DiplomaticStanceFromFaction pontus >= Hostile
    As a rule of thumb, if a condition doesn't start with I_ it requires to be used as an event monitor condition.

  6. #6

    Default Re: An Intermediate Guide to Scripting

    Thanks a lot! It works now!
    Another question. What is the proper command to give money to other fraction?
    add_money <amount> <fraction name> not works.

  7. #7

    Default Re: An Intermediate Guide to Scripting

    From what other people have posted, you need a comma in there:

    console_command add_money faction, how_much
    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

  8. #8

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Epistolary Richard
    From what other people have posted, you need a comma in there:

    console_command add_money faction, how_much
    Thanks, it seems to be working.

  9. #9

    Default Re: An Intermediate Guide to Scripting

    HI!

    I want to use move_character command , but I don't know how to calculate x,y koordinates of a position on campaign map. Is there a tool or method to do this?

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