Results 1 to 6 of 6

Thread: Questions on script and "sacking"

Hybrid View

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

    Default Re: Questions on script and "sacking"

    Code:
    monitor_event SettlementExterminated SettlementName x
    console_command set_building_health x building_complex 0
    end_monitor
    Something like that should damage buildings when a settlement named X is exterminated.

  2. #2

    Default Re: Questions on script and "sacking"

    Since it's about the same topic, pls maybe someone can correct me

    {{{{{{{ script

    while I_TurnNumber < 1840
    select_ui_element advisor_dismiss_button
    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up

    suspend_unscripted_advice true

    ;;;;;;;; spawn_army ;;;;;;
    declare_counter spawn_army

    if I_TurnNumber = 0
    set_counter spawn_armyA 0
    set_counter spawn_armyB 0
    set_counter spawn_armyC 0
    set_counter spawn_armyD 0
    end_if

    ;;;;;;;; spawn_army ;;;;;;
    monitor_event FactionTurnStart FactionType greek_cities
    and I_TurnNumber > 21

    if spawn_armyA = 0

    spawn_army
    faction greek_cities
    character Pyrrhus of Epirus, named character, command 3, influence 1, management 1, subterfuge 0, age 38, , x 112, y 67
    unit greek general's guard cavalry exp 1 armour 0 weapon_lvl 0
    unit epirote pikemen exp 2 armour 0 weapon_lvl 0
    unit epirote pikemen exp 1 armour 0 weapon_lvl 0
    unit greek medium cavalry exp 0 armour 0 weapon_lvl 0
    unit greek hoplite exp 2 armour 0 weapon_lvl 0
    unit greek hoplite exp 1 armour 0 weapon_lvl 0
    unit greek hoplite exp 2 armour 0 weapon_lvl 0
    unit greek hoplite exp 1 armour 0 weapon_lvl 0
    unit greek hoplite militia exp 0 armour 1 weapon_lvl 0
    unit greek hoplite militia exp 0 armour 1 weapon_lvl 0
    unit aor greece thessalian cavalry exp 1 armour 0 weapon_lvl 0
    unit merc rhodian slingers exp 1 armour 0 weapon_lvl 0
    unit merc cretan archers exp 1 armour 0 weapon_lvl 0
    unit merc elephants exp 1 armour 0 weapon_lvl 0
    unit greek hoplite militia exp 0 armour 1 weapon_lvl 0
    unit merc rhodian slingers exp 1 armour 0 weapon_lvl 0
    unit merc cretan archers exp 1 armour 0 weapon_lvl 0
    set_counter spawn_armyA 1
    end_if

    terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and I_TurnNumber > 138

    if spawn_armyB = 0

    spawn_army
    faction carthage
    character Himilcar Barca, general, command 5, influence 5, management 0, subterfuge 3, age 40, x 96, y 47
    unit carthaginian general's cavalry exp 1 armour 0 weapon_lvl 0
    unit carthaginian sacred band infantry exp 3 armour 1 weapon_lvl 1
    unit carthaginian sacred band infantry exp 3 armour 1 weapon_lvl 1
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit libyan spearmen exp 2 armour 1 weapon_lvl 1
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit aor spain infantry exp 2 armour 1 weapon_lvl 1
    unit aor spain infantry exp 1 armour 0 weapon_lvl 0
    unit aor spain infantry exp 1 armour 0 weapon_lvl 0
    unit aor spain infantry exp 1 armour 0 weapon_lvl 0
    unit aor spain infantry exp 1 armour 0 weapon_lvl 0
    unit merc balearic slingers exp 2 armour 0 weapon_lvl 0
    unit merc balearic slingers exp 2 armour 0 weapon_lvl 0
    unit aor spain cavalry exp 2 armour 0 weapon_lvl 0
    unit aor spain cavalry exp 2 armour 0 weapon_lvl 0
    unit merc numidian cavalry exp 2 armour 0 weapon_lvl 0
    unit merc numidian cavalry exp 2 armour 0 weapon_lvl 0
    unit carthaginian elephant forest exp 0 armour 0 weapon_lvl 0
    unit carthaginian elephant forest exp 0 armour 0 weapon_lvl 0
    set_counter spawn_armyB 1
    end_if

    terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType gauls
    and I_TurnNumber > 177

    if spawn_armyC = 0

    spawn_army
    faction gauls
    character Dumnorix of Bibrax, general, command 5, influence 0, management 0, subterfuge 0, age 20, , x 89, y 91
    unit barb chieftain cavalry gaul exp 1 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 0 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 1 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 0 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 1 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 0 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 1 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 0 armour 0 weapon_lvl 0
    unit barb infantry gaul exp 1 armour 0 weapon_lvl 0
    unit barb peltast gaul exp 1 armour 0 weapon_lvl 0
    unit barb peltast gaul exp 1 armour 0 weapon_lvl 0
    unit gaul gothic hev inf exp 3 armour 0 weapon_lvl 0
    unit gaul gothic hev inf exp 3 armour 0 weapon_lvl 0
    unit gaul gothic hev inf exp 3 armour 0 weapon_lvl 0
    unit barb cavalry gaul exp 3 armour 0 weapon_lvl 0
    unit barb cavalry gaul exp 3 armour 0 weapon_lvl 0
    unit barb cavalry gaul exp 3 armour 0 weapon_lvl 0
    set_counter spawn_armyC 1
    end_if

    terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType carthage
    and I_TurnNumber > 249

    if spawn_armyD = 0

    spawn_army
    faction carthage
    character Hannibal Barca, general, command 6, influence 5, management 0, subterfuge 3, age 40, x 89, y 91
    unit carthaginian general's cavalry exp 1 armour 0 weapon_lvl 0
    unit carthaginian sacred band infantry exp 3 armour 1 weapon_lvl 1
    unit carthaginian sacred band infantry exp 3 armour 1 weapon_lvl 1
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit libyan spearmen exp 2 armour 1 weapon_lvl 1
    unit libyan spearmen exp 1 armour 0 weapon_lvl 0
    unit aor spain infantry exp 2 armour 1 weapon_lvl 1
    unit aor spain infantry exp 1 armour 1 weapon_lvl 0
    unit aor spain infantry exp 1 armour 1 weapon_lvl 0
    unit aor spain infantry exp 1 armour 1 weapon_lvl 0
    unit aor spain infantry exp 1 armour 1 weapon_lvl 0
    unit merc balearic slingers exp 2 armour 1 weapon_lvl 1
    unit merc balearic slingers exp 2 armour 1 weapon_lvl 1
    unit aor spain cavalry exp 2 armour 0 weapon_lvl 0
    unit aor spain cavalry exp 2 armour 0 weapon_lvl 0
    unit merc numidian cavalry exp 2 armour 1 weapon_lvl 1
    unit merc numidian cavalry exp 2 armour 1 weapon_lvl 1
    unit merc numidian cavalry exp 2 armour 1 weapon_lvl 1
    unit carthaginian elephant forest exp 1 armour 0 weapon_lvl 0
    set_counter spawn_armyD 1
    end_if

    terminate_monitor
    end_monitor

    ;;;;;;;;;;;;;;; 4 TPY ;;;;;;;;;;;;;;;;

    console_command date -280
    console_command season summer
    declare_counter Season_Year_Turn0_Thread
    while I_TurnNumber = 0
    monitor_conditions I_CompareCounter Season_Year_Turn0_Thread = 0
    if I_CompareCounter Season_Year_Turn0_Thread = 0
    advance_advice_thread Season_Year_Turn0_Thread
    inc_counter Season_Year_Turn0_Thread 1
    end_if
    end_monitor
    suspend_unscripted_advice true
    end_while

    console_command date -280
    console_command season summer
    declare_counter Season_Year_Turn1_Thread
    while I_TurnNumber = 1
    monitor_conditions I_CompareCounter Season_Year_Turn1_Thread = 0
    if I_CompareCounter Season_Year_Turn1_Thread = 0
    advance_advice_thread Season_Year_Turn1_Thread
    inc_counter Season_Year_Turn1_Thread 1
    end_if
    end_monitor
    suspend_unscripted_advice true
    end_while }}}}}}}}}

    This is my modification on the 4TPY cript where I wanted to make spawn armies. It works for the first one, but the others keep spawining everyting I load a save game.. :-(
    Say: O unbelievers, I serve not what you serve, nor do you serve what I serve, nor shall I serve what you are serving, nor shall you be serving what I serve.
    To you your religion, and to me my religion.

  3. #3
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Questions on script and "sacking"

    thats because when you reload a game, the 4TPY script actually runs the entire script up to the point where the turn number is correct.

    To avoid this problem put

    if I_TurnNumber = 0
    Enter script here
    end_if

    That way it will only happen on that turn and not afterwards

  4. #4

    Default Re: Questions on script and "sacking"

    So, is that means I have to delete all end_if after the spawn army script except spawn_armyD ?

    Anyway another advice I recieve is to delete part in bold and change
    the and I_TurnNumber > 21 to
    I_TurnNumber = 21
    as below. Is there any differences ? I tested this one first, and the army didn't spawn again (already spawn on the exact date) when I reload the game. However I didn't test the game before it spawn to see if the script works.

    Thanks for the advice Myrddraal

    while I_TurnNumber < 1840
    select_ui_element advisor_dismiss_button
    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up

    suspend_unscripted_advice true


    ;;;;;;;; spawn_army ;;;;;;
    declare_counter spawn_army

    if I_TurnNumber = 0
    set_counter spawn_armyA 0
    set_counter spawn_armyB 0
    set_counter spawn_armyC 0
    set_counter spawn_armyD 0
    end_if

    ;;;;;;;; spawn_army ;;;;;;
    monitor_event FactionTurnStart FactionType greek_cities
    and I_TurnNumber > 21
    Say: O unbelievers, I serve not what you serve, nor do you serve what I serve, nor shall I serve what you are serving, nor shall you be serving what I serve.
    To you your religion, and to me my religion.

  5. #5

    Default Re: Questions on script and "sacking"

    I_TurnNumber = 21 is what you want.
    This peace of script:
    Code:
    monitor_event FactionTurnStart FactionType greek_cities
    and I_TurnNumber = TURN_NUMBER
    will ensure that inside of this monitor will be executed only on turn equal to TURN_NUMBER and only at the begining of greek turns.
    It will be executed only once.

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