• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Amount kill

Use an on kill event, set storage value of +1 for the x creature killed :)
You could do a quest check within the on kill event to see if there is an active quest and if you meet the kill count you could send a message to the player go and collect the reward.
 
like this ??
Code:
local storage = 38742
local m = demon
function onKill(cid, target)
     if getPlayerStorageValue(cid, storage) >= 0 and getPlayerStorageValue(cid, storage) <= 100 then
         setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
     end
     if getPlayerStorageValue(cid, m) == 100 then
        doPlayerAddItem(cid,7791,1)
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed 100 monsters, the double experience has ended.")
     end
     return true
end
 
Yes, if it shouldn't start at storage value 0, remove that part.
Code:
getPlayerStorageValue(cid, storage) >= 0 and

Change <= 100 to < 100 or < 99, depense on if it starts at -1 or 0.
 
its no work its don't give me any erro and don't work
Code:
local storage = 38742
local m = demon
function onKill(cid, target)
     if  getPlayerStorageValue(cid, storage) <= 10 then
         setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
     end
     if getPlayerStorageValue(cid, m) == 10 then
        doPlayerAddItem(cid,7791,1)
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed 100 monsters, the double experience has ended.")
     end
     return true
end
 
Change if getPlayerStorageValue(cid, m) == 10 then to
Code:
if getPlayerStorageValue(cid, storage) == 10 then
And remove: local m = demon

If it should only work for demons, you can add this under function onKill.
Code:
if isPlayer(target) or getCreatureName(target):lower() ~= "demon" then
     return true
end
 
its wok for one time like if i kiled 100 demon i will get reward but when try to kill 100 dragon i don't get rawad i need when kill 100 fom monster get reward
 
Then you can use something like this, but then without npcstorage and with reward.
http://otland.net/threads/npc-mission.211063/#post-2022378
Code:
local config = {
     ['demon'] = {amount = 100, storage = 19000, reward = {7791, 1}},
     ['dragon'] = {amount = 100, storage = 19001, reward = {2112, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end

     if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         doPlayerAddItem(cid, monster.reward[1], monster.reward[2])
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     return true
end
 
erorr
qWj_ZLZm.png
 
The isSummon is to prevent that people kill their own summons.
You can add the function in your function lib file.
http://otland.net/threads/npc-mission.211063/page-3#post-2095223

Talkaction.
Code:
local config = {
     ['Demon'] = {amount = 100, storage = 19000, reward = {7791, 1}},
     ['Dragon'] = {amount = 100, storage = 19001, reward = {2680, 10}}
}

function onSay(cid, words, param)
     local text = "Monster Kill Rewards\n"
     for m, x in pairs(config) do
         local info = getItemInfo(x.reward[1])
         text = text .."\n"..m.." - ["..(getPlayerStorageValue(cid, x.storage)+1).."/"..x.amount.."] Reward: "..(x.reward[2] > 1 and x.reward[2] or info.article).." "..(x.reward[2] > 1 and info.plural or info.name)..""
     end
     doShowTextDialog(cid, 2112, text)
     return true
end
 
The isSummon is to prevent that people kill their own summons.
You can add the function in your function lib file.
http://otland.net/threads/npc-mission.211063/page-3#post-2095223

Talkaction.
Code:
local config = {
     ['Demon'] = {amount = 100, storage = 19000, reward = {7791, 1}},
     ['Dragon'] = {amount = 100, storage = 19001, reward = {2680, 10}}
}

function onSay(cid, words, param)
     local text = "Monster Kill Rewards\n"
     for m, x in pairs(config) do
         local info = getItemInfo(x.reward[1])
         text = text .."\n"..m.." - ["..(getPlayerStorageValue(cid, x.storage)+1).."/"..x.amount.."] Reward: "..(x.reward[2] > 1 and x.reward[2] or info.article).." "..(x.reward[2] > 1 and info.plural or info.name)..""
     end
     doShowTextDialog(cid, 2112, text)
     return true
end

work fine thx rep

-----____________________________
more one script that script give me chance to unlock outfit when kill x monster
chance = 20%
just unlock first addon
 
You can basicly do the same thing as here, but then without amount and instead of item reward the outfit from that addon.
Function you can use.
Code:
doPlayerAddOutfitId(cid, outfitId, addon)
For the 20% chance you can use math.random(1, 5).
Code:
if math.random(1, 5) == 1 then

Then you can use something like this, but then without npcstorage and with reward.
http://otland.net/threads/npc-mission.211063/#post-2022378
Code:
local config = {
     ['demon'] = {amount = 100, storage = 19000, reward = {7791, 1}},
     ['dragon'] = {amount = 100, storage = 19001, reward = {2112, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end

     if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         doPlayerAddItem(cid, monster.reward[1], monster.reward[2])
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     return true
end
 
Yes, that is what I explained, you can try it, when you have problems post the script.
You can set storage after the player received the addon, then check for that storage so it won't get it again.
 
Last edited:
somthing liek this ?
Code:
local config = {
     ['demon'] = {amount = 10, storage = 19000, reward = {7791, 1}},
     ['dragon'] = {amount = 10, storage = 19001, reward = {2112, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end

     if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         doPlayerAddItem(cid, monster.reward[1], monster.reward[2])
         end
         if math.random(1, 5) == 1 then
         doPlayerAddOutfitId(cid, 288, 2)
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     return true
end
 
It should be after 1 kill right? Then amount is not needed, also items if not needed if it shouldn't give an item as reward.
For the storage you only have to do this.
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
Then after getting the outfit.
Code:
setPlayerStorageValue(cid, monster.storage, 1)
The function doPlayerAddOutfitId works with outfit id, not the looktype, you can find the ids in outfits.xml.
 
It should be after 1 kill right? Then amount is not needed, also items if not needed if it shouldn't give an item as reward.
For the storage you only have to do this.
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
Then after getting the outfit.
Code:
setPlayerStorageValue(cid, monster.storage, 1)
The function doPlayerAddOutfitId works with outfit id, not the looktype, you can find the ids in outfits.xml.
so it will be like this ??
Code:
local config = {
     ['demon'] = {amount = 10, storage = 19554, reward = {7791, 1}},
     ['dragon'] = {amount = 10, storage = 19001, reward = {2112, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end

     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         doPlayerAddItem(cid, monster.reward[1], monster.reward[2])
         end
         if math.random(1, 5) == 1 then
         doPlayerAddOutfitId(cid, 20, 2)
         setPlayerStorageValue(cid, monster.storage, 1)
     end
     return true
end
 
Back
Top