Limit the bags to only 1, how can you hold many full bags ??? Realsitic ?
Trig_Bag_Use_Actions takes nothing returns nothing
local unit hero=GetManipulatingUnit()
local item clicked=GetManipulatedItem()
local item bag=Hero_getBag(hero)
if(Hero_IV(hero)==null)then
set hero=null
set clicked=null
endif
if(Hero_getState(hero)==0)then
if(IsItemBT(clicked))then
call Hero_swapInv(hero)
call Hero_setState(hero,74)
call Hero_setBag(hero,clicked)
call Bag_setPage(clicked,Hero_nextPage(hero,Bag_IV(clicked),Bag_getPage(clicked),false))
call SetItemCharges(UnitItemInSlot(hero,5),Hero_getFree(hero) )
call SetItemCharges(clicked,IV_capacity(Bag_IV(clicked))-Vector_size(Bag_IV(clicked)) )
call Hero_setState(hero,-2)
endif
elseif(Hero_getState(hero)==-2)then
if(clicked==Hero_getCancel(hero))then
call Hero_setState(hero,74)
call Bag_setPage(bag,0)
call Hero_clearInv(hero)
call Hero_swapInv(hero)
call Hero_setState(hero,0)
elseif(clicked==Hero_getNext(hero))then
call Hero_setState(hero,74)
call Hero_clearInv(hero)
call Bag_setPage(bag,Hero_nextPage(hero,Bag_IV(bag),Bag_getPage(bag),false))
call Hero_setState(hero,-2)
elseif(IsItemBT(clicked))then
call SimError(GetOwningPlayer(hero),"You cannot use a container inside a container")
call SetItemCharges(clicked,IV_capacity(Bag_IV(clicked))-Vector_size(Bag_IV(clicked)) )
endif
endif
endfunction
call CreateBT('I00C',8,Condition(function NoCreq)) then when i test map, it shows 8 slots(as it was meant to do). BUT, when i put an item into the bag,opens the bag, and then closes it. it shows that it has 11 slots back when it actually only got 7 left....