This is to update the latest script to allow diplomat to recruit own factions units behind enemy line.
As it turned out, the previous optimization trying to combine all the check for each faction in one monitor is not working out for all the cases.
So this script below is the most reliable version, albeit cost more memory to load all the event monitors.
Permission for use is more than welcome, if credit to me on the original idea to allowing the diplomat to recruit own faction units in hostile territory, and/or the script.
Code:
;;
;; Diplomat can raise army behind enemy lines
;;
declare_counter RecruitArmyInAmazonia ; control counter for recruit Army Behind Enemy Line
set_counter RecruitArmyInAmazonia 0
declare_counter DaciaCanRecruitArmyInThyssa ; control counter for recruit Army Behind Enemy Line
set_counter DaciaCanRecruitArmyInThyssa 0
monitor_event CharacterTurnEnd FactionType dacia ; faction the diplomat belongs to
and AgentType = diplomat
and InEnemyLands ; Enemy Territory, or rather outside of own faction territory
and I_LocalFaction dacia ;
and I_CompareCounter RecruitArmyInAmazonia = 0
and DiplomaticStanceFromFaction pontus = AtWar
;;
;; First time recruitment will take place right away
;;
set_counter RecruitArmyInAmazonia 4
end_monitor
monitor_event CharacterTurnEnd FactionType dacia ; faction the diplomat belongs to
and AgentType = diplomat
and InEnemyLands ; Enemy Territory, or rather outside of own faction territory
and I_LocalFaction dacia ;
and I_CompareCounter DaciaCanRecruitArmyInThyssa = 0
and DiplomaticStanceFromFaction romans_scipii = AtWar
;;
;; First time recruitment will take place right away
;;
set_counter DaciaCanRecruitArmyInThyssa 8
end_monitor
monitor_event FactionTurnEnd FactionType dacia
and DiplomaticStanceFromFaction pontus = AtWar
and I_CompareCounter RecruitArmyInAmazonia > 0
and I_LocalFaction dacia
if I_CharacterTypeNearTile dacia diplomat, 6 192,76 ; Central Valley of Amazonia
inc_counter RecruitArmyInAmazonia
if I_CompareCounter RecruitArmyInAmazonia >= 4
set_counter RecruitArmyInAmazonia 1
console_command add_money 1000 ; not only army is raised, but money is also take from the enmey faction
console_command add_money pontus, -1000
spawn_army
faction dacia
character Pleiades, general, age 20, x 191, y 75
unit jyazii pathfinder, exp 1 armour 0 weapon_lvl 0
unit jyazii pathfinder, exp 1 armour 0 weapon_lvl 0
end
end_if
end_if
;;
;; Future recruitment will take place when
;; Diplomat remains in enemy territory for 4 straight turns
;;
if not I_CharacterTypeNearTile dacia diplomat, 6 192,76
set_counter RecruitArmyInAmazonia 0
end_if
end_monitor
monitor_event FactionTurnEnd FactionType dacia
and DiplomaticStanceFromFaction romans_scipii = AtWar
and I_CompareCounter DaciaCanRecruitArmyInThyssa > 0
and I_LocalFaction dacia
if I_CharacterTypeNearTile dacia diplomat, 6 180,136 ; Central Valley of Amazonia
inc_counter DaciaCanRecruitArmyInThyssa
if I_CompareCounter DaciaCanRecruitArmyInThyssa >= 8
set_counter DaciaCanRecruitArmyInThyssa 1
console_command add_money 1000 ; not only army is raised, but money is also take from the enmey faction
console_command add_money romans_scipii, -1000
spawn_army
faction dacia
character Pleiades, general, age 20, x 180, y 137
unit jyazii elite archers horse, exp 1 armour 0 weapon_lvl 0
unit caro ballistae, exp 1 armour 0 weapon_lvl 0
unit jyazii gladiatus cohort, exp 1 armour 0 weapon_lvl 0
unit jyazii axe militia, exp 1 armour 0 weapon_lvl 0
unit jyazii serf lanciarii, exp 1 armour 0 weapon_lvl 0
unit jyazii serf lanciarii, exp 1 armour 0 weapon_lvl 0
unit jyazii female peasant, exp 1 armour 0 weapon_lvl 0
end
end_if
end_if
;;
;; Future recruitment will take place when
;; Diplomat remains in enemy territory for 8 straight turns
;;
if not I_CharacterTypeNearTile dacia diplomat, 6 180,136
set_counter DaciaCanRecruitArmyInThyssa 0
end_if
end_monitor