Hello,
i would like to present my new script, `Daily Missions`, written for 0.3.6pl1.
HOW IT WORKS:
Each day player can ask NPC for a mission, then he will get task for random monster (based on player lv), when he complete the task (kill enough monsters), then he can back to that NPC and finish it, recive expedience and x% chance for an item.
NPC SCRIPT:
(Example will be below)
creaturescripts.xml
login.lua
dailycounter.lua
talkaction for check current mission status:
globalevents.xml
daliy.lua
It will just simply reset everyone daily at 23:59. (If server didnt work on midnight, daily will not be restarted!)
How to set config
In each daily u have a numbers, EX: 1-30, that says players with level 1 to 30 can recive those monsters as a daily mission,
then you have:
Name = monster name
storage = keeps your mission, for every daily must be diffrent (exactly its just a Value of storage (2423))
count = number of monsters that you must defeat
exp = how much experience player recive
item = ID of item that player can recive
icount = count of that item
chance = a chance to recive item
And just put same config to every script, and it will works.
Hope someone enjoy my script, i work very hard on this one, ive made it to myself so sorry for mess.
Greetz,
Erexo.
i would like to present my new script, `Daily Missions`, written for 0.3.6pl1.
HOW IT WORKS:
Each day player can ask NPC for a mission, then he will get task for random monster (based on player lv), when he complete the task (kill enough monsters), then he can back to that NPC and finish it, recive expedience and x% chance for an item.
NPC SCRIPT:
Lua:
local daily1 = { --1-30
{["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
{["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75}
}
local daily2 = { --31-70
{["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
{["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68}
}
local daily3 = { --71-100
{["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
{["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73}
}
local daily4 = { --101-150
{["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
{["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65}
}
local daily5 = { --151-200
{["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73},
{["name"] = "Nukenin", ["storage"] = 27, ["count"] = 50, ["exp"] = 1500000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 77}
}
local daily6 = { --201-250
{["name"] = "Nukenin", ["storage"] = 30, ["count"] = 70, ["exp"] = 2000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 71},
{["name"] = "Akatsuki Memember", ["storage"] = 31, ["count"] = 40, ["exp"] = 3000000, ["item"] = 2160, ["icount"] = 6, ["chance"] = 73}
}
local daily7 = { --251-300
{["name"] = "Akatsuki Memember", ["storage"] = 34, ["count"] = 70, ["exp"] = 6000000, ["item"] = 2160, ["icount"] = 10, ["chance"] = 65},
{["name"] = "Samurai Master", ["storage"] = 35, ["count"] = 60, ["exp"] = 4000000, ["item"] = 2160, ["icount"] = 12, ["chance"] = 66}
}
local daily8 = { --301-350
{["name"] = "Rikudou Patch", ["storage"] = 38, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
{["name"] = "Black Samurai [King]", ["storage"] = 39, ["count"] = 30, ["exp"] = 7000000, ["item"] = 2160, ["icount"] = 15, ["chance"] = 77}
}
local daily11 = { --351-400
{["name"] = "Rikudou Patch", ["storage"] = 61, ["count"] = 70, ["exp"] = 8000000, ["item"] = 2160, ["icount"] = 14, ["chance"] = 73},
{["name"] = "Black Samurai [King]", ["storage"] = 62, ["count"] = 50, ["exp"] = 8500000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 70}
}
local daily9 = { --401-500
{["name"] = "Black Samurai [King]", ["storage"] = 41, ["count"] = 50, ["exp"] = 9000000, ["item"] = 2160, ["icount"] = 16, ["chance"] = 71},
{["name"] = "Black Samurai [King]", ["storage"] = 42, ["count"] = 70, ["exp"] = 11000000, ["item"] = 2160, ["icount"] = 18, ["chance"] = 73}
}
local daily10 = { --500+
{["name"] = "Heaven Guardian", ["storage"] = 46, ["count"] = 50, ["exp"] = 13000000, ["item"] = 2160, ["icount"] = 25, ["chance"] = 90},
{["name"] = "Heaven Guardian", ["storage"] = 47, ["count"] = 70, ["exp"] = 15000000, ["item"] = 2160, ["icount"] = 27, ["chance"] = 76},
{["name"] = "Bug", ["storage"] = 52, ["count"] = 100, ["exp"] = 10000000, ["item"] = 1691, ["icount"] = 1, ["chance"] = 100}
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--Branie Daily
if(msgcontains(msg, 'mission') or msgcontains(msg, 'daily')) then
if getPlayerStorageValue(cid,2423) <= 1 then
if getPlayerLevel(cid) <= 30 then
rand = math.random(1, #daily1)
for i = 1, #daily1 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily1[i].count .. ' ' .. daily1[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily1[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 30 and getPlayerLevel(cid) <= 70 then
rand = math.random(1, #daily2)
for i = 1, #daily2 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily2[i].count .. ' ' .. daily2[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily2[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 70 and getPlayerLevel(cid) <= 100 then
rand = math.random(1, #daily3)
for i = 1, #daily3 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily3[i].count .. ' ' .. daily3[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily3[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 100 and getPlayerLevel(cid) <= 150 then
rand = math.random(1, #daily4)
for i = 1, #daily4 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily4[i].count .. ' ' .. daily4[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily4[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 150 and getPlayerLevel(cid) <= 200 then
rand = math.random(1, #daily5)
for i = 1, #daily5 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily5[i].count .. ' ' .. daily5[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily5[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 200 and getPlayerLevel(cid) <= 250 then
rand = math.random(1, #daily6)
for i = 1, #daily6 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily6[i].count .. ' ' .. daily6[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily6[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 250 and getPlayerLevel(cid) <= 300 then
rand = math.random(1, #daily7)
for i = 1, #daily7 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily7[i].count .. ' ' .. daily7[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily7[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 300 and getPlayerLevel(cid) <= 350 then
rand = math.random(1, #daily8)
for i = 1, #daily8 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily8[i].count .. ' ' .. daily8[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily8[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 350 and getPlayerLevel(cid) <= 400 then
rand = math.random(1, #daily11)
for i = 1, #daily11 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily11[i].count .. ' ' .. daily11[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily11[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 400 and getPlayerLevel(cid) <= 500 then
rand = math.random(1, #daily9)
for i = 1, #daily9 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily9[i].count .. ' ' .. daily9[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily9[i].storage)
talkState[talkUser] = 0
end
end
elseif getPlayerLevel(cid) > 500 then
rand = math.random(1, #daily10)
for i = 1, #daily10 do
if rand == i then
selfSay('Your mission today is to kill ' .. daily10[i].count .. 'x ' .. daily10[i].name .. '\'s. Back when you end.', cid)
setPlayerStorageValue(cid,2423,daily10[i].storage)
talkState[talkUser] = 0
end
end
end
end
if getPlayerStorageValue(cid,2423) == 100 then
selfSay('You have complete today mission! Back tomorrow!', cid)
talkState[talkUser] = 0
end
--Oddanie Daily Questa
for i = 1, #daily1 do
if getPlayerStorageValue(cid,2423) == daily1[i].storage then
if getPlayerStorageValue(cid,2425) >= daily1[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily1[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily1[i].chance then
doPlayerAddItem(cid,daily1[i].item,daily1[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily1[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily2 do
if getPlayerStorageValue(cid,2423) == daily2[i].storage then
if getPlayerStorageValue(cid,2425) >= daily2[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily2[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily2[i].chance then
doPlayerAddItem(cid,daily2[i].item,daily2[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily2[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily3 do
if getPlayerStorageValue(cid,2423) == daily3[i].storage then
if getPlayerStorageValue(cid,2425) >= daily3[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily3[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily3[i].chance then
doPlayerAddItem(cid,daily3[i].item,daily3[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily3[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily4 do
if getPlayerStorageValue(cid,2423) == daily4[i].storage then
if getPlayerStorageValue(cid,2425) >= daily4[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily4[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily4[i].chance then
doPlayerAddItem(cid,daily4[i].item,daily4[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily4[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily5 do
if getPlayerStorageValue(cid,2423) == daily5[i].storage then
if getPlayerStorageValue(cid,2425) >= daily5[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily5[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily5[i].chance then
doPlayerAddItem(cid,daily5[i].item,daily5[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily5[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily6 do
if getPlayerStorageValue(cid,2423) == daily6[i].storage then
if getPlayerStorageValue(cid,2425) >= daily6[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily6[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily6[i].chance then
doPlayerAddItem(cid,daily6[i].item,daily6[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily6[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily7 do
if getPlayerStorageValue(cid,2423) == daily7[i].storage then
if getPlayerStorageValue(cid,2425) >= daily7[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily7[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily7[i].chance then
doPlayerAddItem(cid,daily7[i].item,daily7[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily7[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily8 do
if getPlayerStorageValue(cid,2423) == daily8[i].storage then
if getPlayerStorageValue(cid,2425) >= daily8[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily8[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily8[i].chance then
doPlayerAddItem(cid,daily8[i].item,daily8[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily8[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily9 do
if getPlayerStorageValue(cid,2423) == daily9[i].storage then
if getPlayerStorageValue(cid,2425) >= daily9[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily9[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily9[i].chance then
doPlayerAddItem(cid,daily9[i].item,daily9[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily9[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily10 do
if getPlayerStorageValue(cid,2423) == daily10[i].storage then
if getPlayerStorageValue(cid,2425) >= daily10[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily10[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily10[i].chance then
doPlayerAddItem(cid,daily10[i].item,daily10[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily10[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
for i = 1, #daily11 do
if getPlayerStorageValue(cid,2423) == daily11[i].storage then
if getPlayerStorageValue(cid,2425) >= daily11[i].count then
selfSay('Exelent! You done today mission.', cid)
doPlayerAddExp(cid,daily11[i].exp)
setPlayerStorageValue(cid,2423,100)
if math.random(1,100) <= daily11[i].chance then
doPlayerAddItem(cid,daily11[i].item,daily11[i].icount)
end
talkState[talkUser] = 0
else
selfSay('You have dont killed enought ' .. daily11[i].name .. '\'s.', cid)
talkState[talkUser] = 0
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
creaturescripts.xml
XML:
<event type="kill" name="dailycounter" script="dailycounter.lua"/>
login.lua
Lua:
registerCreatureEvent(cid, "dailycounter")
dailycounter.lua
Lua:
local config = {
{["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
{["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
{["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
{["name"] = "Elite Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 90},
{["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
{["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 90},
{["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
{["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
{["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 70},
{["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 70},
{["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
{["name"] = "Elite Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 70},
{["name"] = "Young Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
{["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
{["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
{["name"] = "Elite Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 80},
{["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Young Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 70},
{["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
{["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 70},
{["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 70},
{["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 75},
{["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 70}
}
function onKill(cid, target, lastHit)
if lastHit == true then
if(isPlayer(target) ~= TRUE) then
local master = getCreatureMaster(target)
if(master and master ~= target) then return TRUE end
for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(cid, 2423) == config[i].storage then
setPlayerStorageValue(cid, 2425, getPlayerStorageValue(cid, 2425) + 1)
if config[i].name == "Black Fowler" then
if getPlayerStorageValue(cid, 2425) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed Fowler [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 2425) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last Fowler, go back to NPC and report.")
end
else
if getPlayerStorageValue(cid, 2425) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 2425) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Daily Quest: You have killed last " .. config[i].name .. ", go back to NPC and report.")
end
end
end
end
end
end
return TRUE
end
end
talkaction for check current mission status:
Lua:
local config = {
{["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
{["name"] = "Snake", ["storage"] = 6, ["count"] = 20, ["exp"] = 3000, ["item"] = 2152, ["icount"] = 15, ["chance"] = 75},
{["name"] = "Bandit", ["storage"] = 7, ["count"] = 30, ["exp"] = 25000, ["item"] = 2152, ["icount"] = 30, ["chance"] = 92},
{["name"] = "Fat Ninja", ["storage"] = 8, ["count"] = 30, ["exp"] = 26000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 89},
{["name"] = "Onbaa", ["storage"] = 9, ["count"] = 30, ["exp"] = 30000, ["item"] = 2152, ["icount"] = 35, ["chance"] = 91},
{["name"] = "Assassin", ["storage"] = 10, ["count"] = 30, ["exp"] = 75000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 67},
{["name"] = "Cursed Wolf", ["storage"] = 11, ["count"] = 30, ["exp"] = 95000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 68},
{["name"] = "Cursed Skeleton", ["storage"] = 12, ["count"] = 30, ["exp"] = 130000, ["item"] = 2152, ["icount"] = 60, ["chance"] = 71},
{["name"] = "Vampire", ["storage"] = 13, ["count"] = 30, ["exp"] = 170000, ["item"] = 2152, ["icount"] = 70, ["chance"] = 75},
{["name"] = "Cyborg", ["storage"] = 14, ["count"] = 30, ["exp"] = 90000, ["item"] = 2152, ["icount"] = 50, ["chance"] = 76},
{["name"] = "Kyokushin", ["storage"] = 15, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 78},
{["name"] = "Monk", ["storage"] = 16, ["count"] = 50, ["exp"] = 300000, ["item"] = 2152, ["icount"] = 100, ["chance"] = 79},
{["name"] = "Stranger", ["storage"] = 17, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 75},
{["name"] = "Kyokushin",["storage"] = 18, ["count"] = 60, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 73},
{["name"] = "Sound Shinobi", ["storage"] = 19, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 71},
{["name"] = "Stranger", ["storage"] = 20, ["count"] = 30, ["exp"] = 350000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 77},
{["name"] = "Zombie", ["storage"] = 21, ["count"] = 30, ["exp"] = 370000, ["item"] = 2160, ["icount"] = 1, ["chance"] = 78},
{["name"] = "Mutated", ["storage"] = 22, ["count"] = 30, ["exp"] = 550000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 85},
{["name"] = "Samurai", ["storage"] = 23, ["count"] = 40, ["exp"] = 650000, ["item"] = 2160, ["icount"] = 2, ["chance"] = 65},
{["name"] = "Ice Monster", ["storage"] = 24, ["count"] = 40, ["exp"] = 750000, ["item"] = 2160, ["icount"] = 3, ["chance"] = 68},
{["name"] = "Elite Samurai", ["storage"] = 25, ["count"] = 40, ["exp"] = 1000000, ["item"] = 2160, ["icount"] = 4, ["chance"] = 74},
{["name"] = "Elite Samurai", ["storage"] = 26, ["count"] = 50, ["exp"] = 1100000, ["item"] = 2160, ["icount"] = 5, ["chance"] = 73}
}
function onSay(cid, words, param)
local pos = getPlayerPosition(cid)
if getPlayerStorageValue(cid,2423) <= 1 then
doPlayerSendTextMessage(cid, 20,"You doesnt started any mission today.")
end
for i = 1, #config do
if getPlayerStorageValue(cid,2423) == config[i].storage then
if getPlayerStorageValue(cid,2425) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed [" .. getPlayerStorageValue(cid, 2425) .. " / " .. config[i].count.."] " .. config[i].name .. "\'s.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Reward: " .. config[i].exp .. " experience points and " .. config[i].chance .. "% chance to recive " .. config[i].icount .. "x " .. getItemNameById(config[i].item) .. "\'s.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed enough " .. config[i].name .. "\'s, go back to NPC.")
end
end
end
if getPlayerStorageValue(cid,2423) == 100 then
doPlayerSendTextMessage(cid, 20,"You have done a mission today")
end
return 1
end
globalevents.xml
XML:
<globalevent name="daily" time="23:59" event="script" value="daily.lua"/>
daliy.lua
Lua:
function onTimer()
db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2423, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 1')
db.executeQuery('INSERT IGNORE INTO `player_storage` SELECT `id`, 2425, 1 FROM `players` WHERE `online` = 0 ON DUPLICATE KEY UPDATE `value` = 0')
local a = getPlayersOnline()
for b = 1, #a do
doCreatureSetStorage(a[b], 2423, 1)
doCreatureSetStorage(a[b], 2425, 0)
end
return true
end
How to set config
In each daily u have a numbers, EX: 1-30, that says players with level 1 to 30 can recive those monsters as a daily mission,
then you have:
Lua:
{["name"] = "Wolf", ["storage"] = 5, ["count"] = 20, ["exp"] = 2000, ["item"] = 2152, ["icount"] = 10, ["chance"] = 75},
storage = keeps your mission, for every daily must be diffrent (exactly its just a Value of storage (2423))
count = number of monsters that you must defeat
exp = how much experience player recive
item = ID of item that player can recive
icount = count of that item
chance = a chance to recive item
And just put same config to every script, and it will works.
Hope someone enjoy my script, i work very hard on this one, ive made it to myself so sorry for mess.
Greetz,
Erexo.
Last edited: