HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Shop Items Not Removing?

06-21-2008, 08:34 PM#1
TEC_Ghost
Ok so, I'm trying to make a quick little item page system for the shops. But it wont fucking remove my items from stock, and I don't know what the hell is wrong, maybe someone can help me out, here's the trigger.

Collapse JASS:

function Trig_ShopReload_Actions takes nothing returns nothing

if GetItemTypeId(GetSoldItem()) == 'I00A' then
    call RemoveItem( GetSoldItem() )
    call TriggerSleepAction(0)
    //Remove Old Page Items
    call RemoveItemFromStock(GetSellingUnit(), 'I000' )
    call RemoveItemFromStock(GetSellingUnit(), 'I001' )
    call RemoveItemFromStock(GetSellingUnit(), 'I002' )
    call RemoveItemFromStock(GetSellingUnit(), 'I003' )
    call RemoveItemFromStock(GetSellingUnit(), 'I004' )
    call RemoveItemFromStock(GetSellingUnit(), 'I005' )
    call RemoveItemFromStock(GetSellingUnit(), 'I006' )
    call RemoveItemFromStock(GetSellingUnit(), 'I007' )
    call RemoveItemFromStock(GetSellingUnit(), 'I008' )
    call RemoveItemFromStock(GetSellingUnit(), 'I009' )
    call RemoveItemFromStock(GetSellingUnit(), 'I00A' )
    //=====================
    call AddItemToStock(GetSellingUnit(), 'I00B', 1, 1 )
    //Add New Page Items
    call AddItemToStock(GetSellingUnit(), 'vamp', 99, 99 )
    //=====================
    call DisplayTextToForce(GetPlayersAll(),"Swapping to page 2 at unit " + GetUnitName(GetSellingUnit()))
endif
    
if GetItemTypeId(GetSoldItem()) == 'I00B' then
    call RemoveItem( GetSoldItem() )
    call TriggerSleepAction(0)
    //Remove Old Page Items
    call RemoveItemFromStock(GetSellingUnit(), 'vamp')
    call RemoveItemFromStock(GetSellingUnit(), 'I00B')
    //=====================
    call AddItemToStock(GetSellingUnit(),'I00A', 1, 1 )
    //Add New Page Items
    call AddItemToStock(GetSellingUnit(),'I000', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I001', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I002', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I003', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I004', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I005', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I006', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I007', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I008', 99, 99 )
    call AddItemToStock(GetSellingUnit(),'I009', 99, 99 )
    //=====================
    call DisplayTextToForce(GetPlayersAll(),"Swapping to page 1 at unit " + GetUnitName(GetSellingUnit()))
endif
endfunction

//===========================================================================
function InitTrig_ShopReload takes nothing returns nothing
    set gg_trg_ShopReload = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ShopReload, EVENT_PLAYER_UNIT_SELL_ITEM )
    call TriggerAddAction( gg_trg_ShopReload, function Trig_ShopReload_Actions )
endfunction
06-21-2008, 08:57 PM#2
Captain Griffen
You need to add it originally by triggers to be able to remove it by triggers.