Ir para conteúdo
  • 0

[Resolvido] [Saga System] Script pedir uma storage antes de transformar


LeoTK

Pergunta

Fala guys será que alguém pode me ajudar a editar o script saga para transformar gostaria que ele pedisse level e storage igual ele pede a id da outfit ou sejá que ficasse configuravel no caso toda vez que ele mudar a transformar necessitar de uma storage

 

local saga = {[1] = {[1] = 71, [2] = 66, [3] = 91, [4] = 18, [5] = 31, [6] = 92, [7] = 40, [8] = 49, [9] = 25, [10] = 179, [11] = 952, [12] = 951, [13] = 291, [14] = 302, [15] = 487, [16] = 54, [17] = 743, [18] = 1000, [19] = 1001, [20] = 954, [21] = 955, [22] = 953, effect = 111}, --[Vocation] = {[1] = Roupa, effect = Efeito da transformação}[2] = {[1] = 64, effect = 10} --TESTE}local level = 36 -- Limite para liberar uma saga novafunction onSay(cid, words, param, channel) if(param == '') then  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")  return true endif not saga[getPlayerVocation(cid)] thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")return trueendlocal t = string.explode(param, ",") if(t[2]) then  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")  return true end if not (tonumber(t[1])) then  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")  return true endif tonumber(t[1]) > #saga[getPlayerVocation(cid)] or tonumber(t[1]) < 1  thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")return trueendif getPlayerLevel(cid) >= (tonumber(t[1])*level) thendoSetCreatureOutfit(cid, {lookType = saga[getPlayerVocation(cid)][tonumber(t[1])]}, -1)doSendMagicEffect(getThingPos(cid), saga[getPlayerVocation(cid)].effect)doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")doPlayerSay(cid, "Saga!!", TALKTYPE_ORANGE_1)elsedoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, voce precisa de level "..(tonumber(t[1]) * level).." usar essa saga.")endreturn trueend

no caso ficando assim

 

local saga = {
[1] = {[1] = roupa, level, storage [2] = 66, [3] = 91, [4] = 18, [5] = 31, [6] = 92, [7] = 40, [8] = 49, [9] = 25, [10] = 179, [11] = 952, [12] = 951, [13] = 291, [14] = 302, [15] = 487, [16] = 54, [17] = 743, [18] = 1000, [19] = 1001, [20] = 954, [21] = 955, [22] = 953, effect = 111},

--[Vocation] = {[1] = Level, Storage, Roupa,effect = Efeito da transformação}

Ele vai verificar a vocação o level ai se o player tem a storage caso tiver tudo isso ele muda a roupa fazendo o efeito só precisava dessa alteração

 

se alguém puder me ajudar a fazer isso ficarei extremamente agradecido

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

Posts Recomendados

  • 0
Agora, Nogard disse:

não tá aumentando o maxhealth/mana?

não só ta dando mana e life como se fosse cura sabe como se tivesse usado um pot mesmo efeito para voce entender

Link para o comentário
Compartilhar em outros sites

  • 0

então, mas deveria:

 

  setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + transform.mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

 

 

tenta dessa forma:

 

 

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentefunction onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, transform.storage) < 0 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(t[1]) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, transform.storage) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)                    setPlayerStorageValue(cid, transform.storage, tonumber(t[1]))      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[t[1]].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[t[1]].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

@edit

 

se ter mais algum problema, vou fazer questão de testar xD

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

  • 0
26 minutos atrás, Nogard disse:

então, mas deveria:

 

  setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + transform.health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + transform.mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

 

 

tenta dessa forma:

 

 

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentefunction onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, transform.storage) < 0 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(t[1]) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, transform.storage) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)                    setPlayerStorageValue(cid, transform.storage, tonumber(t[1]))      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[t[1]].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[t[1]].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

@edit

 

se ter mais algum problema, vou fazer questão de testar xD

bom 

 

[26/06/2017 21:36:47] [Error - TalkAction Interface] 

[26/06/2017 21:36:47] data/talkactions/scripts/sagatran.lua:onSay

[26/06/2017 21:36:47] Description: 

