-- ÏÎÈËÅÖ
function kontrik_mini_spawn()
	create("controller_mini",xyz(-211.27763366699,0.74816179275513,-141.78596496582),35951,3360)
	find_and_release("taynik_kontrik_vodka")
	level.add_pp_effector("total_recall.ppe", 2004, false)
	say([[zwuk\controller_silence]])
	sms("%c[sender]"..translate("name_istochnik_neizvesten")..":\\n%c[sms_red]"..translate("sms_norman_kontrik_mini_spawn_0"), 12, "norman", 30000, nil, [[sms\norman\kontrik_mini_spawn]])
	sms("%c[sender]"..translate("name_mechenii")..":\\n%c[sms_red]"..translate("sms_strelok_kontrik_mini_spawn1_0"), 60, "meceniy", 10000, nil, [[sms\strelok\kontrik_mini_spawn1]])
	local gtime = game.minutes()
	set_value("mini_alkash", gtime + math.random(0, 0) * 60)
end

function kontrik_mini_kick(actor, npc)
	local value = get_value("km_kick", 0)+1
	set_value("km_kick", value)

	if value == 1 then
		level.add_pp_effector("total_recall.ppe", 2004, false)
		say([[zwuk\controller_evil]])
		sms("%c[sender]"..translate("name_istochnik_neizvesten")..":\\n%c[sms_red]"..translate("sms_norman_kontrik_mini_kick_1_0"), 7, "norman", 15000, nil, [[sms\norman\kontrik_mini_kick_1]])

	elseif value == 5 then
		level.add_pp_effector("total_recall.ppe", 2004, false)
		say([[zwuk\controller_evil]])
		sms("%c[sender]"..translate("name_istochnik_neizvesten")..":\\n%c[sms_red]"..translate("sms_norman_kontrik_mini_kick_3_0"), 7, "norman", 15000, nil, [[sms\norman\kontrik_mini_kick_3]])

	elseif value == 10 then
		level.add_pp_effector("total_recall.ppe", 2004, false)
		say([[zwuk\controller_evil]])
		value_is_10()
		sms("%c[sender]"..translate("name_istochnik_neizvesten")..":\\n%c[sms_red]"..translate("sms_norman_kontrik_mini_kick_2_0"), 7, "norman", 15000, nil, [[sms\norman\kontrik_mini_kick_2]])

	elseif value == 20 then
		level.add_pp_effector("total_recall.ppe", 2004, false)
		say([[zwuk\controller_evil]])
		value_is_20()
		sms("%c[sender]"..translate("name_istochnik_neizvesten")..":\\n%c[sms_red]"..translate("sms_norman_kontrik_mini_kick_4_0"), 7, "norman", 15000, nil, [[sms\norman\kontrik_mini_kick_4]])
		give_info("acv_kormilec")
		timer("run", 23.0, "kontrik_mini.kontrik_mini_delete()")
		archievements.send_archievement("acv_kormilec")
	end

	del_value("mini_alkash")
	lost_item("vodka")
	say([[zwuk\inv_vodka]])
	local gtime = game.minutes()
	set_value("mini_alkash", gtime + math.random(0, 0) * 60)
end
function kontrik_mini_delete()
	level.add_pp_effector("deadcity_wake.ppe", 2000, false)
	say([[zwuk\controller_silence]])
	del_value("mini_alkash")
	del_value("km_kick")
	iterate_level_objects("controller_mini", function(obj)
		release(obj)
		return false
	end)
end

function value_is_10()
	sms("news_info", 1, nil, 5000)
    	local sids = {5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470}
	local obj=story_object(table.random(sids))
	if obj then
		map_spot(obj.id, "crlc_big", "mini_alkash_treasure")
		create("wpn_ak12", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("wpn_scope_lepoid", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_7.62x39_k", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_7.62x39_k", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_7.62x39_k", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_7.62x39_k", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_7.62x39_k", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("wpn_bat_a", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("af_teleport", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
	end
end
function value_is_20()
	sms("news_info", 1, nil, 5000)
	local sids = {5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215}
	local obj=story_object(table.random(sids))
	if obj then
		map_spot(obj.id, "crlc_big", "mini_alkash_treasure")
		create("wpn_b94", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_12.7x108", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_12.7x108", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_12.7x108", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("ammo_12.7x108", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("exo_military_outfit", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("akkumulytor", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("wpn_bat_b", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
		create("af_teleport", obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id)
	end
end