Re: Creating Custom assets (monsters, objects and items)
Posted: Sat May 30, 2020 11:56 pm
Items in character inventory do not exist—on the map.
SpoilerShow
To interact with inventory items, you must use the Champion object—specifically the one champion who is holding the item. You can then call either the removeItem() function, or removeItemFromSlot() function for that champion.
https://github.com/JKos/log2doc/wiki/Ob ... s#champion
*The usual way(s) to access a champion object is to assign a local variable [typically called champion] the return value from
party.party:getChampion(number)
or
party.party:getChampionByOrdinal(number)
Where 'number' is the current champion in slot position 1 through 4, or (by ordinal) number is the ordinal number assigned to the champions when the game starts; their first positions. This number never changes.
______________________
Example:
Item onEquip/Unequip hooks provide the relevant champion object to use with them.
https://github.com/JKos/log2doc/wiki/Co ... -component
https://github.com/JKos/log2doc/wiki/Ob ... s#champion
*The usual way(s) to access a champion object is to assign a local variable [typically called champion] the return value from
party.party:getChampion(number)
or
party.party:getChampionByOrdinal(number)
Where 'number' is the current champion in slot position 1 through 4, or (by ordinal) number is the ordinal number assigned to the champions when the game starts; their first positions. This number never changes.
______________________
Example:
Code: Select all
--in your function
local champion = party.party:getChampion(2) --for the champion in position #2; upper right portrait
Code: Select all
--in your function
local champion = party.party:getChampionByOrdinal(2) --for champion #2; could be in any position, doesn't matter
https://github.com/JKos/log2doc/wiki/Co ... -component
http://www.grimrock.net/forum/viewtopic.php?f=22&t=7951