[26/06/2017 21:36:47] data/talkactions/scripts/sagatran.lua:69: attempt to index field '?' (a nil value)

[26/06/2017 21:36:47] stack traceback:

[26/06/2017 21:36:47]     data/talkactions/scripts/sagatran.lua:69: in function <data/talkactions/scripts/sagatran.lua:3>

 

Link para o comentário
Compartilhar em outros sites

  • 0

Pronto, funcional.

 

é onde você precisa setar o valor ao ensinar nova saga:

 

storageLearned = 2931,

 

se o cara vai adquirir a saga 3, VALOR = 3. Isso indicaria que ele tem todas as sagas inferiores (1, 2).

 

setPlayerStorageValue(cid, saga.storageLearned, VALOR)

 

Aqui é setado a transformação atual, não altere:

 

storageTransf = 2930

 

 

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentesaga = {    [1] = {{outfit = 71, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},     effect = 111,     storageLearned = 2931,     storageTransf = 2930     }function onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end            local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, saga.storageLearned) < tonumber(t[1]) then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(tonumber(t[1])) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, saga.storageTransf) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].health)                 setPlayerStorageValue(cid, saga.storageTransf, tonumber(t[1]))         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, saga.storageTransf) )      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[tonumber(t[1])].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[tonumber(t[1])].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

 

@edit

Se você quiser colocar a lib em um arquivo separado, tudo bem. Mas repare que ela foi alterada, copie do jeito que ta aí.

 

@edit2 esqueci de remover algumas coisas.

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

  • 0
1 hora atrás, Nogard disse:

Pronto, funcional.

 

é onde você precisa setar o valor ao ensinar nova saga:

 

storageLearned = 2931,

 

se o cara vai adquirir a saga 3, VALOR = 3. Isso indicaria que ele tem todas as sagas inferiores (1, 2).

 

setPlayerStorageValue(cid, saga.storageLearned, VALOR)

 

Aqui é setado a transformação atual, não altere:

 

storageTransf = 2930

 

 

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentesaga = {    [1] = {{outfit = 71, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},     effect = 111,     storageLearned = 2931,     storageTransf = 2930     }function onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end            local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, saga.storageLearned) < tonumber(t[1]) then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(tonumber(t[1])) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, saga.storageTransf) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].health)                 setPlayerStorageValue(cid, saga.storageTransf, tonumber(t[1]))         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, saga.storageTransf) )      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[tonumber(t[1])].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[tonumber(t[1])].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

 

@edit

Se você quiser colocar a lib em um arquivo separado, tudo bem. Mas repare que ela foi alterada, copie do jeito que ta aí.

 

@edit2 esqueci de remover algumas coisas.

o problema é que eu preciso de 1 storage para cada transformação para poder colocar na saga porque cada um é uma missão diferente tendeu

Link para o comentário
Compartilhar em outros sites

  • 0

isso você mesmo poderia alterar, but:

 

    if getPlayerStorageValue(cid, transform.storage) < 1 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end

 

 

e você vai precisar configurar o resto:

 

 

saga = {    [1] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},     effect = 111,     storageTransf = 2930     }

 

 

 

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentesaga = {    [1] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}},     [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},     effect = 111,     storageTransf = 2930     }function onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end            local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, transform.storage) < 1 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(tonumber(t[1])) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, saga.storageTransf) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].health)                 setPlayerStorageValue(cid, saga.storageTransf, tonumber(t[1]))         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, saga.storageTransf) )      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[tonumber(t[1])].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[tonumber(t[1])].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

Link para o comentário
Compartilhar em outros sites

  • 0

talkactions.xml:

 

 <talkaction log="yes" words="!saga" event="script" value="transform.lua"/>

 

 

talkactions/scripts/transform.lua:

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentesaga = {    [1] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},-- configurar storage     effect = 111,     storageTransf = 2930     }function onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end            local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, transform.storage) < 1 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(tonumber(t[1])) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, saga.storageTransf) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].health)                 setPlayerStorageValue(cid, saga.storageTransf, tonumber(t[1]))         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, saga.storageTransf) )      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[tonumber(t[1])].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[tonumber(t[1])].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

 [VOCAÇÃO ID] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},                               /\saga 1                                                  /\ (,)separador               /\ saga2                                     /\ fim desse índice (})

 

 

