Page 1 of 1

Any means to access inventory?

Posted: Mon Oct 15, 2012 5:40 pm
by Mebaru
Hello,
There's no means to access/manipulate party inventory or I am missing something? Couldn't find in docs.

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 5:48 pm
by Shroom
http://www.grimrock.net/modding/scripting-reference/

and scroll down to the last few entries in Champion section :)

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 5:48 pm
by crisman
Sure, what do you want to know? How to add an item? how to look for an item in the inventory? To remove it? _Here's the list of instructions. Hope it helps!

Champion:insertItem(slot, item)
Inserts an item to an equipment slot. Slot must be one of the following: 1 (head), 2 (torso), 3 (legs), 4 (feet), 5 (cloak), 6 (neck), 7 (left hand), 8 (right hand), 9 (gaunlets), 10 (bracers), 11-31 (backpack slots).

Champion:removeItem(slot)
Removes an item from an equipment slot.

Champion:getItem(slot)
Returns an item in an equipment slot.

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 5:49 pm
by crisman
@shroom oh man, you've beaten me for two seconds... :D

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 6:08 pm
by Mebaru
My bad. Missed info about 11-31 being backpack slots... :mrgreen: Thanks!

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 6:50 pm
by Mebaru
Hmm,
Champion:getItem() seem always returning nil to me - party:getChampion(1):getItem(i) wherever slot I test (ie 1-31). What's me doing wrong? :geek:

update:
Weird thing! all nil from getItem() is if your champions have only everlasting torch equiped. If party has any other item beside everlasting torch - getItem() works fine and return all items correctly, including debug torch.

Re: Any means to access inventory?

Posted: Mon Oct 15, 2012 7:49 pm
by crisman
Mebaru wrote:Hmm,
Champion:getItem() seem always returning nil to me - party:getChampion(1):getItem(i) wherever slot I test (ie 1-31). What's me doing wrong? :geek:

update:
Weird thing! all nil from getItem() is if your champions have only everlasting torch equiped. If party has any other item beside everlasting torch - getItem() works fine and return all items correctly, including debug torch.
I've tried but it's working fine for me... don't know what happened to you