silveralol
Advanced OT User
- Joined
- Mar 16, 2010
- Messages
- 1,483
- Solutions
- 9
- Reaction score
- 215
hello folks I'm trying make a custom spell for a boss ...
the I want that the monster call the spell with delay of 7 seconds to give the damage
but my spell is a "beam" then I want to fix the direction that the spells happen
actually my spell works fine about the damage and the timer but the direction always is in the north
how fix it ?
then, my spells.xml
and the script zacutter beam.lua
thanks
the I want that the monster call the spell with delay of 7 seconds to give the damage
but my spell is a "beam" then I want to fix the direction that the spells happen
actually my spell works fine about the damage and the timer but the direction always is in the north
how fix it ?
then, my spells.xml
Code:
<instant name="zacutter beam" words="###418" aggressive="1" direction="1" blockwalls="1" needlearn="1" script="monster/zacutter beam.lua"/>
Code:
local voc = {1, 2, 3, 4, 5, 6, 7, 8}
arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(arr)
local combat = Combat()
combat:setArea(area)
function onTargetTile(creature, pos)
local creatureTable = {}
local n, i = Tile({x=pos.x, y=pos.y, z=pos.z}).creatures, 1
if n ~= 0 then
local v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid
while v ~= 0 do
if isCreature(v) == true then
table.insert(creatureTable, v)
if n == #creatureTable then
break
end
end
i = i + 1
v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid
end
end
if #creatureTable ~= nil and #creatureTable > 0 then
for r = 1, #creatureTable do
if creatureTable[r] ~= creature then
local min = 1000
local max = 1000
local player = Player(creatureTable[r])
if isPlayer(creatureTable[r]) == true and isInArray(voc, player:getVocation():getId()) then
doTargetCombatHealth(creature, creatureTable[r], COMBAT_ENERGYDAMAGE, -min, -max, CONST_ME_NONE)
elseif isMonster(creatureTable[r]) == true then
doTargetCombatHealth(creature, creatureTable[r], COMBAT_ENERGYDAMAGE, -min, -max, CONST_ME_NONE)
end
end
end
end
pos:sendMagicEffect(CONST_ME_YELLOWENERGY)
return true
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
local function delayedCastSpell(cid, var)
local creature = Creature(cid)
if not creature then
return
end
if creature:getHealth() >= 1 then
creature:say("ZZZZZZZIIIIII! TAKE MY WAVE!", TALKTYPE_MONSTER_YELL)
return combat:execute(creature, positionToVariant(creature:getPosition()))
end
return
end
function onCastSpell(creature, var)
creature:say("Zacutter is charging your ultimate! RUN!", TALKTYPE_MONSTER_YELL)
addEvent(delayedCastSpell, 7000, creature:getId(), var)
return true
end