Ir para conteúdo
  • Cadastre-se

(Resolvido)Spells


Ir para solução Resolvido por ScythePhantom,

Posts Recomendados

Olá, gostaria de pedir uma talkaction que funcionasse da seguinte maneira, o player iria falar !spells e apareceriam as informações de todas as spells do servidor, exemplo:

 

Exana mort:

Level: 8

Ml: 8

Mana: 20

Vocação: Knight, Elite Knight.

 

P.S. Editar a action do spellbook de forma semelhante:

 

ACTION:

function onUse(cid, item, fromPosition, itemEx, toPosition)


local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, item.itemid, text)
return TRUE
end

 

Obrigado, REP+

Link para o post
Compartilhar em outros sites
  • Moderador
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
spell.soul = getInstantSpellInfoByName(cid, soul)
spell.voc = getInstantSpellInfoByName(cid, vocationid)
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " Palavra chave:" .. spell.words .. " - Nome da spell: " .. spell.name .. " Mana: " .. spell.mana .. " Soul:".. spell.soul .." Voc:".. spell.voc .."\n"
end
doShowTextDialog(cid, item.itemid, text)
return TRUE
end
Editado por Vinicius Xxgamexx (veja o histórico de edições)

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Link para o post
Compartilhar em outros sites
function onUse(cid, item, fromPosition, itemEx, toPosition)local count = getPlayerInstantSpellCount(cid)local text = ""local t = {}for i = 0, count - 1 dolocal spell = getPlayerInstantSpellInfo(cid, i)if spell.level ~= 0 thenif spell.manapercent > 0 thenspell.mana = spell.manapercent .. "%"spell.soul = getInstantSpellInfoByName(cid, soul)spell.voc = getInstantSpellInfoByName(cid, vocationid)endtable.insert(t, spell)endendtable.sort(t, function(a, b) return a.level < b.level end)local prevLevel = -1for i, spell in ipairs(t) dolocal line = ""if prevLevel ~= spell.level thenif i ~= 1 thenline = "\n"endline = line .. "Spells for Level " .. spell.level .. "\n"prevLevel = spell.levelendtext = text .. line .. " Palavra chave:" .. spell.words .. " - Nome da spell: " .. spell.name .. " Mana: " .. spell.mana .. " Soul:".. spell.soul .." Voc:".. spell.voc .."\n"enddoShowTextDialog(cid, item.itemid, text)return TRUEend

Action? Usei em action e deu erro, e em talkaction não funcionou.

Editado por ScythePhantom (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Qual o erro ??, e continua em actions ...

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

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Link para o post
Compartilhar em outros sites
  • Moderador

Meu !spells do meu server:

 

 

<talkaction words="!spells" script="spells.lua"/>

 

 

-- [( Script edited by Doidin for tibiaking.com )] -- 

function onSay(cid, item, words, param) 
 
local count = getPlayerInstantSpellCount(cid) 
local text = "" 
local t = {} 
local prevLevel = -1 
local line = "" 
 
for i = 0, count - 1 do 
local spell = getPlayerInstantSpellInfo(cid, i) 
if spell.level ~= 0 then 
if spell.manapercent > 0 then 
spell.mana = spell.manapercent .. "%" 
end 
table.insert(t, spell) 
end 
end 
table.sort(t, function(a, b) return a.level < b.level end) 
for i, spell in ipairs(t) do 
if prevLevel ~= spell.level then 
if i ~= 1 then 
line = "" 
end 
line = line .. "- Spells for Level " .. spell.level .. ":\n" 
prevLevel = spell.level 
end 
text = text .. line .."• ".. spell.words .." - " .. spell.name .. ": " .. spell.mana .. "\n" 
end 
doShowTextDialog(cid, 7528, text) 
return TRUE 
end
Link para o post
Compartilhar em outros sites

Meu !spells do meu server:

Ok, é muito melhor... mas eu ainda gostaria daquela forma ali...

 

Exana mort:

Level: 8

Ml: 8

Mana: 20

Vocação: Knight, Elite Knight.

 

/\ Ou algo parecido.

Link para o post
Compartilhar em outros sites

function onSay(cid)
    local str = ""
    for i = 0, getPlayerInstantSpellCount(cid) - 1 do 
        local spell = getPlayerInstantSpellInfo(cid, i) 
        if str == "" then
            str = spell.name..":\nLevel: "..spell.level.."\nMl: "..spell.mlevel.."\nMana: "..spell.mana
        else
            str = str.."\n"..spell.name..":\nLevel: "..spell.level.."\nMl: "..spell.mlevel.."\nMana: "..spell.mana
        end
    end
    if str ~= "" then
        doShowTextDialog(cid, 7528, str)
    end
    return true
end

não respondo pms solicitando suporte em programação/scripting

Link para o post
Compartilhar em outros sites

function onSay(cid)    local str = ""    for i = 0, getPlayerInstantSpellCount(cid) - 1 do         local spell = getPlayerInstantSpellInfo(cid, i)         if str == "" then            str = spell.name..":\nLevel: "..spell.level.."\nMl: "..spell.mlevel.."\nMana: "..spell.mana        else            str = str.."\n"..spell.name..":\nLevel: "..spell.level.."\nMl: "..spell.mlevel.."\nMana: "..spell.mana        end    end    if str ~= "" then        doShowTextDialog(cid, 7528, str)    end    return trueend
Funcionou, porém ele está pegando o primeiro nome da magia e todos ficaram com ml 0.

No caso, ele (comando) pega/mostra o instant name e não o words.

<instant name="Mort Gran Wave" words="exevo gran mas mort"

Exemplo:

Strong Haste:

Level: 20

Ml: 0 (o ml sempre fica 0 em todas)

Mana: 100

Editado por ScythePhantom (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo