Strack
Member
- Joined
- May 15, 2009
- Messages
- 199
- Reaction score
- 14
Well, that's a version I made of Cybershot's shinra tensei, but that runs on area
it's a v.1 of spell, but runs perfectly, (v.1 means its not fully done -> no have effects, only repel 1sql, only repel players, and no damage is done)
you need function-> isWalkable (thanks for that function), if you dont have add it on lib/050-function.lua:
and now, create an script on spells and add:
dmg = damage dealt to target (more sql repels = more damage) Ex.: if damage = 25, and I repel 4 sql, then total dmg = 4x25 = 100
times = how many sql it repels, I put it equal to repelling area, configure it as u want
Hope you enjoy it! ^^
it's a v.1 of spell, but runs perfectly, (v.1 means its not fully done -> no have effects, only repel 1sql, only repel players, and no damage is done)
you need function-> isWalkable (thanks for that function), if you dont have add it on lib/050-function.lua:
Lua:
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
and now, create an script on spells and add:
Lua:
function getDistance(cid)
local tile = {{20, 1},{40, 2},{60, 3},{80, 4},{100, 5}}
table.sort(tile, function(a, b) return a[1] > b[1] end)
for _, t in ipairs(tile) do
if(getPlayerLevel(cid) >= t[1]) then
return t[2]
end
end
return tile[1][2]
end
function onCastSpell(cid, var)
local dist = getDistance(cid)
local areaPosition = {
{x=getCreaturePosition(cid).x-dist, y=getCreaturePosition(cid).y-dist, z=getCreaturePosition(cid).z, stackpos = 255},
{x=getCreaturePosition(cid).x+dist, y=getCreaturePosition(cid).y+dist, z=getCreaturePosition(cid).z, stackpos = 255}
}
local players = getPlayersOnline()
local dmg = math.random(10, getPlayerLevel(cid)+10)
for i= 1, dist do
for _, pid in ipairs(players) do
if isInRange(getCreaturePosition(pid), areaPosition[1], areaPosition[2]) then
local tp = getCreaturePosition(pid)
if (tp.x < getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
tp.x = tp.x-1
tp.y = tp.y-1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x < getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
tp.x = tp.x-1
tp.y = tp.y+1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x < getCreaturePosition(cid).x) and (tp.y == getCreaturePosition(cid).y) then
tp.x = tp.x-1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x > getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
tp.x = tp.x+1
tp.y = tp.y-1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x > getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
tp.x = tp.x+1
tp.y = tp.y+1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x > getCreaturePosition(cid).x) and (tp.y == getCreaturePosition(cid).y) then
tp.x = tp.x+1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x == getCreaturePosition(cid).x) and (tp.y < getCreaturePosition(cid).y) then
tp.y = tp.y-1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
elseif (tp.x == getCreaturePosition(cid).x) and (tp.y > getCreaturePosition(cid).y) then
tp.y = tp.y+1
if isWalkable(tp, true) and not getTileInfo(tp).protection then
doSendMagicEffect(getCreaturePosition(pid), 34)
doTeleportThing(pid, tp, true)
doTargetCombatHealth(cid, pid, COMBAT_PHYSICALDAMAGE, -dmg, -dmg, CONST_ME_BLOCKHIT)
doSendMagicEffect(getCreaturePosition(pid), 34)
else
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_POFF)
end
end
end
end
end
return true
end
dmg = damage dealt to target (more sql repels = more damage) Ex.: if damage = 25, and I repel 4 sql, then total dmg = 4x25 = 100
times = how many sql it repels, I put it equal to repelling area, configure it as u want
Hope you enjoy it! ^^
Last edited: