Ir para conteúdo

Ajuda Com Npc Grizzly Adams


dotatibia

Posts Recomendados

Bom galera... eu tenho esse script de task...

 

O que eu preciso:

 

1:Eu gostaria que ao invés de matar os monstros eu tivesse que pegar uma certa quantidade de itens para completar a task.

2: Eu gostaria que quando completasse a task ganhasse um STORAGE ID, para eu usar em futuras quests...

 

SCRIPT DO NPC

local tasks = 
{ 
       [1] = {questStarted = 1510, questStorage = 65000, killsRequired = 30, raceName = "Rotworms", rewards = {first = {enable = true, type = "exp", values = 1000}, second = {enable = true, type = "money", values = 1000}, third = {enable = false, type = nil, values = {nil, nil}}}},
} 

local storage = 64521 

local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {} 
local voc = {} 

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) 

       local s = getPlayerStorageValue(cid, storage) 

       if(not npcHandler:isFocused(cid)) then 
               return false 
       end 
       local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid 
       if msgcontains(msg, 'task') then 

               if(s < 1) then 
                       doPlayerSetStorageValue(cid, storage, 1) 
               end 

               if tasks[s] then 
                       if(getPlayerStorageValue(cid, tasks[s].questStarted) < 1) then 
                               if(getPlayerStorageValue(cid, tasks[s].creatureStorage) < 0) then 
                                       doPlayerSetStorageValue(cid, tasks[s].creatureStorage, 0) 
                               end 

                               if(getPlayerStorageValue(cid, tasks[s].questStorage) < 0) then 
                                       doPlayerSetStorageValue(cid, tasks[s].questStorage, 0) 
                               end 

                               doPlayerSetStorageValue(cid, tasks[s].questStarted, 1) 
                               selfSay('You have started the task number ' .. getPlayerStorageValue(cid, storage) .. ', in this task you need to kill ' .. tasks[s].killsRequired .. ' ' .. tasks[s].raceName .. '.', cid) 
                       else 
                               selfSay('You are currently making task about ' .. tasks[s].raceName .. '.', cid) 
                       end 
               else 
                       print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.") 
               end 

       elseif msgcontains(msg, 'report') then 
               if tasks[s] and tasks[s].questStarted > 0 then 
                       if(getPlayerStorageValue(cid, tasks[s].creatureStorage) < 0) then 
                               doPlayerSetStorageValue(cid, tasks[s].creatureStorage, 0) 
                       end 

                       if(getPlayerStorageValue(cid, tasks[s].questStorage) < 0) then 
                               doPlayerSetStorageValue(cid, tasks[s].questStorage, 0) 
                       end 

                       if(getPlayerStorageValue(cid, tasks[s].questStorage) >= tasks[s].killsRequired) then 
                               selfSay('Great!... you have finished the task number ' .. s .. '. Good job.', cid) 
                               doPlayerSetStorageValue(cid, storage, s + 1) 
                               if(tasks[s].rewards.first.enable) then 
                                       if(tasks[s].rewards.first.type == "boss") then 
                                               doTeleportThing(cid, tasks[s].rewards.first.values) 
                                       elseif(tasks[s].rewards.first.type == "exp") then 
                                               doPlayerAddExperience(cid, tasks[s].rewards.first.values) 
                                       elseif(tasks[s].rewards.first.type == "item") then 
                                               doPlayerAddItem(cid, tasks[s].rewards.first.values[1], tasks[s].rewards.first.values[2]) 
                                       elseif(tasks[s].rewards.first.type == "money") then 
                                               doPlayerAddMoney(cid, tasks[s].rewards.first.values) 
                                       elseif(tasks[s].rewards.first.type == "storage") then 
                                               doPlayerSetStorageValue(cid, tasks[s].rewards.first.values[1], tasks[s].rewards.first.values[2]) 
                                       end 
                               end 
                               if(tasks[s].rewards.second.enable) then 
                                       if(tasks[s].rewards.second.type == "boss") then 
                                               doTeleportThing(cid, tasks[s].rewards.second.values) 
                                       elseif(tasks[s].rewards.second.type == "exp") then 
                                               doPlayerAddExperience(cid, tasks[s].rewards.second.values) 
                                       elseif(tasks[s].rewards.second.type == "item") then 
                                               doPlayerAddItem(cid, tasks[s].rewards.second.values[1], tasks[s].rewards.second.values[2]) 
                                       elseif(tasks[s].rewards.second.type == "money") then 
                                               doPlayerAddMoney(cid, tasks[s].rewards.second.values) 
                                       elseif(tasks[s].rewards.second.type == "storage") then 
                                               doPlayerSetStorageValue(cid, tasks[s].rewards.second.values[1], tasks[s].rewards.second.values[2]) 
                                       end 
                               end 
                               if(tasks[s].rewards.third.enable) then 
                                       if(tasks[s].rewards.third.type == "boss") then 
                                               doTeleportThing(cid, tasks[s].rewards.third.values) 
                                       elseif(tasks[s].rewards.third.type == "exp") then 
                                               doPlayerAddExperience(cid, tasks[s].rewards.third.values) 
                                       elseif(tasks[s].rewards.third.type == "item") then 
                                               doPlayerAddItem(cid, tasks[s].rewards.third.values[1], tasks[s].rewards.third.values[2]) 
                                       elseif(tasks[s].rewards.third.type == "money") then 
                                               doPlayerAddMoney(cid, tasks[s].rewards.third.values) 
                                       elseif(tasks[s].rewards.third.type == "storage") then 
                                               doPlayerSetStorageValue(cid, tasks[s].rewards.third.values[1], tasks[s].rewards.third.values[2]) 
                                       end 
                               end                           
                       else 
                               selfSay('Current ' .. getPlayerStorageValue(cid, tasks[s].questStorage) .. ' ' .. tasks[s].raceName .. ' killed, you need to kill ' .. tasks[s].killsRequired .. '.', cid) 
                       end 
               else 
                       selfSay('You do not have started any task.', cid) 
               end 
       end 
       return true 
end 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new()) 

 

SCRIPT DO CREATURESCRIPT ( CASO PRECISE...)

 

function onKill(cid, target, lastHit) 

local questCreatures = 
{ 
       ["rotworm"] = {questStarted = 1510, questStorage = 65000, creatureStorage = 15000, killsRequired = 30, raceName = "Rotworms"},
} 

local creature = questCreatures[getCreatureName(target)] 

       if creature then 
               if(isPlayer(target) == true) then 
                       return true 
               end 
               if getPlayerStorageValue(cid, creature.questStarted) > 0 then 
                       if getPlayerStorageValue(cid, creature.questStorage) < creature.killsRequired then 
                               if getPlayerStorageValue(cid, creature.questStorage) < 0 then 
                                       doPlayerSetStorageValue(cid, creature.questStorage, 0) 
                               end 

                               if getPlayerStorageValue(cid, creature.creatureStorage) < 0 then 
                                       doPlayerSetStorageValue(cid, creature.creatureStorage, 0) 
                               end 
                               doPlayerSetStorageValue(cid, creature.questStorage, getPlayerStorageValue(cid, creature.questStorage) + 1) 
                               doPlayerSetStorageValue(cid, creature.creatureStorage, getPlayerStorageValue(cid, creature.creatureStorage) + 1) 
                               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getPlayerStorageValue(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".") 
                       end 
               end 
       end 
       return true 
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...