matthew123456
New Member
- Joined
- Aug 24, 2013
- Messages
- 121
- Reaction score
- 3
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
function onCreateMagicWall(creature, tile)
local item = Game.createItem(ITEM_MAGICWALL, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(14000, 20000))
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")
local spell = Spell("rune")
function spell.onCastSpell(creature, var, isHotkey)
local c = combat:execute(creature, var)
if c then
local pos = variantToPosition(var)
local wall = Game.createItem(1027, 1, pos)
addEvent(removeMw, 20000, pos, id, wall:getId())
tile_timer(id, pos, 20, TEXTCOLOR_LIGHTBLUE)
end
return c
end
function tile_timer(id, pos, delay, color)
if getTileItemById(pos, id).uid == 0 then
return true
end
if delay ~= 1 then
addEvent(tile_timer, 1000, id, pos, delay - 1, color)
end
local people = Game.getSpectators(pos, 7, 7, 5, 5, false, true)
if not people then
return true
end
for i = 1, #people do
people[i]:sendTextMessage(MESSAGE_EXPERIENCE, "Magic wall will disappear in " .. delay .. " second" .. (delay > 1 and "s" or "") .. ".", pos, delay, color)
end
end
spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()
as you can see i am trying to make magic wall timers but cant seem to get it working i am using otservbr any help would be great thanks in advance