Code:
;============== FACTION KILLER WORKAROUND ===============
; Thanks to this tutorial: http://www.twcenter.net/forums/showthread.php?655272-Faction-destroyed-event&p=13890413#post13890413
declare_counter faction_is_dead
monitor_event PreFactionTurnStart TrueCondition
set_event_counter factionsdestroyed 0 ; in order to count how many factions will get destroyed until the end of each factions turn
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute venice Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute sicily Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute milan Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute denmark Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute egypt Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute scotland Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute cumans Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute turks Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute france Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute hre Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute england Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute portugal Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute poland Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute byzantium Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute moors Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute russia Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute spain Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute hungary Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute aragon Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute lithuania Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute kievan_rus Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute norway Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute jerusalem Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute kwarezm Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
and I_EventCounter mongols_invasion > 5
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute mongols Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor
monitor_event IncomingMessage IncomingMessageType faction_defeated
and I_EventCounter timurids_invasion > 2
set_counter faction_is_dead 1 ;default to dead=true
if I_FactionLeaderAttribute timurids Command < 999 ;they are alive: set dead=false
set_counter faction_is_dead 0
end_if
if I_CompareCounter faction_is_dead = 1 ;yes, they are dead
inc_event_counter factionsdestroyed 1
terminate_monitor
end_if
end_monitor