local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)
function onCastSpell(creature, variant, isHotkey)
if combat:execute(creature, variant) then
local pos = variantToPos(variant)
if pos then
local WALL = Tile(pos):getItemById(ITEM_MAGICWALL)
if WALL then
local timeWall = 30 --How many seconds walls last in items.xml
local playerName = creature:getName()
addEvent(startTimer, 0, playerName, pos, timeWall)
end
end
end
end
function startTimer(playerName, pos, tmpTime)
local player = Player(playerName)
if not player then return false end
if tmpTime == 0 then return false end
player:say(tmpTime, TALKTYPE_MONSTER_SAY, 0, 1, pos)
tmpTime = tmpTime - 1
addEvent(startTimer, 1000, playerName, pos, tmpTime)
return true
end