- Joined
- May 24, 2016
- Messages
- 339
Hello, I have that function
F..e if I check for units to have a specific item by this function EVERY time units get damaged, would it cause many massive weight on engine?
Should I change my method to store specific boolean value on units upon PICK/DROP event, and use load boolean instead?
JASS:
function GetInventoryIndexOfItemTypeJ takes unit whichUnit, integer itemId returns integer
local integer index
local item indexItem
set index = 0
loop
set indexItem = UnitItemInSlot(whichUnit, index)
if (indexItem != null) and (GetItemTypeId(indexItem) == itemId) then
return index + 1
endif
set index = index + 1
exitwhen index >= bj_MAX_INVENTORY
endloop
return 0
endfunction
F..e if I check for units to have a specific item by this function EVERY time units get damaged, would it cause many massive weight on engine?
Should I change my method to store specific boolean value on units upon PICK/DROP event, and use load boolean instead?
JASS:
// DAMAGE EVENT
//MY CURRENT METHOD
if GetInventoryIndexOfItemTypeJ(target,'I00C') > 0 then
//actions
endif
//THE METHOD I BELIEVE WOULD CAUSE LESS WEIGHT
if LoadBoolean(Hash,GetHandleId(target),StringHash("Item56")) == true then
//actions
endif