• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Spell Shinra Tensei: Repel them!

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
҉ Shinra Tensei ҉҉

Divine Wrath
scripted in tfs 0.3.5pl1

2yytst3.jpg

~ 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 ots:peace: rep++
 
Last edited:
<_< bad pedopenguin
 
it wastes mana, configure it in the script
 
good spells :) try make taju kage bushin no jutsu (the clone may have 1 hp and the same outfit of the caster)
 
i already did it but i'm waiting for a tfs update for a function to change creature name ingame
 
Increadible Spell Cybermaster that deserves alotta rep to you and Colandus!

It works perfectly =)
 
thanks :peace:

ill release the bansho tenin later
 
Nice, your scripts are very good even though im not a naruto fan at all no offense lol...
i was wondering, i saw one of your old scripts in another threat that had this script and you had one that did the opposite... instead of pushing the player off, it brings the player towards you

but that script doesnt work for me... have you updated it or made a cooler version? :D i would love to use that spell for some knights in my server C:
 
yeah, thats the "bansho tenin". I scripted it for old 0.2, but I plan to make a new one without bugs for latest 0.3
 
yea that would be awesomee!!! haha most of the spells i see for naruto are the coolest ones lol.. and that clone one was off the hook too, if only you can change the name of it and make it deal a certain percent of the damage the real one does that would be awesome... sort of like the mirror image from WoW :p

but yea when will you be making the bansho tenin?
 
well I'll have party and travel this week so maybe by the weekend or the next one
 
hey cybermaster sorry to bother but do you think you can help me out with this script they gave me? it may be a noobish error

Lua:
 function onAttack(cid, target)

local mages, warriors = {1, 2}, {3, 4}

        if isMonster(target) or isMonster(cid) then
                return true
        end

        if(isInArray(mages, getPlayerVocation(cid)) and isInArray(warriors, getPlayerVocation(target)) or (isInArray(warriors, getPlayerVocation(cid)) and isInArray(mages, getPlayerVocation(target)))) then
                doPlayerSendCancel(cid, "You can not attack this player.")
                return false
        end
        return true
end

what i want the script to do is so only some vocations can attack vocations... example sorcerers and druids versus knights and paladins so sorc and druid cant attack each other and neither can knights and pallys... they didnt tell me if weather to put it in creaturescripts or blah blah blah or maybe i have the creaturescript.xml code wrong

think you can help? i wont mind giving you more rep! :D

(maybe you even have your own code that does this :p) i wanted to avoid all the source editing for races so i made more vocations and im going to limit the attacks on each other :p
 
creaturescripts/scripts/YOURSCRIPT.lua

add to creaturescripts.xml:
Lua:
<event type="attack" name="Attack" event="script" value="YOUTSCRIPT.lua"/>

add to creaturescripts/scripts/login.lua
Lua:
    registerCreatureEvent(cid, "Attack")
 
Back
Top