• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Stock shop with item, make it buyable x times, how to do it?

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
Alright I tried this method:

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, 10)
    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

But 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.
 
Status
Not open for further replies.
Top