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!
I'm currently working on a Inu Yasha map and I'm making it so that they have to find the shikon jewel fragments and make it whole. Now here's the problem. Whenever the character picks up one of the jewel fragments, it doesnt stack and appear as another item in the inventory. There are 24 fragments, after getting half i want it to forge a new item and after getting it all i want it to turn into "Whole Shikon Jewel". Problem is unless i can stack im goign to have to cut the amount of shikon jewels in half, which i dont want to do.
function HasItemtype takes unit whichUnit, item this returns item
local integer i = 0
local item whichItem = null
local integer itemType = GetItemTypeId(this)
if whichUnit != null then
loop
exitwhen i > 6
set whichItem = UnitItemInSlot(whichUnit, i)
if GetItemTypeId(whichItem) == itemType and whichItem != this then
return whichItem
endif
set i = i + 1
endloop
endif
return null
endfunction
function StackItem takes unit whichHero, item whichItem returns nothing
local item stack = HasItemtype(whichHero,whichItem)
local integer itemCharges = GetItemCharges(stack)
if stack != null and stack != whichItem and itemCharges > 0 then
call SetItemCharges( stack, itemCharges+ GetItemCharges(whichItem))
call RemoveItem( whichItem)
endif
endfunction
this is how you stack items!
you jsut need to copy this into map's custom script seciton,create a trigger
Events-Unit Aquires an item
Actions-custom script -
call StackItem(GetManipulatingUnit(),GetManipulatedItem())
however keep in mind that i did not make that function,the author is Aiursrage2k so give him credits,i just found this from a great jass site
after reading the post (since i did only the title) this might not be what you are looking for(not sure again)
the script i gave does the following. if the hero has item X with 1 charge and aquires another then he will have 1 item X with 2 charges.
however you might want to do this!
set the items into an item array.
set also an integer variable FragmentNum to 1
and each time a hero picks the fragment the triggers remove the fragment and give him fragment item [FragmentNum]
and set FragmentNum = FragmentNum +1
this should work,i hope you understood what i told . . . it isnt difficult
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.