Hey, i've been working on a garrison script, nearly finished it, but something is going wrong, units don't wanna spawn. I would really appreciate any help on this question.
Here what a script for 1 city looks like:
City=Name of the City
Faction1= Besieged faction
Faction2= Besieging faction
x,y= Coordinates
Code:
script
declare_counter one
set_counter one 0
declare_counter Citybesieged
if I_CompareCounter Citybesieged = 0
and I_SettlementOwner Rome = [faction1]
if I_CharacterTypeNearTile [faction2] general, 2 x,y
set_counter Acrebesieged 1
end_if
if I_CharacterTypeNearTile [gauls] family, 2 x,y
set_counter Acrebesieged 1
end_if
if I_CompareCounter Acrebesieged = 0
and I_SettlementOwner Rome = [faction2]
if I_CharacterTypeNearTile [faction1] general, 2 x,y
set_counter Acrebesieged 1
end_if
if I_CharacterTypeNearTile [faction1] family, 2 x,y
set_counter Acrebesieged 1
end_if
monitor_event FactionTurnStart FactionType faction1
if I_CompareCounter Citybesieged = 1
if I_SettlementOwner City = faction1
if SettlementBuildingExists = governors_villa
if GarrisonSettlementRatio < 0.1
console_command create_unit City "peasants" 4
console_command add_money -2000
console_command add_population City -1500
end_if
monitor_event FactionTurnStart FactionType faction2
if I_CompareCounter Citybesieged = 1
if I_SettlementOwner City = franks
if SettlementBuildingExists = governors_villa
if GarrisonSettlementRatio < 0.1
console_command create_unit City "peasants" 5
console_command add_money -2000
console_command add_population City -1500
end_if
set_counter one 0
set_counter Citybesieged 0
terminate_script
Bookmarks