Nerevr back
Member
- Joined
- Nov 7, 2014
- Messages
- 269
- Reaction score
- 7
there way to get scipt for when kill x monster get reward ??
x = number "100"
x = number "100"
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
getPlayerStorageValue(cid, storage) >= 0 and
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
if getPlayerStorageValue(cid, storage) == 10 then
if isPlayer(target) or getCreatureName(target):lower() ~= "demon" then
return true
end
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
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
doPlayerAddOutfitId(cid, outfitId, addon)
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
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
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
setPlayerStorageValue(cid, monster.storage, 1)
so it will be like this ??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.
Then after getting the outfit.Code:if getPlayerStorageValue(cid, monster.storage) ~= 1 then
The function doPlayerAddOutfitId works with outfit id, not the looktype, you can find the ids in outfits.xml.Code:setPlayerStorageValue(cid, monster.storage, 1)
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