Hey
Im new in lua and tried to remove the summon on use again but no success
can someone explain me how the system works?
TFS 1.3
Code:
I tried stuffs like
remove:creature(monster)
monster:remove()
and so on
tried many things but im kinda lost
Thanks for any kind of help
-angelOt
Im new in lua and tried to remove the summon on use again but no success
can someone explain me how the system works?
TFS 1.3
Code:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local function removeMonster(cid)
local monster = Monster(cid)
if monster then
monster:remove()
end
end
local max = 1
local position = player:getPosition()
if #player:getSummons() >= max then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can not spawn more than 1 pet.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
local position = player:getPosition()
local pos = Position()
local monster = Game.createMonster("Barbarian Bloodwalker", position)
if monster then
player:addSummon(monster)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
monster:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can not spawn a pet in protection zone.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end
I tried stuffs like
remove:creature(monster)
monster:remove()
and so on
tried many things but im kinda lost
Thanks for any kind of help
-angelOt