• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Help fixing script

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
There's an script from Jano, and I'm trying to optimize an function of his script, wich is:

http://otland.net/f82/autoloot-91385/

LUA:
    local corpse = -1
    for _, item in ipairs(items) do
        local name = getItemName(item.uid):lower()
        if name:find(target:lower()) then
            corpse = item.uid
            break
        end
    end

When you kill a monster, it records monster name and position.

If monster corpse contains monster name (like, creature was a demon, his corpse is a slain demon), then it's assigned as creature corpse, for the rest of the script

But there are some monsters, like bosses, who corpses does not have it's name, like Demodras (dead dragon), Morgaroth (demon dust) and so on.

How could I add some exceptions to this script, like "if creaturename = demodras then target = ID_DEAD_DRAGON"
 
Last edited:
dont bump so fast, also its not optimalisation but fixing bug
if name:find(target:lower()) or name==bosses[target:lower] then with proper config array should work probably

oh well, I messed it a bit anyway, was kinda sleepy ;d
 
Last edited:
Hm, could you give one example?

I do the rest later.

like

LUA:
bosses =
{
Morgaroth = 6338
}

if name:find(target:lower()) or name==bosses[getitemid(target.itemid)]

/\ Of course that won't work, made just to give an idea '-'
 
Back
Top