The spells works in necessity of have a previous summon, if the player have it, will remove this previous summon and summon another five. If not, will return false.
I'm sucesfull in make spell remove a summon and make another five, but I fail in get this previous summons to make spell work well (because the player can make another summons, so I need to get this one expecifically). I tried so many things but I haven't sucess. So I came here to call for help.
Thanks in advance.
My try:
I'm sucesfull in make spell remove a summon and make another five, but I fail in get this previous summons to make spell work well (because the player can make another summons, so I need to get this one expecifically). I tried so many things but I haven't sucess. So I came here to call for help.
Thanks in advance.
My try:
Lua:
function onCastSpell(cid, var)
local playerpos = getPlayerPosition(cid)
local position1 = {x=getPlayerPosition(cid).x+1, y=getPlayerPosition(cid).y+1, z=getPlayerPosition(cid).z}
local position2 = {x=getPlayerPosition(cid).x, y=getPlayerPosition(cid).y, z=getPlayerPosition(cid).z}
local maxSummons = 5
local su = {
sa = {"Big Wolf"}
}
if not su.sa[getCreatureName(getCreatureSummons(cid))] then
doPlayerSendCancel(cid, "You need to summon a Big Wolf first.") return false
else
for _, pid in ipairs(getCreatureSummons(cid)) do
doRemoveCreature(pid)
end
for n = 1, maxSummons do
if #getCreatureSummons(cid) >= maxSummons then
break
end
local mon = doCreateMonster("Wolf", playerpos)
doConvinceCreature(cid, mon)
doSendMagicEffect(position1, 152)
doSendMagicEffect(position2, 111)
end
end
return true
end