- Joined
- Nov 10, 2006
- Messages
- 181
JASS:
Item bonuses[/b]
Is there a way I can find out how much bonus a Item is giving? Like Agility, Strenght, Intellgience , attack speed , armour , etc.
Some Minor Issues
[code=jass]library BackpackSys
globals
private constant integer BackpackId = 'BAG1'
//Change this to the ID of the backpack item in your map.
endglobals
private struct Data
integer array ItemType[6]
integer array Charges[6]
integer array UserData[6]
static method Create takes unit u returns Data
local Data d = Data.create()
local integer i = 0
local item it
local integer id
loop
set it = UnitItemInSlot(u, i)
set id = GetItemTypeId(it)
if GetSpellAbilityId() == BackpackId then
set d.ItemType[i] = id
set d.Charges[i] = GetItemCharges(it)
set d.UserData[i] = GetItemUserData(it)
call RemoveItem(it)
else
set d.ItemType[i] = 0
set d.Charges[i] = 0
set d.UserData[i] = 0
endif
set i = i + 1
exitwhen i > 6
endloop
set it = null
return d
endmethod
endstruct
function ActivateBackpack takes unit whichUnit returns nothing
local Data d1
local Data d2 = GetUnitUserData(whichUnit)
local integer i = 0
local item it
if GetSpellAbilityId() == BackpackId then
set d1 = Data.Create(whichUnit)
if d2 != 0 then
loop
if d2.ItemType[i] != 0 then
set it = UnitAddItemById(whichUnit, d2.ItemType[i])
call SetItemCharges(it, d2.Charges[i])
call SetItemUserData(it, d2.UserData[i])
endif
set i = i + 1
exitwhen i > 6
endloop
endif
call d2.destroy()
call SetUnitUserData(whichUnit, d1)
endif
set it = null
endfunction
endlibrary
When I have full inventory, both from backpack and hero and I cast the spell, one item will always drop, any clues on why that happen?