- Joined
- Jan 4, 2009
- Messages
- 118
JASS:
function RecipeItem takes unit itemOwner, integer item1, integer quantity, integer item2, integer item3, integer last_item returns nothing
local u = itemOwner
local integer i
local integer j
local integer last_item
local integer quantity = quantity
local array intger item
local effect sfx
set item[1] = item1
set item[2] = item2
set item[3] = item3
set last_item = last_item
//Loop check Item
set i = 1
loop
if(item[i] != null)then
local integer itemChk = itemChk + 1
endif
set i = i + 1
exitwhen i == 3
endloop
// Begin Loop for CreateNewItem
if(itemChk == 1)then // Case A : Has 1 Item Type
// For 1 Item Type but requires 2 or 3 piece
if(quantity == 2)then
set i = 1
loop
call RemoveItem(u, item[1])
set i = i +1
exitwhen i == 2
endloop
call CreateItem(u, last_item) // I don't rememeber this function sorry... xD
else if(quantity == 3)then
set i = 1
loop
call RemoveItem(u, item[1])
set i = i +1
exitwhen i == 3
endloop
call CreateItem(u, last_item) // I don't rememeber this function sorry... xD
set sfx = AddSpecialEffect("Any Effect", GetUnitX(u), GetUnitY(u))
call DestroyEffect(sfx)
set sfx = null
endif
else if(itemChk == 2)then // Case B : Has 2 Item Type
set i = 1
loop
if(i < quantity)then
set j = 1
loop
call RemoveItem(u, item[i])
set j = j + 1
exitwhen j == 2
endloop
else
call RemoveItem(u, item[i])
endif
set i = i + 1
exitwhen i == itemChk
endloop
call CreateItem(u, last_item) // I don't rememeber this function sorry... xD
set sfx = AddSpecialEffect("Any Effect", GetUnitX(u), GetUnitY(u))
call DestroyEffect(sfx)
set sfx = null
endif
else if(itemChk == 3)then // Case C : Has 3 Item Type
set i = 1
loop
call RemoveItem(u, item[i])
set i = i + 1
exitwhen i == itemChk
endloop
call CreateItem(u, last_item) // I don't rememeber this function sorry... xD
set sfx = AddSpecialEffect("Any Effect", GetUnitX(u), GetUnitY(u))
call DestroyEffect(sfx)
set sfx = null
endif
set u = null
set sfx = null
set i = 0
set j = 0
endfunction
Hello All Guys ... I wonder If I use this function to recipe single item or double item ....This function is slows or leak?
help me to check this plz...
If nothing leak ... Thanks you very much
Last edited: