Ir para conteúdo
  • 0

[PEDIDO] modificaçao desse script


Josegvb

Pergunta

olá o script esta funfando perfeitamente porem tem algumas coisas q estao faltando e o autor esta muito ocupado pra me ajudar :/ entao alguem me ajuda ai pfv 

modifacaçao que eu quero:

1º queria mudar o script pra ele perguntar pra a pessoa se quizer aceitar a task pq no momento você só falta o nome do bixo pra matar e ele fala qt estao faltando mas nao faz entregue da task, alias vc nao pega... só conta mesmo se vc nao tivese pegado

2º queria que ele tivese um COUNTER alias q quando matase o bixo, aparesça "0000 Mounstros restantes pra finalizar sua task." pq no momento vc n sabe qt falta pra finalizar ;/:

3º ele ta entregando a exp, mas nao esta aparescendo aquele txt animado da exp q vc ta pegando, alias simplemente adiciona a exp no seu char de um jeito invisivel

 

o script:

funçao onkill

Spoiler

function onKill(cid, target)

local configs = {
{name = "War Gyarados", storage = 10294},
{name = "War Heracross", storage = 10295}
}

for _, t in ipairs(configs) do

if getCreatureName(target) == t.name then
if getPlayerStorageValue(cid, t.storage) < 0 then
setPlayerStorageValue(cid, t.storage, 1)
else
setPlayerStorageValue(cid, t.storage, getPlayerStorageValue(cid, t.storage) + 1)
return true
end
end

end

return true
end

 

script do npc:

Spoiler

local configs = {
{word = "War Gyarados", itemid = 0, itemcount = 0, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 10294, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "War Heracross", itemid = 0, itemcount = 0, money = 0, rewardid = 15589, rewardcount = 20, rewardexp = 10000000, storageid = 5455, storagevalue = os.time() + 1*24*60*60, storagerequest = 10295, valuerequest = 1000, text = "Congratulations! You finished this task. In 24h, you will be able to do it again."};
{word = "xxx", itemid = xxx, itemcount = xxx, money = xxx, rewardid = xxx, rewardcount = xxx, rewardexp = xxx, storageid = xxx, storagevalue = xxx, storagerequest = xxx, valuerequest = xxx, text = "xxx"};
}
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
for _, npc in ipairs(configs) do
    if(msgcontains(msg, ''..npc.word..'')) then
              if getPlayerStorageValue(cid, npc.storageid) < os.time() then
              if getPlayerStorageValue(cid, npc.storagerequest) >= npc.valuerequest then
              doPlayerAddItem(cid, npc.rewardid, npc.rewardcount)
              setPlayerStorageValue(cid, npc.storagerequest, getPlayerStorageValue(cid, npc.storagerequest) - npc.valuerequest)     
              setPlayerStorageValue(cid, npc.storageid, npc.storagevalue)
              doPlayerAddExperience(cid, npc.rewardexp)
              selfSay(''..npc.text..'', cid)   
    talkState[talkUser] = 0  
              else
              selfSay('You need to kill '..(npc.valuerequest - getPlayerStorageValue(cid, npc.storagerequest))..' '..npc.word..' to gain a reward.')
    talkState[talkUser] = 0  
              end
              else
              selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, npc.storageid) - os.time())/(60*60))..' hours to do it again.', cid)
    talkState[talkUser] = 0  
              end
              end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 tomara q alguem me ajude ;..; valeu

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0
36 minutos atrás, Drazyn1291 disse:

 

link ta errado, você testou o script com + de 1 task? pq como eu disse, ele ta pegando a primeira sem problema mas as outras nao pega, testei refazer as tabelas e vi td la certinho, trokei o brave venusaur pro 2º e deixei o Furious Ampharos de 1º,  ai o npc começou a pegar o Furious Ampharos e ignorar o brave venusaur e thief da tabela

Link para o comentário
Compartilhar em outros sites

  • 0

teria como me falar se voce testou as tasks com + de 1 bixo? ^^ pra eu testar o script denovo do 0, pois cmg ta funfando só com o 1º bixo, se coloca + na lista nem pega os dos outros apenas o primeiro, entao se com vc funfou pra + de 1 entao blz o erro esta em min

3 horas atrás, Drazyn1291 disse:

 

Editado por Josegvb
Link para o comentário
Compartilhar em outros sites

  • 0
8 horas atrás, Josegvb disse:

teria como me falar se voce testou as tasks com + de 1 bixo? ^^ pra eu testar o script denovo do 0, pois cmg ta funfando só com o 1º bixo, se coloca + na lista nem pega os dos outros apenas o primeiro, entao se com vc funfou pra + de 1 entao blz o erro esta em min

 

pronto! Dei uma ajeitada no script e concertei o que estava faltando!

 

Npc:

 

