҉ Shinra Tensei ҉҉
Divine Wrath
scripted in tfs 0.3.5pl1
Divine Wrath
scripted in tfs 0.3.5pl1
~ Repels players and monsters in the dir you are looking like a magnet.
~ They will stop if something is in the way.
~ Won't pierce anything.
~ They will stop before entering into PZ.
~ If the creature can't be repeled the spell is canceled.
~ The higher the player level is, the more tiles the creature is repeled.
spells.xml
Lua:
<instant name="Rin'negan: Shinra Tensei" words="Shinra Tensei" lvl="20" mana="100" prem="1" exhaustion="5000" needlearn="0" blockwalls="1" enabled="1" event="script" value="shinratensei.lua">
<vocation id="4"/>
<vocation id="8"/>
</instant>
shinratensei.lua
Lua:
function getRepelTiles(cid)
local tile = {
{20, 3},
{40, 4},
{50, 5},
{80, 6},
{100, 7},
{120, 8}
}
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 getNextPos(cid, tiles)
p = getCreaturePosition(cid)
x,y,z = p.x,p.y,p.z
local places = {
[0] = {x=x, y=(y-tiles), z=z, stackpos = 253},
[1] = {x=(x+tiles), y=y, z=z, stackpos = 253},
[2] = {x=x, y=(y+tiles), z=z, stackpos = 253},
[3] = {x=(x-tiles), y=y, z=z, stackpos = 253}}
return places[getPlayerLookDir(cid)]
end
function doRepel(cid, target, tiles)
if queryTileAddThing(cid, getNextPos(cid, 2)) == RETURNVALUE_NOERROR then
doCreatureSetLookDirection(target, getCreatureLookDirection(cid))
repeat
doTeleportThing(target, getNextPos(target, 1), true)
doSendMagicEffect(getCreaturePosition(target), CONST_ME_GROUNDSHAKER)
tiles = tiles-1
until tiles == 0 or queryTileAddThing(target, getNextPos(target, 1)) ~= RETURNVALUE_NOERROR
end
end
function onCastSpell(cid, var)
targ = getThingfromPos(getNextPos(cid, 1))
if (isPlayer(targ.uid)) or (isMonster(targ.uid)) then
if queryTileAddThing(cid, getNextPos(cid, 2)) == RETURNVALUE_NOERROR then
if (isPlayer(targ.uid)) or (isMonster(targ.uid)) and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doRepel(cid, targ.uid, getRepelTiles(cid))
doCreatureAddHealth(targ.uid, -getPlayerLevel(cid))
doCreatureAddMana(cid, -10)
end
else
doPlayerSendCancel(cid, "Something is in the way to repel the target.")
end
else
doPlayerSendCancel(cid, "There is no target to repel.")
end
end
I credit Colandus for the lua tablesort part.
Have another small taste of naruto in your otseace: rep++
Last edited: