kennyubuntu
Member
- Joined
- May 20, 2016
- Messages
- 150
- Reaction score
- 13
i tried to make a rune to summon a monk
but i got 3 errors:
1- not convicing creature (the monk is attacking the summoner)
2- not removing the rune
3- not removing mana
but i got 3 errors:
1- not convicing creature (the monk is attacking the summoner)
2- not removing the rune
3- not removing mana
Code:
local mana = 500
function onCastSpell(cid, var)
local maxSummons = getConfigValue('maxPlayerSummons')
if #getCreatureSummons(cid) >= maxSummons then
return (doPlayerSendCancel(cid, "You cannot summon more creatures.") and doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)) and true
end
if (getPlayerMana(cid) < mana) then
return (doPlayerSendCancel(cid, "You need " .. mana .. " mana points to use this rune.") and doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)) and true
end
local createMonster = doCreateMonster("Monk", getThingPos(cid))
if createMonster then
doPlayerAddMana(cid, (mana * 1))
doCreatureSetSkullType(createMonster, SKULL_YELLOW)
setCreatureMaxHealth(createMonster, (getCreatureHealth(createMonster) * 2))
doCreatureAddHealth(createMonster, getCreatureHealth(createMonster) * 2)
doConvinceCreature(cid, createMonster)
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE)
return true
end
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return false
end