Tbol
Well-Known Member
- Joined
- Apr 7, 2019
- Messages
- 529
- Reaction score
- 56
Hello it suppose to summon max only 1 monster but it summons unlimited number
and im monster.xml
Lua:
function onCastSpell(creature, var)
local player = Player(creature)
local summonName = "Priest Master"
local maxsummons = 1
local summonsPlayer = creature:getSummons()
local summon = true
if (#summonsPlayer >= 1) then
for _, SummonID in ipairs(summonsPlayer) do
if (string.lower(getCreatureName(SummonID)) == string.lower(summonName)) then
nameSummon = getCreatureName(SummonID)
summon = false
end
end
end
if (#summonsPlayer < maxsummons) and (summon == true) then
for i = 1, maxsummons - #summonsPlayer do
local mid = Game.createMonster(summonName, creature:getPosition())
if not mid then
return
end
end
doCreatureSay(creature, "Go "..summonName.."!", TALKTYPE_ORANGE_1)
elseif (#summonsPlayer >= 1) and (nameSummon == summonName) then
doPlayerSendCancel(creature, "You already have summoned "..summonName..".")
summon = false
return doSendMagicEffect(getThingPos(player), 2) and false
end
return
end
Code:
<attack name="summon monster" interval="10000"/>