Is there any simple way of just removing an item from a specific slot in the inventory 1-6?
The only way with the current triggers I can see is, each time a hero pickups an item storing it in a variable, then destroying the item (specific variable).
From my experience you are pretty much stuck with having to populate a new list of inventory items every time, update an array(s) to hold items, then remove/move/etc accordingly. Please also keep in mind that if your bag/equipment/whatever isn't perfectly rectangular, that is there is any empty spots, the item slot # will adjust accordingly.
IE(Let S be a spot, B be a blank):
S
S
S
Would result in inventory slots 1, 2, and 3.
However:
S
B
S
Would result in inventory slots 1 and 3. It isn't terribly complicated, but it is something else to keep in mind. Anyways I've found it easiest to keep my arrays populated and simply remove items from it. However if you don't wish to do this, it is possible to do, just keep in mind if you have multiple bags that will make it a little more complicated still.
Something like (Not exact code, I'm not at the editor sorry):
Parameters: int bagNum, int slotNum
int P = (Triggering Player);
//autoval refers to the current item in the list
For each item in (All items carried by (P))
{
if(SlotUnitInventoryContainer(autoval) == bagNum &&
UnitInventorySlot(autoval) == slotNum)
{
Remove autoval for Player(P);
break; //or return or something so this stops repeating.
}
}
Is there any simple way of just removing an item from a specific slot in the inventory 1-6?
The only way with the current triggers I can see is, each time a hero pickups an item storing it in a variable, then destroying the item (specific variable).
Anyone have any experience with this?
Hmhmh, what do you want to do exactly ? Because there is already a trigger action that allows that:
Example:
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Item carried by (Triggering unit) in 1)) == "Your item"
then
Unit - Remove inventory item (Item carried by (Triggering unit) in 1)
Of course you always need to check what item type currently is in that slot.
@Fullachain: Go
From my experience you are pretty much stuck with having to populate a new list of inventory items every time, update an array(s) to hold items, then remove/move/etc accordingly. Please also keep in mind that if your bag/equipment/whatever isn't perfectly rectangular, that is there is any empty spots, the item slot # will adjust accordingly.
IE(Let S be a spot, B be a blank):
Would result in inventory slots 1 and 3. It isn't terribly complicated, but it is something else to keep in mind. Anyways I've found it easiest to keep my arrays populated and simply remove items from it. However if you don't wish to do this, it is possible to do, just keep in mind if you have multiple bags that will make it a little more complicated still.
Something like (Not exact code, I'm not at the editor sorry):