local items_count=0 
local itemin=nil 

function have_item_namber(itm,need_namber) 
local actor=db.actor 
items_count=0 
itemin=itm 
actor:iterate_inventory(cheking_item,actor) 
if items_count>=need_namber then 
return true 
else 
return false 
end 
end 
function cheking_item(actor,item) 
local items=item:section() 
if items==itemin then 
items_count=items_count+1 
end 
end 
function create_items(npc,section,number) 
for i=1,number do 
alife():create(section, 
npc:position(), 
npc:level_vertex_id(), 
npc:game_vertex_id(), 
npc:id()) 
end 
end 
local reloc_params={} 
local stalk 
function out_item_namber(itm_section,need_number) 
reloc_params.itm_section=itm_section 
reloc_params.itm_cnt=need_number 
reloc_params.itm_cnt_found =0 
db.actor:iterate_inventory(checkout_items_count,db.actor) 
reloc_params.itm_cnt_found=0 
if reloc_params.itm_cnt_found<=reloc_params.itm_cnt then 
db.actor:iterate_inventory(out_items_count,db.actor) 
end 
news_manager.relocate_item(db.actor, "out", itm_section) 
reloc_params={} 
end 
function relocate_item_namber(stalker,itm_section,need_number) 
stalk=stalker 
reloc_params.itm_section=itm_section 
reloc_params.itm_cnt=need_number 
reloc_params.itm_cnt_found=0 
db.actor:iterate_inventory(checkout_items_count,db.actor) 
reloc_params.itm_cnt_found=0 
if reloc_params.itm_cnt_found<=reloc_params.itm_cnt then 
db.actor:iterate_inventory(reloc_items_count,db.actor) 
end 
news_manager.relocate_item(db.actor, "out", itm_section) 
reloc_params={} 
end 
function checkout_items_count(actor,item) 
if item.section and item:section()==reloc_params.itm_section then 
reloc_params.itm_cnt_found = reloc_params.itm_cnt_found + 1 
end 
end 
function reloc_items_count(actor,item) 
if item.section and item:section()==reloc_params.itm_section and reloc_params.itm_cnt_found<reloc_params.itm_cnt then 
db.actor:transfer_item(item, stalk) 
reloc_params.itm_cnt_found = reloc_params.itm_cnt_found + 1 
end 
end 
function out_items_count(actor,item) 
if item.section and item:section()==reloc_params.itm_section and reloc_params.itm_cnt_found<reloc_params.itm_cnt then 
amk.remove_item_from_inventory(item, actor) 
reloc_params.itm_cnt_found = reloc_params.itm_cnt_found + 1 
end 
end 
