Nossa, que preguiça de ler o script, muito bagunçado.
Mas ai, só fazer assim:
if #getCreatureSummons(cid) < MaximoSummon then doPlayerSendCancel(cid, "Você só pode ter no máximo 2 summons.") return true end
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Nossa, que preguiça de ler o script, muito bagunçado.
Mas ai, só fazer assim:
if #getCreatureSummons(cid) < MaximoSummon then doPlayerSendCancel(cid, "Você só pode ter no máximo 2 summons.") return true end
Pois então, não funfo tambem ;/
Não da erro algum, simplesmente da para fazer + summons ;x
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Você deve ter colocado no lugar errado. Tó:
local spells = {
[1] = {used = 0, text = '<attack name="melee" interval="2000" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="fire"/></attack>'},
[2] = {used = 0, text = '<attack name="melee" interval="1200" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="energyarea"/></attack>'},
[3] = {used = 0, text = '<attack name="melee" interval="700" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="mortarea"/></attack>'},
}
local spellsNumber = 2
function randomNum(range)
local rand = 0
good = false
math.randomseed( os.time() )
math.random()
math.random()
math.random()
while (not good) do
rand = math.random(range)
if (spells[rand].used == 0) then
spells[rand].used = 1
good = true
else
good = false
end
end
return rand
end
local MaximoSummon = 2
function onSay(cid, words)
if #getCreatureSummons(cid) < MaximoSummon then
doPlayerSendCancel(cid, "Você só pode ter no máximo 2 summons.") return true
end
local attacks = "<a>"
local num
for i=1,spellsNumber,1 do
num = randomNum(table.getn(spells))
attacks = attacks .. spells[num].text
end
attacks = attacks .. "</a>"
doCreateCustomMonster(getCreatureName(cid), getCreaturePosition(cid), getCreatureOutfit(cid), getCreatureMaxHealth(cid), attacks, 6324, 1, 100)
for i=1,table.getn(spells),1 do
spells[i].used = 0
end
attacks = ""
return true
end
Editado Janeiro 29 por LuckOake
info
Grupo: Artesão
Registrado: 20/11/12
Posts: 142
Reputação: +19
Char no Tibia: Deleted

Mais Fácil Ir Em Config.lua e procurar essa parte maxPlayerSummons = 2 E Colocar Quantos Monstros Se Quer Que O Player Summone No Maximo No Caso Ali Ta 2
Mais Fácil Ir Em Config.lua e procurar essa parte maxPlayerSummons = 2 E Colocar Quantos Monstros Se Quer Que O Player Summone No Maximo No Caso Ali Ta 2
Isso não funfa, isso seria para o utevo res.
Eu até agora não entendi o por que não funcionou oq vc disse LuckOake, eu fis igual vc postou tbm, msm assim não deu certo, e para tirar todas minhas duvidas, colei o script inteiro que vc postou agora.. mesmo assim posso continuar fazendo mais do que 2 summons.
E não da erro algum...
Mesmo assim, vlw pela ajuda camarada, tem que refazer esse script do zero mesmo ;x
Editado Janeiro 30 por milbradt
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Putz cara, agora que vi a besteira que eu fiz. Coloquei a verificação errada. Tá ai o script corrigido:
local spells = {
[1] = {used = 0, text = '<attack name="melee" interval="2000" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="fire"/></attack>'},
[2] = {used = 0, text = '<attack name="melee" interval="1200" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="energyarea"/></attack>'},
[3] = {used = 0, text = '<attack name="melee" interval="700" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="mortarea"/></attack>'},
}
local spellsNumber = 2
function randomNum(range)
local rand = 0
good = false
math.randomseed( os.time() )
math.random()
math.random()
math.random()
while (not good) do
rand = math.random(range)
if (spells[rand].used == 0) then
spells[rand].used = 1
good = true
else
good = false
end
end
return rand
end
local MaximoSummon = 2
function onSay(cid, words)
if #getCreatureSummons(cid) >= MaximoSummon then
doPlayerSendCancel(cid, "Você só pode ter no máximo 2 summons.") return true
end
local attacks = "<a>"
local num
for i=1,spellsNumber,1 do
num = randomNum(table.getn(spells))
attacks = attacks .. spells[num].text
end
attacks = attacks .. "</a>"
doCreateCustomMonster(getCreatureName(cid), getCreaturePosition(cid), getCreatureOutfit(cid), getCreatureMaxHealth(cid), attacks, 6324, 1, 100)
for i=1,table.getn(spells),1 do
spells[i].used = 0
end
attacks = ""
return true
end
Poisé, eu ja tinha reparado nisso, mas não era esse o problema, na verdade eu tinha um outro script que estava em talkactions e estava dando conflito.. USHIAUSHAUI
Foda que esse script da dando crash no server... ;x
Vlw ae LuckOake
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Beleza, posso mover o tópico ou tem alguma outra dúvida?
Opa, desculpe, pode mover sim, dúvida e pedido sanado.
info
Grupo: Cavaleiro
Registrado: 04/12/09
Posts: 188
Reputação: +19
Olá, eu fui infeliz em tentar add uma condição na spell.
Gostaria que a mesma verifica-se se o player ja tem mais de 2 summon, caso tiver, não fazer mais.
local spells = { [1] = {used = 0, text = '<attack name="melee" interval="2000" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="fire"/></attack>'}, [2] = {used = 0, text = '<attack name="melee" interval="1200" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="energyarea"/></attack>'}, [3] = {used = 0, text = '<attack name="melee" interval="700" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="mortarea"/></attack>'} } local spellsNumber = 2 function randomNum(range) local rand = 0 good = false math.randomseed( os.time() ) math.random() math.random() math.random() while (not good) do rand = math.random(range) if (spells[rand].used == 0) then spells[rand].used = 1 good = true else good = false end end return rand end function onSay(cid, words) local attacks = "<a>" local num for i=1,spellsNumber,1 do num = randomNum(table.getn(spells)) attacks = attacks .. spells[num].text end attacks = attacks .. "</a>" doCreateCustomMonster(getCreatureName(cid), getCreaturePosition(cid), getCreatureOutfit(cid), getCreatureMaxHealth(cid), attacks, 6324, 1, 100) for i=1,table.getn(spells),1 do spells[i].used = 0 end attacks = "" return true endEu tentei add
Mas não obtive sucesso... Help-me Plz =)