• 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

3688599

Darkness-babek.no-ip.org
Joined
Mar 23, 2013
Messages
92
Reaction score
12
Location
EGYPT
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 =...

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,810
Solutions
432
Reaction score
3,946
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
OP
OP
3688599

3688599

Darkness-babek.no-ip.org
Joined
Mar 23, 2013
Messages
92
Reaction score
12
Location
EGYPT
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
 
Top