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

    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.

  2. #2

    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?

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

    Default Re: An Intermediate Guide to Scripting

    Bring up the console on campaign map, place cursor over desired tile and type show_cursorstat, then press enter :)

  4. #4

    Default Re: An Intermediate Guide to Scripting

    If I use spawn and move command to not local faction with monitor_event, hothing happaned:

    script
    monitor_event FactionTurnStart FactionType romans_julii
    and not FactionIsLocal
    spawn_army
    faction romans_julii
    character Flavius Julius, general, command 0, influence 0, management 0, subterfuge 0, age 20, x 180, y 5
    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
    console_command move_character Flavius Julius 170, 5
    campaign_wait 1
    console_command move_character Flavius Julius 160, 15
    end_monitor
    end_script


    If I use it to not local faction without monitor_event spawn work, but no moves

    If I use it to local faction spawn works, move works too.

  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

    Weird. Beats me why it doesn't work.

    The only thing I can think of is that you were playing with the Julii when testing with not FactionIsLocal, but that wouldn't still explain why the moves didn't work..

  6. #6

    Default Re: An Intermediate Guide to Scripting

    Is there easiest way to check - me and my ally's- diplomatic stance for all other fractions? I am chartage, my ally is spain.

    script
    declare_counter war0
    set_counter war0 0
    declare_counter war1
    set_counter war1 0
    declare_counter war2
    set_counter war2 0
    declare_counter war3
    set_counter war3 0
    declare_counter war4
    set_counter war4 0
    declare_counter war5
    set_counter war5 0
    declare_counter loop
    set_counter loop 0

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_brutii = AtWar
    set_counter war0 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_brutii <= Neutral
    set_counter war0 0
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_julii = AtWar
    set_counter war1 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_julii <= Neutral
    set_counter war1 0
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_scipii = AtWar
    set_counter war2 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction romans_scipii <= Neutral
    set_counter war2 0
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction gauls = AtWar
    set_counter war3 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction gauls <= Neutral
    set_counter war3 0
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction numidia = AtWar
    set_counter war4 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction numidia <= Neutral
    set_counter war4 0
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction greek_cities = AtWar
    set_counter war5 1
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and FactionIsLocal
    and DiplomaticStanceFromFaction greek_cities <= Neutral
    set_counter war5 0
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction romans_brutii < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war0 = 1
    console_command diplomatic_stance spain romans_brutii war
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction romans_julii < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war1 = 1
    console_command diplomatic_stance spain romans_julii war
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction romans_scipii < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war2 = 1
    console_command diplomatic_stance spain romans_scipii war
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction gauls < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war3 = 1
    console_command diplomatic_stance spain gauls war
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction numidia < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war4 = 1
    console_command diplomatic_stance spain numidia war
    end_monitor

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and DiplomaticStanceFromFaction greek_cities < AtWar
    and DiplomaticStanceFromFaction carthage = Allied
    and I_CompareCounter war5 = 1
    console_command diplomatic_stance spain greek_cities war
    end_monitor

    while I_CompareCounter loop = 0
    end_while

    end_script

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

    Default Re: An Intermediate Guide to Scripting

    You probably have the easiest way right there in your hands. If you don't need to check for specific factions there are a couple of conditions (OnWarFooting or similar), but for specific factions there's really no way around it. If you start doing these kind of repetitive scripts you should learn how to do script generators, with php, C++, excel or similar.

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