Hello, can you help me to do that this spell summons diffrent monster depends on player lvl? My way doesn't work :/
Code:
function onCastSpell(cid, var)
local playerpos = getPlayerPosition(cid)
local health = getCreatureHealth(cid)
local maxhealth = getCreatureMaxHealth(cid)/2
local MaxSummon = 2 --- ile mozna max przyzwac
local summons = getCreatureSummons(cid)
local lvl = getPlayerLevel(cid)
if(table.maxn(summons) < MaxSummon) then
if lvl >= 1 and <= 29 then
local clonename = "Kugutsu[10]"
elseif lvl >= 30 and <= 70 then
local clonename = "Kugutsu[30]"
return true
end
local clone = doSummonCreature(clonename, playerpos)
doConvinceCreature(cid, clone)
doChangeSpeed(clone, getCreatureBaseSpeed(cid))
setCreatureMaxHealth(clone, maxhealth)
doCreatureAddHealth(clone, health)
local posEx = getPlayerPosition(cid)
local posK = {x = posEx.x + 1, y = posEx.y, z = posEx.z}
doSendMagicEffect(posK, 50)
return TRUE
end
end