Ir para conteúdo

Featured Replies

Postado
  • Autor

Pelo menos o Jobs tentou ajudar, em vez de ficar apontando o dedo e movendo os tópicos...

 

Não sei a função de fazer checagem sem remover o item... Alguém pelo menos tem algo parecido pra que eu possa ter uma base?


atualizado:

 

Erros:

RpNLNpt.png

 

Scripts:

elanecrossbowchange

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)




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 player = Player(cid)


if (not npcHandler:isFocused(cid)) then
return false
end


if isInArray({"change", "bolt"}, msg:lower()) then
        npcHandler:say('Do you want to trade 2500 power bolts for my crossbow?', cid)
        npcHandler.topic[cid] = 1


elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then


local trade = {
    {NeedItem = 2547, Ncount = 2500, GiveItem = 5947, Gcount = 1}, -- Crossbow
}


        if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
return npcHandler:say(msg,'Here you are')
        else
            npcHandler:say('Sorry but you don\'t have the item', player)
        end


elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
npcHandler:say(msg,'Ok then', player)
npcHandler.topic[cid] = 0
npcHandler:releaseFocus(cid)
end
return true
end


local function onTradeRequest(cid)
TradeRequest(cid, npcHandler, getTable(), BlueDjinn, 4)
end


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

 

gregdamagedsteelhelmet

local t = {
    item = {5930, 100}, -- ID do item e quantidade necessária.
    segitem = {5741, 1},
    reward = 5924 -- Item que irá ganhar.
}
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 player = Player(cid)


if (not npcHandler:isFocused(cid)) then
return false
end


if isInArray({"change"}, msg:lower()) then
        npcHandler:say('Do you want to trade 100 behemoth claws and 1 skull helmet for damaged steel helmet?', cid)
        npcHandler.topic[cid] = 1


elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then


local trade = {
    {NeedItem = 5930, Ncount = 100, segNeedItem = 5741, segNcount = 1, GiveItem = 5924, Gcount = 1},
}


        if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount and player:getItemCount(trade[npcHandler.topic[cid]].segNeedItem) >= trade[npcHandler.topic[cid]].segNcount then
            player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
            player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
            return npcHandler:say(msg,'Here you are')
        else
            npcHandler:say('Sorry but you don\'t have the item', player)
        end


elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
npcHandler:say(msg,'Ok then', player)
npcHandler.topic[cid] = 0
npcHandler:releaseFocus(cid)
end
return true
end


local function onTradeRequest(cid)
TradeRequest(cid, npcHandler, getTable(), BlueDjinn, 4)
end


npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
  • Respostas 5
  • Visualizações 370
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tente assim     Crossbow   você pode usar nos 2 casos, apenas mudar os ids o script é configurável. 

  • local t = { item = {7636, 2500}, -- ID do item e quantidade necessária. reward = 5957 -- Item que irá ganhar. } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(k

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.6k

Informação Importante

Confirmação de Termo