Jump to content

Recommended Posts

  • Premium

Hi, do you know, where can be problem?

SYSERR: May  6 15:18:57 :: RunState: LUA_ERROR: locale/france/quest/object/state/lua_drop:1: attempt to index field `?' (a nil value)
SYSERR: May  6 15:18:57 :: WriteRunningStateToSyserr: LUA_ERROR: quest lua_drop.start click 

locale/france/quest/object/state/lua_drop:

lua_drop={["start"]=0,drop= function (self)if dropList [ self ] . typ == "drop" then 
local chance , count 
table . foreach ( dropList [ self ] . dropps , function ( i ) 
if dropList [ self ] . dropps [ i ] [ 3 ] ~= nil then 
chance = dropList [ self ] . dropps [ i ] [ 3 ] 
else 
chance = 100 
end 
if dropList [ self ] . dropps [ i ] [ 2 ] ~= nil then 
count = dropList [ self ] . dropps [ i ] [ 2 ] 
else 
count = 1 
end 
if math . random ( 1 , 100 ) < chance then 
game . drop_item_with_ownership ( dropList [ self ] . dropps [ i ] [ 1 ] , count ) 
end 
end ) 
elseif dropList [ self ] . typ == "limit" then 
if dropList [ self ] . min_level == nil or dropList [ self ] . max_level == nil then return end 
if dropList [ self ] . min_level > pc . level or dropList [ self ] . max_level < pc . level then return end 
local chance , count 
table . foreach ( dropList [ self ] . dropps , function ( i ) 
if dropList [ self ] . dropps [ i ] [ 3 ] ~= nil then 
chance = dropList [ self ] . dropps [ i ] [ 3 ] 
else 
chance = 100 
end 
if dropList [ self ] . dropps [ i ] [ 2 ] ~= nil then 
count = dropList [ self ] . dropps [ i ] [ 2 ] 
else 
count = 1 
end 
if math . random ( 1 , 100 ) < chance then 
game . drop_item_with_ownership ( dropList [ self ] . dropps [ i ] [ 1 ] , count ) 
end 
end ) 
else 
return 
end 
end }

normal quest: 

 

quest lua_drop begin
state start begin
when login begin
dropList = {
[8008] = {
typ = "limit", -- type
min_level = 35, -- mindestlevel
max_level = 45, -- maxlevel
dropps = {
{50513, 1, 15}, -- dropeintrag (vnum, count, chance)
{27992, 1, 1},
{27993, 1, 1},
{27994, 1, 1},
{50034, 1, 100},
{70005, 1, 5},
{70024, 1, 5},
{70102, 1, 5},
{71084, 1, 35},
{71085, 1, 35},
}
},
-- Vrchní ork
[691] = { 
typ = "limit", -- type
min_level = 10, -- mindestlevel
max_level = 55, -- maxlevel
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50070, 1, 100},
}
},
-- Král démonů
[1091] = { 
typ = "limit", -- type
min_level = 10, -- mindestlevel
max_level = 55, -- maxlevel
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50081, 1, 100},
}
},
-- Královna pavouků
[2091] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50073, 1, 100},
}
},
-- Želva
[2191] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50076, 1, 100},
}
},
-- Devítiocas
[1901] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50077, 1, 100},
}
},
-- Žlutý tygr
[1304] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50078, 1, 100},
}
},
-- Král plamenů
[2206] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50079, 1, 100},
}
},
-- Tmavý vůdce duchů
[792] = { 
typ = "drop", -- type
dropps = {
{50006, 1, 100}, -- dropeintrag (vnum, count, chance)
{50008, 1, 100},
{50007, 1, 100},
{50009, 1, 100},
{50072, 1, 100},
}
},
}
end
function drop(self)
if dropList[self].typ == "drop" then
local chance,count
table.foreach(dropList[self].dropps, function(i)
if dropList[self].dropps[3] ~= nil then
chance = dropList[self].dropps[3]
else
chance = 100
end
if dropList[self].dropps[2] ~= nil then
count = dropList[self].dropps[2]
else
count = 1
end
if math.random(1, 100) < chance then
game.drop_item_with_ownership(dropList[self].dropps[1], count)
end
end)
elseif dropList[self].typ == "limit" then
if dropList[self].min_level == nil or dropList[self].max_level == nil then return end
if dropList[self].min_level > pc.level or dropList[self].max_level < pc.level then return end
local chance,count
table.foreach(dropList[self].dropps, function(i)
if dropList[self].dropps[3] ~= nil then
chance = dropList[self].dropps[3]
else
chance = 100
end
if dropList[self].dropps[2] ~= nil then
count = dropList[self].dropps[2]
else
count = 1
end
if math.random(1, 100) < chance then
game.drop_item_with_ownership(dropList[self].dropps[1], count)
end
end)
else
return
end
end
when kill with not npc.is_pc() begin
lua_drop.drop(npc.get_race())
end
end
end

 

 

Link to comment
https://metin2.dev/topic/6777-lua-problem/
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Premium

Really Ugly :huh:

 

try this

quest lua_drop begin
    state start begin
        function test()
            dropList = {
                [8008] = {
                    typ = "limit", -- type
                    min_level = 35, -- mindestlevel
                    max_level = 45, -- maxlevel
                    dropps = {
                        {50513, 1, 15}, -- dropeintrag (vnum, count, chance)
                        {27992, 1, 1},
                        {27993, 1, 1},
                        {27994, 1, 1},
                        {50034, 1, 100},
                        {70005, 1, 5},
                        {70024, 1, 5},
                        {70102, 1, 5},
                        {71084, 1, 35},
                        {71085, 1, 35},
                    }
                },
                -- Vrchní ork
                [691] = {
                    typ = "limit", -- type
                    min_level = 10, -- mindestlevel
                    max_level = 55, -- maxlevel
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50070, 1, 100},
                    }
                },
                -- Král démonů
                [1091] = {
                    typ = "limit", -- type
                    min_level = 10, -- mindestlevel
                    max_level = 55, -- maxlevel
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50081, 1, 100},
                    }
                },
                -- Královna pavouků
                [2091] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50073, 1, 100},
                    }
                },
                -- Želva
                [2191] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50076, 1, 100},
                    }
                },
                -- Devítiocas
                [1901] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50077, 1, 100},
                    }
                },
                -- Žlutý tygr
                [1304] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50078, 1, 100},
                    }
                },
                -- Král plamenů
                [2206] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50079, 1, 100},
                    }
                },
                -- Tmavý vůdce duchů
                [792] = {
                    typ = "drop", -- type
                    dropps = {
                        {50006, 1, 100}, -- dropeintrag (vnum, count, chance)
                        {50008, 1, 100},
                        {50007, 1, 100},
                        {50009, 1, 100},
                        {50072, 1, 100},
                    }
                },
            }
        end

    function drop(self)
        local dropList = lua_drop.test().dropList
        if dropList[self].typ == "drop" then
            local chance,count
            table.foreach(dropList[self].dropps, function(i)
            if dropList[self].dropps[i][3] ~= nil then
                chance = dropList[self].dropps[i][3]
            else
                chance = 100
            end
            if dropList[self].dropps[i][2] ~= nil then
                count = dropList[self].dropps[i][2]
            else
                count = 1
            end
            if math.random(1, 100) < chance then
                game.drop_item_with_ownership(dropList[self].dropps[i][1], count)
            end
        end)
        elseif dropList[self].typ == "limit" then
            if dropList[self].min_level == nil or dropList[self].max_level == nil then return end
            if dropList[self].min_level > pc.level or dropList[self].max_level < pc.level then return end
            local chance,count
            table.foreach(dropList[self].dropps, function(i)
            if dropList[self].dropps[i][3] ~= nil then
                chance = dropList[self].dropps[i][3]
            else
                chance = 100
            end
            if dropList[self].dropps[i][2] ~= nil then
                count = dropList[self].dropps[i][2]
            else
                count = 1
            end
            if math.random(1, 100) < chance then
                game.drop_item_with_ownership(dropList[self].dropps[i][1], count)
            end
        end)
        else
        return
    end
end

        when kill with not npc.is_pc() begin
            lua_drop.drop(npc.get_race())
        end
    end
end

If you're going to do something, then do it right.

Link to comment
https://metin2.dev/topic/6777-lua-problem/#findComment-42817
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.