lazarus321
Member
- Joined
- May 8, 2017
- Messages
- 209
- Reaction score
- 20
I have this spell who pushes 1 target. I would like you to push everyone inside the area, can anyone help?
Lua:
--I have this spell who pushes 1 target. I would like you to push everyone inside the area, can anyone help?
local combat0 = Combat()
combat0:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF)
combat0:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat0:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat0:setArea(createCombatArea(AREA_CIRCLE3X3))
local dfcombat0_Push = {CONST_ANI_ARROW,0,1,0,2,0,3,0,-1,0,-2,0,-3,-1,-2,-2,-1,-3,0,-2,1,-1,2,1,2,2,1,3,0,2,-1,1,-2,1,-1,1,0,1,1,2,0,-1,0,-1,1,-2,0,-1,-1}
local function RunPart(c,cid,var,dirList,dirEmitPos)
local player = Player(cid)
local target = getCreatureTarget(cid)
local position = getCreaturePosition(cid)
local fromPosition = getCreaturePosition(target)
local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
if (isCreature(cid)) then
doCombat(cid, c, var)
if (dirList ~= nil) then
local i = 2;
while (i < #dirList) do
doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
i = i + 2
if Tile(toPosition):queryAdd(target) == RETURNVALUE_NOERROR then
doTeleportThing(target, toPosition, true)
end
end
end
end
end
function onCastSpell(cid, var)
local startPos = getCreaturePosition(cid)
RunPart(combat0,cid,var,dfcombat0_Push,startPos)
return true
end
Last edited by a moderator: