Postado Dezembro 22, 2022 2 anos .Qual servidor ou website você utiliza como base? TFS 0.4 Rev3996 Qual o motivo deste tópico? Bom dia, boa tarde boa noite pessoas, beleza, eu queria fazer uma coisa em meu server, que era adicionar uma nova categoria ou nao sei como chamaria, sabe ali no xml o "name" "words" "needtarget" etc? Eu queria queria adicionar mais um, o spelltype ou category, onde eu poderia dizer se ele era uma magia de shot, area, etc, mas isso apenas digitando tipo spelltype = "AREA" spelltype = "SHOT" spelltype = "POISON" "etc" pesquisei, achei umas linhas, mas nao tenho a minima ideia de como adiciono isso, pra eu poder adicionar essa nova "categoria" no spells.xml pq no caso eu queria adicionar pra aparecer no spell list. que seria esse spelltype="AREA" <instant name="mega bomb" words="mega bomb" spelltype="AREA" needtarget="1" direction="1" lvl="250" maglv="130" mana="12000" soul="0" exhaustion="300" prem="0" enabled="1" script="mega bomb.lua"><vocation name="monster"/></instant> Como nessa imagem, mas aqui no caso ele coloca isso no spell name tipo name="Mega Bomb (AREA)"
Postado Dezembro 22, 2022 2 anos Tente alterar o script do spellbook.lua para isto: function onUse(cid, item, fromPosition, itemEx, toPosition) local t = {} for i = 0, getPlayerInstantSpellCount(cid) - 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 text, 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.spelltype .. ") : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end
Postado Dezembro 22, 2022 2 anos Autor nao adianta, pq essa função não existe na distro, eu que pensei, imagino que a unica maneira é unserir ela, porem nao entendo de programação. no maximo consigo armengar quando entendo ate onde posso mecher, o que não é esse caso. procuro por palavras chave semelhante, mas vem muita informação e eu não tenho a minina ideia de onde alterar 20 minutos atrás, Anderson Sacani disse: Tente alterar o script do spellbook.lua para isto: function onUse(cid, item, fromPosition, itemEx, toPosition) local t = {} for i = 0, getPlayerInstantSpellCount(cid) - 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 text, 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.spelltype .. ") : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end
Postado Dezembro 22, 2022 2 anos Já testou? Caso não tenha testado, por favor teste. Existe 2 outras possibilidades. Uma é em C++ e a outra é em Lua, porém a opção em Lua é mais trabalhosa já que precisará de uma tabela No caso da solução em lua, terá que completar a tabela: local list = { [1] = { spellName = "Berserk", spellType = "AREA" }, [2] = { spellName = "Heal Friend", spellType = "HEAL" }, } function onUse(cid, item, fromPosition, itemEx, toPosition) local t, spelltype = {}, "" for i = 0, getPlayerInstantSpellCount(cid) - 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 text, 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 for i = 1, #list do if spell.name == list[i].spellName then spelltype = list[i].spellType end end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. "(" .. spelltype .. ") : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end Editado Dezembro 22, 2022 2 anos por Anderson Sacani (veja o histórico de edições)
Postado Dezembro 22, 2022 2 anos Autor 54 minutos atrás, Anderson Sacani disse: Já testou? Caso não tenha testado, por favor teste. Existe 2 outras possibilidades. Uma é em C++ e a outra é em Lua, porém a opção em Lua é mais trabalhosa já que precisará de uma tabela No caso da solução em lua, terá que completar a tabela: local list = { [1] = { spellName = "Berserk", spellType = "AREA" }, [2] = { spellName = "Heal Friend", spellType = "HEAL" }, } function onUse(cid, item, fromPosition, itemEx, toPosition) local t, spelltype = {}, "" for i = 0, getPlayerInstantSpellCount(cid) - 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 text, 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 for i = 1, #list do if spell.name == list[i].spellName then spelltype = list[i].spellType end end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. "(" .. spelltype .. ") : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end caraka, no meu caso, por tabela, iria ter uns 200 spells ai kkk mas seria uma solução. o meu é um pouco diferente desse ai, pq ta configurado pra mostrar ml, soul, se é vip etc, e se nao tiver nao mostra. valou pela força vou dar uma olhada nisso ai, talvez demore pra organizar tudo, mas ficaria daora, pq a outra opção é como meu colega fez, ele colocou no spell name, porem eu teria q refazer toooodos os spells dos monstros, pois eles tem varios spells q player usa, dai o spell pararia de funcionar no monstro, ele faz assim no spell name ele coloca name="mega bomb (1 HIT)" name="explosion (AREA)" Conseguindo fazer direto em C++ seria mais otimizado, tentei achar pelo instante name, mas era função demais, nao sabia onde mecher. _______________________________ Edit, fiz o teste, faz praticamente o que eu queria fazer, da um trabalhinho ter que registrar todos os spells. mas se não conseguir fazer pela source, esse sera um ótimo quebra galho Editado Dezembro 22, 2022 2 anos por koyotestark (veja o histórico de edições)
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.