HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GetHandleItem

02-25-2006, 09:02 PM#1
Thunder_Eye
I cant seem to find the GetHandleItem/SetHandleItem function, anyone knows where I can find it?
02-25-2006, 09:10 PM#2
shadow1500
Collapse JASS:
function GetHandleItem takes handle subject, string name returns item
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
02-25-2006, 09:12 PM#3
Thunder_Eye
Ok so how is the "Set" one? same as the integer?
02-25-2006, 09:14 PM#4
Vexorian
There is no SetHandleItem

Only SetHandleHandle
02-25-2006, 09:19 PM#5
Thunder_Eye
Oh ok thank you, another fast question then.
How do I move an item from say slot 1 to slot 6 on a unit?
02-25-2006, 09:21 PM#6
Vexorian
Collapse JASS:
native          UnitDropItemSlot        takes unit whichUnit, item whichItem, integer slot returns boolean
02-25-2006, 09:25 PM#7
Thunder_Eye
to bad, Im no good with natives :/
anyway I found a solution by dropping the item, creating a item called "empty" in slot 1-5 if they are empty, then giving the item to the hero and atlast removing the "empty" items.

Finally my backpacksystem is done!! I will post it in resources later when Im almost done with the RPG.

Thank you for your help
02-25-2006, 09:27 PM#8
Vexorian
That solution is terrible and your backpack system will be awful unless you use the darn native

BTW what's stopping you from using a native? It seems you are good enough to use functions, natives are only different in the fact that they are implemented natively in the game but the way to use them is the same as when calling functions
02-25-2006, 09:33 PM#9
Thunder_Eye
Well Ive never understood the "takes blabla returns blabla" part.

A function like that can sometimes look like

function AbcFoF takes unit u returns nothing
call KillUnit(u)
endfunction

And Ive never understood where its sets the u variable.
Logicaly it would be that when you call the function you use
call AbcFoF(GetTriggeringUnit())
or something but Ive never seen anyone do it like that.

And with the return part it is the same
function AspGH takes nothing returns integer (dont know if this is right might be that it should be "returns h")
return h
endfunction

Quote:
Originally Posted by Vexorian
and your backpack system will be awful unless you use the darn native
Thank you glad to hear
02-26-2006, 03:59 PM#10
Thunder_Eye
Quote:
Originally Posted by Vexorian
Collapse JASS:
native          UnitDropItemSlot        takes unit whichUnit, item whichItem, integer slot returns boolean

bump*
so the call could look like
Collapse JASS:
call UnitDropItemSlot(GetTriggeringUnit(),UnitItemInSlotBJ(GetTriggerUnit(), 1),6)
I'm just wondering what the boolean is for and how do I use it?

EDIT:
this gives me an error
call UnitDropItemSlot(u,GetLastCreatedItem(),6)
02-26-2006, 04:49 PM#11
Anitarf
The line looks fine, it shouldn't give you an error when compiling. However, there is a different mistake there, in JASS, item slots go from 0 to 5. Also, regarding the first example of calling the native, it's GetTriggerUnit(), not GetTriggeringUnit().
02-26-2006, 06:01 PM#12
Thunder_Eye
Yeah I just wrote it as I thought it was, didnt check if it where correct.
Oh yeah, forgot the slot thing, that is probably it. will test it

EDIT: So what were the boolean for? didnt get an answer
EDIT2:
call UnitDropItemSlot(u,GetLastCreatedItem(),5)
still gives me an error, can it be because I havent included the boolean anywhere?
EDIT3:Problem Solved, I forgot I was using a global (udg_)
Though still on the boolean question
02-26-2006, 06:33 PM#13
Anitarf
The boolean it returns probably means if the operation was successful or not. It could fail if the unit didn't have the item, or if you specified an invalid slot number. Many functions return such a boolean, like the issue order natives, for example. You don't have to use it; it's just there at your disposal if you need it for some reason.