Quest Drop alternative to mobi

Quest for drop items alternative to mob_drop_info.

If the killed mob is at a maximum level difference of 15 from the player, there is a probability that it will drop one of the items set in questlib.
alternativdrop.quest :

Code:
    quest alterdrop begin
        state start begin
            when kill with npc.get_level_dif() <= 15 begin
                if not ALTERNATIVE_DROP then return end
                for _,item in ipairs(ALTERNATIVE_DROP) do
                    if math.chance(item.chance) then
                        game.drop_item_with_ownership(item.vnum, item.count)
                    end
                end
            end
        end
    end

We add in questlib :
Code:
function math.chance(i)
    return math.random() <= (i/100)
end
 
local NPC_INFO = {}
local NPC_QUERY_RESULT = mysql_query("SELECT vnum, level FROM player.mob_proto;")
if type(NPC_QUERY_RESULT) == "table" then
    for i,mob in ipairs(NPC_QUERY_RESULT) do
        NPC_INFO[tonumber(mob[1])] = {level = tonumber(mob[2])}
    end
end
 
function npc.get_level()
    local npcvnum = npc.get_race()
    local npcinfo = NPC_INFO[npcvnum]

    if not npcinfo then
        return nil
    end

    return npcinfo.level
end
 
function npc.get_level_dif()
    local pclevel = pc.get_level()
    local npclevel = npc.get_level()

    if not pclevel or not npclevel then
        return nil
    end

    return math.max(pclevel, npclevel) - math.min(pclevel, npclevel)
end
 
ALTERNATIVE_DROP = {
    {chance = 5, vnum = 50125, count = 1},
    {chance = 5, vnum = 50011, count = 1},
    {chance = 5, vnum = 50254, count = 1},
}

Edit in questlib - Explanations :

chance = drop chance in percentages
vnum = item code
count = quantity
 

Funky Robot

New member
Funkymmo Bot
Joined
Jan 14, 2025
Messages
510
Reaction score
3
Points
1
Quest for drop items alternative to mob_drop_info.

If the killed mob is at a maximum level difference of 15 from the player, there is a probability that it will drop one of the items set in questlib.
alternativdrop.quest :

Code:
    quest alterdrop begin
        state start begin
            when kill with npc.get_level_dif() <= 15 begin
                if not ALTERNATIVE_DROP then return end
                for _,item in ipairs(ALTERNATIVE_DROP) do
                    if math.chance(item.chance) then
                        game.drop_item_with_ownership(item.vnum, item.count)
                    end
                end
            end
        end
    end

We add in questlib :
Code:
function math.chance(i)
    return math.random() <= (i/100)
end
 
local NPC_INFO = {}
local NPC_QUERY_RESULT = mysql_query("SELECT vnum, level FROM player.mob_proto;")
if type(NPC_QUERY_RESULT) == "table" then
    for i,mob in ipairs(NPC_QUERY_RESULT) do
        NPC_INFO[tonumber(mob[1])] = {level = tonumber(mob[2])}
    end
end
 
function npc.get_level()
    local npcvnum = npc.get_race()
    local npcinfo = NPC_INFO[npcvnum]

    if not npcinfo then
        return nil
    end

    return npcinfo.level
end
 
function npc.get_level_dif()
    local pclevel = pc.get_level()
    local npclevel = npc.get_level()

    if not pclevel or not npclevel then
        return nil
    end

    return math.max(pclevel, npclevel) - math.min(pclevel, npclevel)
end
 
ALTERNATIVE_DROP = {
    {chance = 5, vnum = 50125, count = 1},
    {chance = 5, vnum = 50011, count = 1},
    {chance = 5, vnum = 50254, count = 1},
}

Edit in questlib - Explanations :

chance = drop chance in percentages
vnum = item code
count = quantity

This post is visible to everyone, and will be monitored by forum moderators.

Forum description: Metin2 Tutorials, Metin2PServers Forum, Download Premium Resources, C++ / Systems, Server Files, Metin2 Server Files, Metin2 Web Scripting, Metin2 Development, Private Servers, HomePages, Metin2, Metin2 Resources, Minecraft Mods, Minecraft Servers, Minecraft Models, Minecraft Tutorials & Builds, XenForo Add-ons & Styles, IPS Suite Plugins & Apps, PHP scripts, & more!
 

Premium Resources

521Threads
783Messages
191Members
LikeeeLatest member
Back
Top