Log in

View Full Version : Questions on script and "sacking"



wlesmana
02-07-2006, 08:25
Ok, we know that Hordes can sack settlements. Is it possible to create a script where a landed faction is capable of sacking a city? I.e. getting a large sum of cash while devastating a large part of the population and assets but letting the city kept its affiliation?

If not, is it possible to modify the Exterminate option after a conquest to devastate the population and buildings (especially the key govermental building)?

The_Mark
02-09-2006, 22:37
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.

LestaT
02-11-2006, 18:57
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.. :-(

Myrddraal
02-13-2006, 21:12
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

LestaT
02-15-2006, 10:01
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 :laugh4:


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

LorDBulA
02-16-2006, 08:45
I_TurnNumber = 21 is what you want.
This peace of script:

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.