Lava Titan
Developer
Hey there <3
How can I check if an item inside a table is inside another table?
like:
full script:
How can I check if an item inside a table is inside another table?
like:
Lua:
for i = 1, #loot do
if loot[i].itemId has rareLoot then
target:getPosition():sendMagicEffect(CONST_ME_TUTORIALARROW)
target:getPosition():sendMagicEffect(CONST_ME_TUTORIALSQUARE)
end
end
full script:
Lua:
-- test value = 2148
local rareLoot = {2148, 12792, 12794, 12788, 12804, 12805, 12806, 12807, 12808, 12809, 12800, 12801}
local monsterKill = CreatureEvent("monsterKill")
function monsterKill.onKill(creature, target)
if not target:isMonster() then
return true
end
local player = Player(creature:getGuid())
local loot = MonsterType(target:getName()):getLoot()
if target:isMonster() then
for i = 1, #loot do
if loot[i].itemId has rareLoot then
target:getPosition():sendMagicEffect(CONST_ME_TUTORIALARROW)
target:getPosition():sendMagicEffect(CONST_ME_TUTORIALSQUARE)
end
end
end
return true
end
monsterKill:type("kill")
monsterKill:register()
---------------------------------------------------------------------------------------
local monsterKillLogin = CreatureEvent("monsterKillLogin")
function monsterKillLogin.onLogin(player)
player:registerEvent("monsterKillLogin")
player:registerEvent("monsterKill")
return true
end
monsterKillLogin:type("login")
monsterKillLogin:register()