Oneda
Aspiring Spriter
Been trying for a while now, works fine till you have none of the items equipped, which then makes the getSlotItem return nil. Not really sure how to proceed in with the nils, been bashing my head into the wall with this for a while now.
I know there might be a real dumb easy way to handle that nil, I'm just not able to figure it out (yeah, ffs)
Explaining on the script:
isGolden(player) returns true if player has any of the items in said slots, if not returns false. The rest is basically just for debugging purposes...
I know there might be a real dumb easy way to handle that nil, I'm just not able to figure it out (yeah, ffs)
Explaining on the script:
isGolden(player) returns true if player has any of the items in said slots, if not returns false. The rest is basically just for debugging purposes...
Lua:
function isGolden(player)
if player:getSlotItem(CONST_SLOT_LEGS):getId() == 2470 or player:getSlotItem(CONST_SLOT_ARMOR):getId() == 2466 or player:getSlotItem(CONST_SLOT_HEAD):getId() == 2471 then
return true
else return false
end
end
function onSay(player, words, param)
if isGolden(player) then
player:say("yep", TALKTYPE_MONSTER_SAY)
return false
else player:say("nope", TALKTYPE_MONSTER_SAY)
return false
end
end
Last edited: