- Joined
- Jul 26, 2008
- Messages
- 1,009
After using JASS to add an item to a shops stock, no matter what numbers I put in the stockMax or currentStock field, when a unit buys the item the item is gone from stock. So how do I set this up properly? Thanks. I mean, I can do a basic system that counts how many times the item was bought and readds it til it reaches 0, but I wanted to make sure there wasn't a simpler way first.
Below is the map used and this is the trigger that adds the item. Oddly, units do not have this problem when adding them the same way.
Below is the map used and this is the trigger that adds the item. Oddly, units do not have this problem when adding them the same way.
JASS:
function Trig_GainsEclipsingDream_Actions takes nothing returns boolean
if GetBuyingUnit() == gg_unit_nC84_0658 and GetItemTypeId(GetSoldItem()) == 'moon' then
call AddItemToStock(gg_unit_nC84_0658, 'moon', 1, 4)
endif
return false
endfunction
//===========================================================================
function InitTrig_GainsEclipsingDream takes nothing returns nothing
set gg_trg_GainsEclipsingDream = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_GainsEclipsingDream, EVENT_PLAYER_UNIT_PAWN_ITEM )
call TriggerAddCondition( gg_trg_GainsEclipsingDream, function Trig_GainsEclipsingDream_Actions )
endfunction