• 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!

Error boss reward

El Man

«لَا إِلَٰهَ إِلَّا ٱللَّٰهُ»
Joined
Mar 23, 2013
Messages
161
Reaction score
33
I need kill boss and get loot in my bag

I use this script but ddint work
Lua:
local config = {
    ["Royal King "] = {
        loot = {{302,100,1},{2157,20,10},{8900,5,1},{5958,10,1},{2471,12,1},{6132,18,1}},
        message = "Congratulations for defeating [Boss] Curselich, Your reward is now in your backpack",
        BagId = 1988
    }
}
--[[
["NameOfMonster"] = {
  loot = {{itemid,chance,count},{itemid,chance,count}},
  message = "Message produced when you kill the boss",
  BagId = dont need explanation
  }
]]

function onKill(player, target)
    if isPlayer() and target:isMonster() then
        local monster = config[Creature(target):getName()]
        local bag = doPlayerAddItem(monster.BagId, 1)
      
        if monster then
            for i = 1,#monster.loot do
                if monster.loot[i][2] >= math.random(1,100) then
                    doPlayerAddItem(monster.loot[i][1], monster.loot[i][3], INDEX_WHEREEVER, FLAG_NOLIMIT)
                end
            end
          
            doPlayerSendTextMessage(22, monster.message)
        end
    end
    return true
end
 
Solution
i try it with anymonster like rotworm or etc and dosent work ;/
no and i use OTX

<event type="kill" name="Bosskill" event="script" value="Bosskill.lua"/>
Have you registered the event in login.lua? data/creaturescripts/scripts/login.lua

If yes, make sure the script is installed correctly, by green-texting everything and simply printing to the console.
Lua:
--[[
local config = {
    ["Royal King "] = {
        loot = {{302,100,1},{2157,20,10},{8900,5,1},{5958,10,1},{2471,12,1},{6132,18,1}},
        message = "Congratulations for defeating [Boss] Curselich, Your reward is now in your backpack",
        BagId = 1988
    }
}

["NameOfMonster"] = {
    loot = {{itemid,chance,count},{itemid,chance,count}},
    message =...
Have you tried with lower case monster name?
And also do you get any error in console?
i try it with anymonster like rotworm or etc and dosent work ;/
no and i use OTX

<event type="kill" name="Bosskill" event="script" value="Bosskill.lua"/>
 
i try it with anymonster like rotworm or etc and dosent work ;/
no and i use OTX

<event type="kill" name="Bosskill" event="script" value="Bosskill.lua"/>
Have you registered the event in login.lua? data/creaturescripts/scripts/login.lua

If yes, make sure the script is installed correctly, by green-texting everything and simply printing to the console.
Lua:
--[[
local config = {
    ["Royal King "] = {
        loot = {{302,100,1},{2157,20,10},{8900,5,1},{5958,10,1},{2471,12,1},{6132,18,1}},
        message = "Congratulations for defeating [Boss] Curselich, Your reward is now in your backpack",
        BagId = 1988
    }
}

["NameOfMonster"] = {
    loot = {{itemid,chance,count},{itemid,chance,count}},
    message = "Message produced when you kill the boss",
    BagId = dont need explanation
    }
]]

function onKill(player, target)
    print("The onKill event 'Bosskill.lua' is installed correctly.")
    --if isPlayer() and target:isMonster() then
    --    local monster = config[Creature(target):getName()]
    --    local bag = doPlayerAddItem(monster.BagId, 1)
    --
    --    if monster then
    --        for i = 1,#monster.loot do
    --            if monster.loot[i][2] >= math.random(1,100) then
    --                doPlayerAddItem(monster.loot[i][1], monster.loot[i][3], INDEX_WHEREEVER, FLAG_NOLIMIT)
    --            end
    --        end
    --   
    --        doPlayerSendTextMessage(22, monster.message)
    --    end
    --end
    return true
end

If the above code works, and prints to the console when you kill a monster..
Come back and let us know, so we can continue troubleshooting.
 
Solution
Have you registered the event in login.lua? data/creaturescripts/scripts/login.lua

If yes, make sure the script is installed correctly, by green-texting everything and simply printing to the console.
Lua:
--[[
local config = {
    ["Royal King "] = {
        loot = {{302,100,1},{2157,20,10},{8900,5,1},{5958,10,1},{2471,12,1},{6132,18,1}},
        message = "Congratulations for defeating [Boss] Curselich, Your reward is now in your backpack",
        BagId = 1988
    }
}

["NameOfMonster"] = {
    loot = {{itemid,chance,count},{itemid,chance,count}},
    message = "Message produced when you kill the boss",
    BagId = dont need explanation
    }
]]

function onKill(player, target)
    print("The onKill event 'Bosskill.lua' is installed correctly.")
    --if isPlayer() and target:isMonster() then
    --    local monster = config[Creature(target):getName()]
    --    local bag = doPlayerAddItem(monster.BagId, 1)
    --
    --    if monster then
    --        for i = 1,#monster.loot do
    --            if monster.loot[i][2] >= math.random(1,100) then
    --                doPlayerAddItem(monster.loot[i][1], monster.loot[i][3], INDEX_WHEREEVER, FLAG_NOLIMIT)
    --            end
    --        end
    --  
    --        doPlayerSendTextMessage(22, monster.message)
    --    end
    --end
    return true
end

If the above code works, and prints to the console when you kill a monster..
Come back and let us know, so we can continue troubleshooting.
Thank you man <3 its work
 
Back
Top