Ir para conteúdo

Featured Replies

Postado

Opa! Estou precisando muito alterar esse script, para contar a morte e dar storage para todos que ajudarem a matar o monstro pra fazer tasks em dupla ou mais gente, do jeito que está só 1 ta pegando a storage. MUITO OBRIGADO MESMO!

 

function onKill(player, target, lastHit)
    if target:isPlayer() or target:getMaster() then
        return true
    end

    local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks()
    for i = 1, #startedTasks do
        taskId = startedTasks
        if isInArray(tasks[taskId].creatures, targetName) then
            local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
            if killAmount < tasks[taskId].killsRequired then
                player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
            end
        end
    end
    return true
end

 

Editado por onix (veja o histórico de edições)

  • Respostas 8
  • Visualizações 678
  • Created
  • Última resposta

Top Posters In This Topic

Postado

tenta tirar a parte do lastHit .

deixar 

function onKill(player, target)

 

vai q da certo kk 

Se o mundo é mesmo parecido com o que vejo,

Prefiro acreditar no mundo do meu jeito.

( - Renato Russo)

Postado
function onKill(player, target, cid)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks()
    for i = 1, #startedTasks do
        taskId = startedTasks
        if isInArray(tasks[taskId].creatures, targetName) then
            local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
            if killAmount < tasks[taskId].killsRequired then
                player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
            end
        end
    end
    return true
end

 

asdukeeh.jpg

Postado
  • Autor
Em 16/05/2016 at 10:28, DukeeH disse:

function onKill(player, target, cid) if target:isPlayer() or target:getMaster() then return true end local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks() for i = 1, #startedTasks do taskId = startedTasks if isInArray(tasks[taskId].creatures, targetName) then local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId) if killAmount < tasks[taskId].killsRequired then player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1) end end end return true end

Obrigado por ajudar amigo @Dukeeh mas deu esse erro:

 

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/quests/killing in the name of/kills.lua:onKill
...escripts/scripts/quests/killing in the name of/kills.lua:8: attempt to index field '?' (a nil value)
stack traceback:
    [C]: in function '__index'
    ...escripts/scripts/quests/killing in the name of/kills.lua:8: in function <...escripts/scripts/quests/killing in the name of/kills.lua:1>

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo