| 07-04-2005, 02:48 PM | #1 |
How can I move a item from a item slot to another. Can I create a item at a speficic item slot? |
| 07-04-2005, 03:27 PM | #2 |
Could could make sure that the slot you want to create it in is empty and the first open slot before giving the hero an item. You would have to loop to check if the slots before it were empty, create a dud item, create your item after telling the hero to drop the item in the slot you want, create the proper item, remove the duds that you could save in an array, and repickup the item |
| 07-04-2005, 05:13 PM | #3 |
Its it that method InvX and RPG Enigne uses? |
| 07-04-2005, 08:43 PM | #4 |
Idont know. Probably not. they probably do it the clever way, but i dont know what that is |
| 07-04-2005, 08:46 PM | #5 |
RPG Enigne uses a trans blp to do it I think. Making a items system easy to use with save-codes (6 slots + 5 equipment slots) |
| 07-05-2005, 12:15 AM | #6 |
Yea, just use fake items. It doesn't even matter what the .blp is, because the change happens so fast you don't even see the fake items in your inventory. |
| 07-05-2005, 03:10 PM | #7 |
I have a another question that fits the title. How to detect movements in the inventory? |
| 07-05-2005, 03:37 PM | #8 |
I think the native to get it is called GetOrderId() orderid 852002-852007 item moved to slot 0-5. You can create an item in a certain slot by using this Code:
native UnitAddItemToSlotById takes unit whichUnit, integer itemId, integer itemSlot returns boolean If the item already exists you can use this native to move it to a slot of choice (note it must already be in the units inventory) Code:
native UnitDropItemSlot takes unit whichUnit, item whichItem, integer slot returns boolean a quick function that will add an item to the slot of choice (will drop item currently present in that slot, and give you it as a reference) BsItem() - an item you don't care about. it-item you want to move to a slot. Code:
function UnitAddItemToSlot takes unit hero, item it,integer slot returns item
local integer bs=BsItem()
local item temp=null
local item ret=UnitItemInSlot(hero,slot)
local integer i=0
loop
exitwhen i==slot
if(UnitItemInSlot(hero,i)==null)then
call UnitAddItemById(hero,bs)
endif
set i=i+1
endloop
call UnitAddItem(hero,it)
loop
exitwhen i<0
if(GetUnitTypeId(UnitItemInSlot(hero,i))=bs)then
call RemoveItem(UnitItemInSlot(hero,i))
endif
set i=i-1
endloop
return ret
endfunction |
| 07-05-2005, 03:39 PM | #9 | |
Quote:
|
| 07-05-2005, 04:16 PM | #10 |
I tougth more of the event to do this. EDIT Found it, but how to differ from Picking up order and move item in nverntory? |
