﻿#Events for managing death of characters

namespace = Population_Control

Population_Control.0001 = {
	hidden = yes

	trigger = {
		OR = {
			any_living_character = {				
				count >= maintain_population_max			
			}
			exists = global_var:wipestart	
		}
	}
	immediate = {
		set_global_variable = {
			name = wipestart	
			value = 1
		}
		set_global_variable = {
			name = minwipecount
			value = 500
		}
		if = {
			limit= {
				any_living_character = {				
					count <= maintain_population_min			
				}	
			}		
			remove_global_variable = wipestart				
		}
		trigger_event = Population_Control.0002
	}
}

Population_Control.0002 = {
	theme = friendly
	hidden = yes

	immediate = {	
		every_living_character = {
			trigger_event = {
				on_action = Population_Control_presetting
				days = { 1 90 }
			}	
		}		
	}
}