A
Alw
Guest
Hi. I'm making a summon spell, but the player dosn't get set as master. When a GM summons the monster the GM get set as master but on regular players it dosn't work.
I appreciate any help.
Regards Alw
Code:
local summonName = "Monk"
function onCastSpell(cid, var)
local player = Player(cid)
if player == nil then
return false
end
local summons = player:getSummons()
if #summons > 0 then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local monster = Game.createMonster(summonName, player:getPosition(), false, false)
if not monster then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
local didSummon = monster:setMaster(player)
if not didSummon then
monster:remove()
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
return true
end
I appreciate any help.
Regards Alw