strutZ
Australian OT Member {AKA Beastn}
- Joined
- Nov 16, 2014
- Messages
- 1,391
- Solutions
- 7
- Reaction score
- 550
Scratching my head at this for a bit...
I want to be able to see the items that have been added to the corpse.
Here is my current script
Everything seems to work correctly but as soon as there is gold/plat/crystal coins in there it is returning nil... Have i over looked something?
I want to be able to see the items that have been added to the corpse.
Here is my current script
Lua:
local ec = EventCallback
ec.onDropLoot = function(self, corpse)
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return
end
local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
local item = corpse:createLootItem(monsterLoot[i])
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
end
end
print(corpse:getSize())
for i = 1, corpse:getSize() do
local a = corpse:getItem(i)
print(a)
end
if player then
local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
end
end
else
local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
end
end
end
ec:register()
Everything seems to work correctly but as soon as there is gold/plat/crystal coins in there it is returning nil... Have i over looked something?