FurabioWhy be a king.. when you can be a godFConde
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino
04 de junho de 2015 às 15:29
Olá galera, gostaria de pedir um npc de promotion que funciona desse jeito:
1° O player vai no npc de promotion que promove por task, fala com ele, dai ele vai cobrar 25kk para da a task ao player.
2° Após ele ter pago os 25kk ele receberá a seguinte missão, exemplo matar 500 demon, 500 hydra, 4 bosses de nomes diferentes (configurável), a cada criatura matada vai mostrando por exemplo "Você matou 10/500 demons".
3° Após a task ser completada, automaticamente ou ele vá até o npc, ele será promovido a vocação X, com a seguinte mensagem "Parabéns, Você agora é um Supremo."
Agradeço desde já!
Npc :
local Config = {
Monsters = {
-- ["Name"] = {amount = quantidade}
["Demon"] = {amount = 30},
["Hydra"] = {amount = 10},
},
StoragePro = 54661, -- Não mexer se não souber editar
Money = 100 -- Dinheiro
}
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
local msg = msg:lower()
local release = talkState[talkUser]
if msgcontains(msg, "mission") then
if getPlayerStorageValue(cid, Config.StoragePro) < 1 then
selfSay("A missão para promovido custa " .. Config.Money .. " você aceita fazer ?", cid)
release = 1
elseif getPlayerStorageValue(cid, Config.StoragePro) == (2 + #Config.Monsters) then
selfSay("Você já cumpriu a missão peça pra ser {promovido}.", cid)
release = 2
elseif getPlayerStorageValue(cid, Config.StoragePro) == (3 + #Config.Monsters) then
selfSay("Voce já terminou as missões, pode ir em embora!", cid)
release = 0
end
elseif msgcontains(msg, "yes") and release == 1 then
if doPlayerRemoveMoney(cid, Config.Money) then
local text = ""
for monsters, v in pairs(Config.Monsters) do
txt = txt .. ", "
txt = txt .. v.amount .. " {" .. monsters .. "}"
end
npcHandler:say("A missão é matar esses monstros para mim" .. text .. ".", cid)
for i, _ in pairs(Config.Monsters) do
setPlayerStorageValue(cid, i, 0)
end
setPlayerStorageValue(cid, Config.StoragePro, 1)
release = 0
else
selfSay("Você não tem money suficiente!", cid)
release = 0
end
elseif msgcontains(msg, "no") and release == 2 then
selfSay("Até logo!", cid)
release = 0
end
if msgcontains(msg, "lista") and getPlayerStorageValue(cid, Config.StoragePro) < (#Config.Monster + 3) then
local text, n = "", 0
for monsters, v in pairs(Config.Monsters) do
local sto = getPlayerStorageValue(cid, monsters)
if sto < v.amount then
n = n + 1
text = text .. ", "
text = text .. (tostring(sto) < tostring(1) and v.amount or (tostring(v.amount) - tostring(sto))) .. " {" .. monsters .. "}"
end
end
text = text:sub(3)
if n > 1 then
selfSay("Para terminar sua missão você ainda tem que matar esses monstros : " .. text, cid)
release = 0
elseif n == 1 then
selfSay("Você só tem mais um monstro à matar : " .. text, cid)
release = 0
else
selfSay("Você já terminou de matar os monstro que lhe pedi, agora sim tu é digno de ser {promovido}.", cid)
release = 2
end
elseif msgcontains(msg, "promovido") and release == 2 then
selfSay("Aqui está sua promoção jovem soldado!!", cid)
setPlayerVocation(cid, (getPlayerVocation(cid) + 4))
setPlayerStorageValue(cid, Config.StoragePro, (#Config.Monsters + 3))
-- Para deixar em utilizavel a storage para outras coisas
for monsters, _ in pairs(Config.Monsters) do
setPlayerStorageValue(cid, monsters, -1)
end
release = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
NPC.XML :
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aldo" script="arquivo.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Olá |PLAYERNAME|, para você ser promoivido precisa passar por uma {mission}, para de uma olhada no que fazer diga {lista} ."/>
</parameters>
</npc>
creaturescripts :
local Config = {
Monsters = {
-- ["Name"] = {amount = quantidade}
["Demon"] = {amount = 30},
["Hydra"] = {amount = 10},
},
StoragePro = 54661, -- Não mexer se não souber editar
Money = 100 -- Dinheiro
}
function onKill(cid, target)
if not isMonster(target) and getPlayerStorageValue(cid, Config.StoragePro) >= (2 + #Config.StoragePro) then
return false
end
local monster = Config.Monsters[getCreatureName(target):lower]
if monster then
local sto = getPlayerStorageValue(cid, monster)
if sto < (monster.amount - 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task message: [" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. ".")
setPlayerStorageValue(cid, monster, (sto + 1))
elseif sto == (monster.amount - 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations!! you have killed" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. "s ands and completed the task.")
setPlayerStorageValue(cid, monster, (sto + 1))
setPlayerStorageValue(cid, Config.StoragePro, (getPlayerStorageValue(cid, Config.StoragePro) + 1))
end
end
return true
end
function onLogin(cid)
registerCreatureEvent('taskNpc')
return true
end
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino
Npc :
local Config = { Monsters = { -- ["Name"] = {amount = quantidade} ["Demon"] = {amount = 30}, ["Hydra"] = {amount = 10}, }, StoragePro = 54661, -- Não mexer se não souber editar Money = 100 -- Dinheiro } 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 local msg = msg:lower() local release = talkState[talkUser] if msgcontains(msg, "mission") then if getPlayerStorageValue(cid, Config.StoragePro) < 1 then selfSay("A missão para promovido custa " .. Config.Money .. " você aceita fazer ?", cid) release = 1 elseif getPlayerStorageValue(cid, Config.StoragePro) == (2 + #Config.Monsters) then selfSay("Você já cumpriu a missão peça pra ser {promovido}.", cid) release = 2 elseif getPlayerStorageValue(cid, Config.StoragePro) == (3 + #Config.Monsters) then selfSay("Voce já terminou as missões, pode ir em embora!", cid) release = 0 end elseif msgcontains(msg, "yes") and release == 1 then if doPlayerRemoveMoney(cid, Config.Money) then local text = "" for monsters, v in pairs(Config.Monsters) do txt = txt .. ", " txt = txt .. v.amount .. " {" .. monsters .. "}" end npcHandler:say("A missão é matar esses monstros para mim" .. text .. ".", cid) for i, _ in pairs(Config.Monsters) do setPlayerStorageValue(cid, i, 0) end setPlayerStorageValue(cid, Config.StoragePro, 1) release = 0 else selfSay("Você não tem money suficiente!", cid) release = 0 end elseif msgcontains(msg, "no") and release == 2 then selfSay("Até logo!", cid) release = 0 end if msgcontains(msg, "lista") and getPlayerStorageValue(cid, Config.StoragePro) < (#Config.Monster + 3) then local text, n = "", 0 for monsters, v in pairs(Config.Monsters) do local sto = getPlayerStorageValue(cid, monsters) if sto < v.amount then n = n + 1 text = text .. ", " text = text .. (tostring(sto) < tostring(1) and v.amount or (tostring(v.amount) - tostring(sto))) .. " {" .. monsters .. "}" end end text = text:sub(3) if n > 1 then selfSay("Para terminar sua missão você ainda tem que matar esses monstros : " .. text, cid) release = 0 elseif n == 1 then selfSay("Você só tem mais um monstro à matar : " .. text, cid) release = 0 else selfSay("Você já terminou de matar os monstro que lhe pedi, agora sim tu é digno de ser {promovido}.", cid) release = 2 end elseif msgcontains(msg, "promovido") and release == 2 then selfSay("Aqui está sua promoção jovem soldado!!", cid) setPlayerVocation(cid, (getPlayerVocation(cid) + 4)) setPlayerStorageValue(cid, Config.StoragePro, (#Config.Monsters + 3)) -- Para deixar em utilizavel a storage para outras coisas for monsters, _ in pairs(Config.Monsters) do setPlayerStorageValue(cid, monsters, -1) end release = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())NPC.XML :
<?xml version="1.0" encoding="UTF-8"?> <npc name="Aldo" script="arquivo.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|, para você ser promoivido precisa passar por uma {mission}, para de uma olhada no que fazer diga {lista} ."/> </parameters> </npc>creaturescripts :
local Config = { Monsters = { -- ["Name"] = {amount = quantidade} ["Demon"] = {amount = 30}, ["Hydra"] = {amount = 10}, }, StoragePro = 54661, -- Não mexer se não souber editar Money = 100 -- Dinheiro } function onKill(cid, target) if not isMonster(target) and getPlayerStorageValue(cid, Config.StoragePro) >= (2 + #Config.StoragePro) then return false end local monster = Config.Monsters[getCreatureName(target):lower] if monster then local sto = getPlayerStorageValue(cid, monster) if sto < (monster.amount - 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task message: [" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. ".") setPlayerStorageValue(cid, monster, (sto + 1)) elseif sto == (monster.amount - 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations!! you have killed" .. (sto + 1) .. "/" .. monster.amount .. "] of " .. getCreatureName(target) .. "s ands and completed the task.") setPlayerStorageValue(cid, monster, (sto + 1)) setPlayerStorageValue(cid, Config.StoragePro, (getPlayerStorageValue(cid, Config.StoragePro) + 1)) end end return true end function onLogin(cid) registerCreatureEvent('taskNpc') return true endtag :