!saga número da saga, para funcionar.

Link para o comentário
Compartilhar em outros sites

  • 0
9 horas atrás, Nogard disse:

talkactions.xml:

 

 <talkaction log="yes" words="!saga" event="script" value="transform.lua"/>

 

 

talkactions/scripts/transform.lua:

 

local cooldownzin = 3 -- em segundos para esperar a talkaction novamentesaga = {    [1] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},    [2] = {{outfit = 66, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [3] = {{outfit = 91, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [4] = {{outfit = 18, level = 36, mana = 2000, health = 3000}, {outfit = 71, level = 36, mana = 2000, health = 3000}}, -- configurar storage    [5] = {{outfit = 31, level = 36,  mana = 2000, health = 3000},{outfit = 71, level = 36, mana = 2000, health = 3000}},-- configurar storage     effect = 111,     storageTransf = 2930     }function onSay(cid, words, param, channel)local sagaTransformacao = saga[getPlayerVocation(cid)]        if(param == '') then --                                                                                   *caso nao digite o numero        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end            local t = string.explode(param, ",")    local transform = sagaTransformacao[tonumber(t[1])]        if not sagaTransformacao then --                                                                                    *caso saga diferente        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode trocar de saga.")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerLevel(cid) < transform.level then --                                                                *caso nao tenha level correspondente a transformacao        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem level ".. transform.level .. ".")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true     end         if getPlayerStorageValue(cid, transform.storage) < 1 then                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce ainda nao completou a saga")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end        if getPlayerStorageValue(cid, 5432) >= os.time() then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode usar ainda, espere ".. getPlayerStorageValue(cid, 5432) - os.time() .." segundos. ")        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)        return true    end         if (t[2]) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Could not understand.")        return true    end            if not (tonumber(t[1])) then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o numero da saga que voce deseja.")        return true    end                if tonumber(t[1]) > #sagaTransformacao or tonumber(tonumber(t[1])) < 1 then        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa saga nao existe.")        return true    end            if  tonumber(t[1]) ~= getPlayerStorageValue(cid, saga.storageTransf) then        -- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "param = " .. tonumber(t[1]) .. "\nstorage = " .. getPlayerStorageValue(cid, sagaTransformacao.storage))           -- doCreatureAddMana(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].mana)           -- doCreatureAddHealth(cid, - sagaTransformacao[getPlayerStorageValue(cid, transform.storage)].health)            setCreatureMaxMana(cid, getCreatureMaxMana(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].mana)             setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - sagaTransformacao[getPlayerStorageValue(cid, saga.storageTransf)].health)                 setPlayerStorageValue(cid, saga.storageTransf, tonumber(t[1]))         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,getPlayerStorageValue(cid, saga.storageTransf) )      doSetCreatureOutfit(cid, {lookType = transform.outfit}, -1)     doSendMagicEffect(getThingPos(cid), transform.effect)    doPlayerSendTextMessage(cid, 25, "Voce escolheu uma nova saga!")   doCreatureSay(cid, "Saga!!", TALKTYPE_ORANGE_1)     setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + sagaTransformacao[tonumber(t[1])].health)    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + sagaTransformacao[tonumber(t[1])].mana)      doCreatureAddMana(cid, getCreatureMaxMana(cid))       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))        setPlayerStorageValue(cid, 5432, os.time() + cooldownzin)                else                  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já está transformado nessa saga.")                 end                                                                                           return trueend

 

 

 [VOCAÇÃO ID] = {{outfit = 71, level = 36, storage = 2221,  mana = 2000, health = 3000}, {outfit = 71, level = 36, storage = 2222, mana = 4000, health = 4000}},                               /\saga 1                                                  /\ (,)separador               /\ saga2                                     /\ fim desse índice (})

 

 

!saga número da saga, para funcionar.

NOSGARD PERFEITO SEU LINDO VLW

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...