rg_storyline_trigger = {
	# 初始化故事事件触发
	random_list = {
		50 = {
			country_event = {
				id = rg_story.2
				days = 3600
				random = 12800
			}
		}
		50 = {
			country_event = {
				id = rg_story.8
				days = 3600
				random = 12800
			}
		}
	}
	if = {
		limit = {
			exists = event_target:guardian_dragon_country
			NOT = {
				has_global_flag = has_origin_gray_dragon
			}
		}
		country_event = {
			id = rg_story.11
			days = 3600
			random = 12800
		}
	}
}

rg_create_gray_planetkiller_testship_1 = {
	create_fleet = {
		name = "NAME_RG_TESTSHIP"
		settings = {
			can_disband = yes
			can_upgrade = no
			can_change_composition = no
			can_change_leader = no
			uses_naval_capacity = no
			spawn_debris = no
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_RG_TESTSHIP"
				design = "RG_COLOSSUS_interdictor_SP"
				prefix = no
				upgradable = no
				effect = {
					save_global_event_target_as = rg_test_ship_global_event_target
				}
			}
			set_location = {
				target = root.capital_scope
				distance = 0
				angle = random
			}
			set_fleet_flag = rg_test_ship_fleet
		}
	}
}

rg_create_gray_paperwork_testship_1 = {
	create_fleet = {
		name = "NAME_RG_TESTSHIP"
		settings = {
			can_disband = yes
			can_upgrade = no
			can_change_composition = no
			can_change_leader = no
			uses_naval_capacity = no
			spawn_debris = no
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_RG_TESTSHIP"
				design = "RG_Buff_interdictor_SP"
				prefix = no
				upgradable = no
			}
			set_location = {
				target = root.capital_scope
				distance = 0
				angle = random
			}
			set_fleet_flag = rg_test_ship_fleet
		}
	}
}

rg_create_gray_mod1_testship_1 = {
	create_fleet = {
		name = "NAME_RG_TESTSHIP"
		settings = {
			can_disband = yes
			can_upgrade = no
			can_change_composition = no
			can_change_leader = no
			uses_naval_capacity = no
			spawn_debris = no
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_RG_TESTSHIP"
				design = "RG_aircruiser_Interdictor"
				prefix = no
				upgradable = no
			}
			set_location = {
				target = root.capital_scope
				distance = 0
				angle = random
			}
			set_fleet_flag = rg_test_ship_fleet
		}
	}
}

rg_create_gray_mod1_testship_2 = {
	create_fleet = {
		name = "NAME_RG_TESTSHIP"
		settings = {
			can_disband = yes
			can_upgrade = no
			can_change_composition = no
			can_change_leader = no
			uses_naval_capacity = no
			spawn_debris = no
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_RG_TESTSHIP"
				design = "RG_Buff_interdictor"
				prefix = no
				upgradable = no
			}
			set_location = {
				target = root.capital_scope
				distance = 0
				angle = random
			}
			set_fleet_flag = rg_test_ship_fleet
		}
	}
}

rg_create_fake_dragon_species = {
	create_species = {
		name = RG_SIMULATION_DRAGON_SPECIES
		plural = RG_SIMULATION_DRAGON_SPECIES
		class = ART
		portrait = art13
		namelist = ART1
		effect = {
			save_global_event_target_as = RG_sim_dragon_species
		}
	}
}

rg_create_fake_dragon = {
	rg_create_fake_dragon_species = yes
	if = {
		limit = {
			NOT = {
				has_country_flag = rg_fake_dragon_reborn_country
			}
		}
		create_leader = {
			class = commander
			species = root
			name = "Name_rg_fake_dragon"
			event_leader = yes
			gender = female
			custom_description = rg_fake_dragon_desc
			skill = 1
			set_age = 0
			traits = {
				trait = RG_leader_trait_admiral_fake_dragon
				trait = RG_leader_trait_admiral_timed_life
			}
			effect = {
				set_leader_flag = has_gained_level_trait
				set_leader_flag = has_gained_trait
				set_leader_flag = legendary_leader
				set_leader_flag = rg_fake_dragon
				save_global_event_target_as = rg_fake_dragon_admiral
			}
		}
		set_variable = {
			which = rg_fake_dragon_timedlife_counter
			value = 0
		}
		set_country_flag = rg_fake_dragon_owner
		save_global_event_target_as = rg_fake_dragon_owner
		create_fleet = {
			name = "NAME_RG_Nanite_Dragon"
			settings = {
				can_disband = yes
				can_upgrade = no
				can_change_composition = no
				can_change_leader = no
				uses_naval_capacity = no
				spawn_debris = no
			}
			effect = {
				set_owner = root
				create_ship = {
					name = "NAME_RG_Nanite_Dragon"
					design = "NAME_RG_FAKE_Dragon"
					prefix = no
					upgradable = no
				}
				set_location = {
					target = root.capital_scope
					distance = 0
					angle = random
				}
				set_fleet_flag = rg_fake_dragon_fleet
				assign_leader = last_created_leader
				save_global_event_target_as = rg_fake_dragon_fleet
			}
		}
	}
}

rg_create_gray_constship_1 = {
	create_fleet = {
		name = "NAME_Gray"
		settings = {
			can_disband = yes
			can_upgrade = yes
			can_change_composition = yes
			can_change_leader = yes
			uses_naval_capacity = yes
			spawn_debris = yes
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_Gray"
				design = "NAME_RG_GRAY_constructor"
				prefix = no
				upgradable = yes
			}
			set_location = {
				target = event_target:global_gray_location
				distance = 0
				angle = random
			}
		}
	}
}

rg_create_gray_colony_1 = {
	create_ship_design = {
		design = "NAME_RG_armed_colony_ship"
	}
	add_ship_design = last_created_design
	create_fleet = {
		name = "NAME_Gray"
		settings = {
			can_disband = yes
			can_upgrade = yes
			can_change_composition = yes
			can_change_leader = yes
			uses_naval_capacity = yes
			spawn_debris = yes
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_Gray"
				design = "NAME_RG_armed_colony_ship"
				prefix = no
				upgradable = yes
			}
			set_location = {
				target = event_target:global_gray_location
				distance = 0
				angle = random
			}
		}
	}
	remove_ship_design = last_created_design
}

rg_create_gray_destroyer_1 = {
	create_fleet = {
		name = "NAME_RG_base_destroyer"
		settings = {
			can_disband = yes
			can_upgrade = no
			can_change_composition = no
			can_change_leader = no
			uses_naval_capacity = no
			spawn_debris = no
		}
		effect = {
			set_owner = root
			create_ship = {
				name = "NAME_RG_base_destroyer"
				design = "RG_base_destroyer_key"
				prefix = no
				upgradable = no
			}
			set_location = {
				target = root.capital_scope
				distance = 0
				angle = random
			}
		}
	}
}