Hey,
i created a simple spell to summon a monster:
But it does not consider the space around the player. When i cast this spell while im stucked somewhere i get this error message:
I get the same error message when i cast the spell while the player is surronded by magic fields.
So i need a way to check if there is enough space and there are not too mouch magic fields arround the player. But i dont know how!
Thanks.
i created a simple spell to summon a monster:
Code:
function onCastSpell(cid, var)
local summons = getCreatureSummons(cid)
if(table.maxn(summons) < 2) then
bomb_health = ((getCreatureMaxHealth(cid) / 100) * 60 )
position = getCreaturePosition(cid)
creature = doCreateMonster("Water Healer", position)
doConvinceCreature(cid, creature)
setCreatureMaxHealth(creature, bomb_health)
doCreatureAddHealth(creature, (getCreatureMaxHealth(creature) - getCreatureHealth(creature)))
doChangeSpeed(creature, -(2000 - getCreatureSpeed(cid)))
else
doPlayerSendCancel(cid, "You can only summon two creatures.")
end
return true
end
But it does not consider the space around the player. When i cast this spell while im stucked somewhere i get this error message:
Code:
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] (luaDoCreateMonster) Cannot create monster: Water Healer
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] (luaDoConvinceCreature) Creature not found
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] (luaSetCreatureMaxHealth) Creature not found
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] (luaGetCreatureMaxHealth) Creature not found
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] (luaGetCreatureHealth) Creature not found
[06/05/2015 11:30:20] [Error - Spell Interface]
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:onCastSpell
[06/05/2015 11:30:20] Description:
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:9: attempt to perform arithmetic on a boolean value
[06/05/2015 11:30:20] stack traceback:
[06/05/2015 11:30:20] data/spells/scripts/cast/water healer.lua:9: in function <data/spells/scripts/cast/water healer.lua:1>
I get the same error message when i cast the spell while the player is surronded by magic fields.
So i need a way to check if there is enough space and there are not too mouch magic fields arround the player. But i dont know how!
Thanks.