Page 1 of 1

Check party items for "gold_key"

Posted: Sun Apr 20, 2025 5:34 am
by supercell1970
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.

Re: Check party items for "gold_key"

Posted: Mon Apr 21, 2025 2:35 pm
by Slava
Try PartyComponent:isCarrying(string)

Code: Select all

party.party:isCarrying("gold_key")
This is an easy way to see if someone has gold key. Returns true or false.

Re: Check party items for "gold_key"

Posted: Mon Apr 21, 2025 2:47 pm
by Slava
You can also use a similar design

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
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”