I need to be able to check party items for a "gold_key". Does anyone have some example script
that I can utilize. I keep getting a "nil" on the champion command.
Check party items for "gold_key"
Re: Check party items for "gold_key"
Try PartyComponent:isCarrying(string)
This is an easy way to see if someone has gold key. Returns true or false.
Code: Select all
party.party:isCarrying("gold_key")
My Generations of Kings mod
Link to Nexus mods
Link to Nexus mods
Re: Check party items for "gold_key"
You can also use a similar design
where champion is a table obtained for example from party.party:getChampionByOrdinal(1).
target is the name of the item you are looking for: “gold_key”
Code: Select all
function(champion, target)
for i=1,ItemSlot.MaxSlots do
local item = champion:getItem(i)
if item then
if item.go.name = target then
return true
else
local container = item.go.containeritem
if container then
local capacity = container:getCapacity()
for j=1,capacity do
local item2 = container:getItem(j)
if item2 = champion:getItem(i)
return true
end
end
end
end
end
end
return
end
target is the name of the item you are looking for: “gold_key”
My Generations of Kings mod
Link to Nexus mods
Link to Nexus mods