lazarus321
Member
- Joined
- May 8, 2017
- Messages
- 222
- Reaction score
- 23
Guys,
How would I make a spell to create an item around the player without it being inside pz area, walls, monsters, players or obstacles?
I created a script but it does not respect the conditions as I said.
How would I make a spell to create an item around the player without it being inside pz area, walls, monsters, players or obstacles?
I created a script but it does not respect the conditions as I said.
C++:
function onCastSpell(creature, variant)
local player = Player(creature)
local nivel = player:getLevel()
local ml = player:getMagicLevel()
-- if ml >= 1 and nivel >= 3 then
local player = Player(creature)
local target = player:getTarget()
local alvo = target:getDirection()
local alvopos = target:getPosition()
local playerdir = player:getDirection()
local playerpos = player:getPosition()
local nortepos = Position(target:getPosition().x, target:getPosition().y - 1, target:getPosition().z)
local nortepos2 = Position(target:getPosition().x + 1, target:getPosition().y - 1, target:getPosition().z)
local lestepos = Position(target:getPosition().x + 1, target:getPosition().y, target:getPosition().z)
local lestepos2 = Position(target:getPosition().x + 1, target:getPosition().y +1, target:getPosition().z)
local sulpos = Position(target:getPosition().x, target:getPosition().y + 1, target:getPosition().z)
local sulpos2 = Position(target:getPosition().x - 1, target:getPosition().y + 1, target:getPosition().z)
local oestepos = Position(target:getPosition().x - 1, target:getPosition().y, target:getPosition().z)
local oestepos2 = Position(target:getPosition().x - 1, target:getPosition().y - 1, target:getPosition().z)
Game.createItem(6972, 1, sulpos2)
Game.createItem(6972, 1, sulpos)
Game.createItem(6972, 1, lestepos2)
Game.createItem(6972, 1, lestepos)
Game.createItem(6972, 1, nortepos2)
Game.createItem(6972, 1, nortepos)
Game.createItem(6972, 1, oestepos2)
Game.createItem(6972, 1, oestepos)
sulpos2:sendMagicEffect(69)
sulpos:sendMagicEffect(69)
lestepos2:sendMagicEffect(69)
lestepos:sendMagicEffect(69)
nortepos2:sendMagicEffect(69)
nortepos:sendMagicEffect(69)
oestepos2:sendMagicEffect(69)
oestepos:sendMagicEffect(69)
item1 = Tile(sulpos2):getItemById(6972)
item2 = Tile(sulpos):getItemById(6972)
item3 = Tile(lestepos2):getItemById(6972)
item4 = Tile(lestepos):getItemById(6972)
item5 = Tile(nortepos2):getItemById(6972)
item6 = Tile(nortepos):getItemById(6972)
item7 = Tile(oestepos2):getItemById(6972)
item8 = Tile(oestepos):getItemById(6972)
if item1 and item2 and item3 and item4 and item5 and item6 and item7 and item8 then
addEvent(function() item1:remove() end, 5000)
addEvent(function() item2:remove() end, 5000)
addEvent(function() item3:remove() end, 5000)
addEvent(function() item4:remove() end, 5000)
addEvent(function() item5:remove() end, 5000)
addEvent(function() item6:remove() end, 5000)
addEvent(function() item7:remove() end, 5000)
addEvent(function() item8:remove() end, 5000)
addEvent(function() sulpos2:sendMagicEffect(69) end, 3500)
addEvent(function() sulpos:sendMagicEffect(69) end, 3500)
addEvent(function() lestepos2:sendMagicEffect(69) end, 3500)
addEvent(function() lestepos:sendMagicEffect(69) end, 3500)
addEvent(function() nortepos2:sendMagicEffect(69) end, 3500)
addEvent(function() nortepos:sendMagicEffect(69) end, 3500)
addEvent(function() oestepos2:sendMagicEffect(69) end, 3500)
addEvent(function() oestepos:sendMagicEffect(69) end, 3500)
end
return true
end