local tasksss = {   [1] = {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},   [2] = {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},}local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    value = -1    for i = 1, #tasksss do        if msgcontains(msg, tasksss[i].name) and not value ~= -1 then            value = i        end    end    if value == -1 then        selfSay('I don\'t have a this task!', cid)        talkState[talkUser] = 0        return true    end    local configss = tasksss[value]    local name = configss.name    local m_sto = configss.sto    local time_sto = configss.time_sto    local count_sto = configss.sto_count    local total_count = configss.count    local rest = total_count - getPlayerStorageValue(cid, count_sto)        if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo            if getPlayerStorageValue(cid, m_sto) <= 0 then -- verifica se o player não pegou está task                selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)                setPlayerStorageValue(cid, m_sto, 1)                setPlayerStorageValue(cid, total_count, 0)                talkState[talkUser] = 0                           else                if rest <= 0 then -- Verifica se o player matou todos os monstros nescessários                    doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)                    setPlayerStorageValue(cid, count_sto, 0)                     setPlayerStorageValue(cid, m_sto, -1)                     setPlayerStorageValue(cid, time_sto, os.time() + configss.time)                    doPlayerAddExperience(cid, configss.rewardexp)                    doSendAnimatedText(getCreaturePosition(cid), configss.rewardexp, 215)                    selfSay(configss.text, cid)                     talkState[talkUser] = 0                else                    selfSay('You need to kill '..rest..' '..name..' to gain a reward.', cid)                    talkState[talkUser] = 0                end            end        else            selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)            talkState[talkUser] = 0        endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Kill:

 

local tasksss = {   {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},   {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},}function onKill(cid, target)        for _, t in ipairs(tasksss) do            local total_count = t.count            local m_sto = t.sto            local count_sto = t.sto_count            if getPlayerStorageValue(cid, m_sto) ~= -1 then                if getCreatureName(target) == t.name then                	if (total_count - getPlayerStorageValue(cid, count_sto)) == 1 then                		setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                    	doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." " .. t.name .. " and finished the task!")                    	return true                    elseif (total_count - getPlayerStorageValue(cid, count_sto)) >= 1 then                        setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                        doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." of ".. total_count .." " .. t.name .. " kills to finish the task.")                        return true                    end                end            end        end    return trueend

Testei com mais de um monstro configurado na tabela funcionou! Está mandando mensagem de quando termina a task e quantos faltam e quando fala com o npc e o mostro não está na tabela, o npc diz que não tem essa task!

Link para o comentário
Compartilhar em outros sites

  • 0
5 horas atrás, Drazyn1291 disse:

pronto! Dei uma ajeitada no script e concertei o que estava faltando!

 

Npc:

 

local tasksss = {   [1] = {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},   [2] = {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},}local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)    if(not npcHandler:isFocused(cid)) then        return false    end    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    value = -1    for i = 1, #tasksss do        if msgcontains(msg, tasksss[i].name) and not value ~= -1 then            value = i        end    end    if value == -1 then        selfSay('I don\'t have a this task!', cid)        talkState[talkUser] = 0        return true    end    local configss = tasksss[value]    local name = configss.name    local m_sto = configss.sto    local time_sto = configss.time_sto    local count_sto = configss.sto_count    local total_count = configss.count    local rest = total_count - getPlayerStorageValue(cid, count_sto)        if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo            if getPlayerStorageValue(cid, m_sto) <= 0 then -- verifica se o player não pegou está task                selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)                setPlayerStorageValue(cid, m_sto, 1)                setPlayerStorageValue(cid, total_count, 0)                talkState[talkUser] = 0                           else                if rest <= 0 then -- Verifica se o player matou todos os monstros nescessários                    doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)                    setPlayerStorageValue(cid, count_sto, 0)                     setPlayerStorageValue(cid, m_sto, -1)                     setPlayerStorageValue(cid, time_sto, os.time() + configss.time)                    doPlayerAddExperience(cid, configss.rewardexp)                    doSendAnimatedText(getCreaturePosition(cid), configss.rewardexp, 215)                    selfSay(configss.text, cid)                     talkState[talkUser] = 0                else                    selfSay('You need to kill '..rest..' '..name..' to gain a reward.', cid)                    talkState[talkUser] = 0                end            end        else            selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)            talkState[talkUser] = 0        endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())

Kill:

 

local tasksss = {   {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},   {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},}function onKill(cid, target)        for _, t in ipairs(tasksss) do            local total_count = t.count            local m_sto = t.sto            local count_sto = t.sto_count            if getPlayerStorageValue(cid, m_sto) ~= -1 then                if getCreatureName(target) == t.name then                	if (total_count - getPlayerStorageValue(cid, count_sto)) == 1 then                		setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                    	doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." " .. t.name .. " and finished the task!")                    	return true                    elseif (total_count - getPlayerStorageValue(cid, count_sto)) >= 1 then                        setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)                        doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." of ".. total_count .." " .. t.name .. " kills to finish the task.")                        return true                    end                end            end        end    return trueend

Testei com mais de um monstro configurado na tabela funcionou! Está mandando mensagem de quando termina a task e quantos faltam e quando fala com o npc e o mostro não está na tabela, o npc diz que não tem essa task!

daeeeeew agora sim viu kkkkkkkk :D eu fikei batendo a cabeça na parede pq achei q tava fazendo alguma coisa errada ;/: 

valeu querido, se tiver 1 chance me ajuda com o meu login no script das botinhas =x servidor ficou crashando mt 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...