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!
function boss1 takes nothing y returns itempool
local itempool i = CreateItemPool()
ItemPoolAddItemType(i, 'I002',2)
ItemPoolAddItemType(i, 'I003',3)
return i
endfunction
Yes. It leaks two things. The itempool (Because you return it, you must destroy it sometime in the future) And you don't null the itempool, which can't be fixed because you need to return it.
I was afraid of that. Is there a way to do something similar using globals/constants (which I believe have to be done through VJass, but I'm not familiar with using either)?
I would tell you to use a global variable, but I don't know if you can create an itempool global variable...
You can use an item-type array instead of an itempool if the items will always be the same. Also, you won't need to create an itempool every time you want to get an item from the pool.
I would tell you to use a global variable, but I don't know if you can create an itempool global variable...
You can use an item-type array instead of an itempool if the items will always be the same. Also, you won't need to create an itempool every time you want to get an item from the pool.
I heard a rumor somewhere that VJass allows you to create itempools as global variables, and I don't want to use item-type arrays because I want the drop chances of the items to be easy to modify and there will probably be 50+ unique itempools/arrays.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.