Hey guys,
I'm trying to spawn an item in my players inventory.
When i do this:
function doThing()
party.party:getChampion(1):insertItem(11,dagger_1.item)
end
it compiles and runs, but nothing...
If I call it (11,dagger.item) or anything other than an actual dagger already placed, it says the item is a nill.
What's up here?
insertItem into inventory?
Re: insertItem into inventory?
I think your issue is just the index you're using. I guess there are 2 more equipment slots now, so backpack spaces start at 13. 11 should be your champion's "second" left hand.
I just tested it now and it worked, somewhat, although I was having issues with the item occupying both its original position and the new position in inventory until I picked the item up [edit: from either its original position or the new backpack slot]. Also, it would do nothing if there was already an item in that slot, so that could also be your issue.
I know it's not a solution, but hopefully that helps in the right direction.
I just tested it now and it worked, somewhat, although I was having issues with the item occupying both its original position and the new position in inventory until I picked the item up [edit: from either its original position or the new backpack slot]. Also, it would do nothing if there was already an item in that slot, so that could also be your issue.
I know it's not a solution, but hopefully that helps in the right direction.

-
- Posts: 28
- Joined: Tue Oct 21, 2014 5:51 am
Re: insertItem into inventory?
jxjxjf you delicious bastard!! It works! Thanks a million!
Re: insertItem into inventory?
My solution was to spawn the item to a 1x1 room (basically not accessible by the party, I call the Trash Room heh) then add it to the characters inventory. When you pick up the item for the first time (in Inventory) the item in the "Trash Room" disappears (being it was the same ID).jxjxjf wrote: I just tested it now and it worked, somewhat, although I was having issues with the item occupying both its original position and the new position in inventory until I picked the item up [edit: from either its original position or the new backpack slot]. Also, it would do nothing if there was already an item in that slot, so that could also be your issue.
-
- Posts: 12
- Joined: Sat Oct 25, 2014 3:26 pm
Re: insertItem into inventory?
If backpack spaces start at 13 what are the other spaces designated as? I've tried addItem into 13 and it works fine but things like 12,14 don't seem to do anything.
Edit: Also, and I've posted in a different post about spawning entities about this same thing, how would you addItem into your inventory in the case of something like a pellet_box since they have a count. So instead of just adding a single "pellet_box" to your bag, how would you add 5,10,or 100? Just seems like the only way I can get to the count easily is by placing the entity down and then just modifying that, which is more steps then I really want to go through.
Edit: Also, and I've posted in a different post about spawning entities about this same thing, how would you addItem into your inventory in the case of something like a pellet_box since they have a count. So instead of just adding a single "pellet_box" to your bag, how would you add 5,10,or 100? Just seems like the only way I can get to the count easily is by placing the entity down and then just modifying that, which is more steps then I really want to go through.
Last edited by TheLegendaryNarwhal on Sun Oct 26, 2014 5:19 am, edited 1 time in total.
Re: insertItem into inventory?
Can give my script a whirl. I'll be here for a short while longer if you need help.