ZL

Quests por actions

Por zllcapiroto, 13 de out. de 2020 em Scripts

4
1.2k
zllcapirotoZ
13 de outubro de 2020 às 18:24

Boa tarde.
Uso um TFS 1.3 e nao queria ter que fazer varios scripts de quests, gostaria de colocar todos em um.
Alguém poderia me ajudar com um script por actions que eu coloque várias quests?
Por exemplo, eu coloco o UNIQ ID no RME = 2020.

O script teria que ser basicamente assim:

Item id = 2195, Level da Quest = 40, UniqueID = 2020. ("Nome da Quest = BoH").
Item id = XXXX, Level da Quest = XX, UniqueID = XX. 
e assim sucessivamente...

Caso a pessoa clique no objeto com o uniqueID e tenha level igual ou superior ao level da quest, exiba a mensagem ("Parabéns, você encontrou o(a) (ID do item, ou nome).

Caso não tenha level, exiba ("Você não tem level suficiente").


Obrigado!!

Editado Outubro 13 por zllcapiroto

NysmanN
14 de outubro de 2020 às 18:12

function onUse(cid, item)

local t = {
{uid=36667, storage=15354, recompensa=11447, mensagem="Parabéns, você ganhou uma Fire Stone."}, 
{uid=36668, storage=15354, recompensa=11441, mensagem="Parabéns, você ganhou uma Leaf Stone."},
{uid=36669, storage=15354, recompensa=11442, mensagem="Parabéns, você ganhou uma Water Stone."},
}

if item.uid == t[1].uid and getPlayerStorageValue(cid, t[1].storage) == -1 then
doPlayerAddItem(cid, t[1].recompensa, 1)
doPlayerSendTextMessage(cid, 22, t[1].mensagem)
setPlayerStorageValue(cid, t[1].storage, 1)

elseif item.uid == t[2].uid and getPlayerStorageValue(cid, t[2].storage) == -1 then
doPlayerAddItem(cid, t[2].recompensa, 1)
doPlayerSendTextMessage(cid, 22, t[2].mensagem)
setPlayerStorageValue(cid, t[2].storage, 1)

elseif item.uid == t[3].uid and getPlayerStorageValue(cid, t[3].storage) == -1 then
doPlayerAddItem(cid, t[3].recompensa, 1)
doPlayerSendTextMessage(cid, 22, t[3].mensagem)
setPlayerStorageValue(cid, t[3].storage, 1)

end
return doPlayerSendCancel(cid, "Você ja fez esta quest.")
end

Editado Outubro 14 por Nysman

Tenta assim...

DeadpoolD
14 de outubro de 2020 às 18:18
4 minutos atrás, Nysman disse:

Impossível fazer isso, hehehe.

quem disse?

 

em actions/scripts. questsSystem.lua:

local rewardConfig = {
  --ACTIONS ID /// -- premios
    [1300] = {2511, 1}, {2227, 1}, {2148, 55},
    [1301] = {2511, 1}, {2227, 1}, {2148, 55},
    [1302] = {2511, 1}, {2227, 1}, {2148, 55},
    [1303] = {2511, 1}, {2227, 1}, {2148, 55}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemType = ItemType(item.uid)
    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()

    if itemType:getId() == 0 then
        return false
    end

    local lootBag = player:addItem(1987, 1)
    local config = rewardConfig[item.actiondid]
    if player:getStorageValue(item.actiondid) == -1 then
        for i = 1, #config do
            lootBag:addItem(config[i][1], config[i][2])
        end
        player:setStorageValue(item.actiondid, 1)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end
return true
end

em actions IDS, é o msm do actions .xml, e o msm que vc coloca no map editor, nos baus

NysmanN
14 de outubro de 2020 às 18:29
10 minutos atrás, Deadpool disse:

quem disse?

 

em actions/scripts. questsSystem.lua:

local rewardConfig = {
  --ACTIONS ID /// -- premios
    [1300] = {2511, 1}, {2227, 1}, {2148, 55},
    [1301] = {2511, 1}, {2227, 1}, {2148, 55},
    [1302] = {2511, 1}, {2227, 1}, {2148, 55},
    [1303] = {2511, 1}, {2227, 1}, {2148, 55}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemType = ItemType(item.uid)
    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()

    if itemType:getId() == 0 then
        return false
    end

    local lootBag = player:addItem(1987, 1)
    local config = rewardConfig[item.actiondid]
    if player:getStorageValue(item.actiondid) == -1 then
        for i = 1, #config do
            lootBag:addItem(config[i][1], config[i][2])
        end
        player:setStorageValue(item.actiondid, 1)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end
return true
end

em actions IDS, é o msm do actions .xml, e o msm que vc coloca no map editor, nos baus

Eu tinha entendido errado o script que ele queria.