• 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 [MOD/LUA] Ninpou: Kawarimi no Jutsu (Body Substitute Skill)

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
This spell is a trap for those players who target you to attack, won't work with area attack by spells or runes. When you cast it, if someone targets you to attack, you will be sent to a safe place nearby and the attacker will be damaged by a trap. Scripted in TFS 0.3.5pl1
YOUTUBE: YouTube - kawarimi.wmv

Option A) MOD:
Lua:
 <?xml version="1.0" encoding="UTF-8"?>
<mod name="Kawarimi" version="1.0" author="Cybermaster" contact="otland.net" enabled="yes">
<event type="login" name="Kawarimi" event="script"><![CDATA[
function onLogin(cid)
    registerCreatureEvent(cid, "kawarimi")
    return true
end]]></event>

<event type="attack" name="kawarimi" event="script"><![CDATA[
function onAttack(cid, target)
    if (isPlayer(target)) and getPlayerStorageValue(target, 14680) == 1 then
        doSendMagicEffect(getCreaturePosition(cid), 54)
        doCreatureAddHealth(cid, -getPlayerLevel(target))
        pos = getPlayerPosition(target)
        doSendMagicEffect(pos, 67)
        doSendAnimatedText(pos, "Kawarimi!", math.random(1,255))
    local safe = {
                {x=math.random(pos.x+2,pos.x+2), y=math.random(pos.y+2,pos.y+2), z=pos.z},
                {x=math.random(pos.x-2,pos.x-2), y=math.random(pos.y-2,pos.y-2), z=pos.z},
                {x=math.random(pos.x+2,pos.x+2), y=math.random(pos.y-2,pos.y-2), z=pos.z},
                {x=math.random(pos.x-2,pos.x-2), y=math.random(pos.y+2,pos.y+2), z=pos.z}
                 }
        for i = 1, #safe do
            rand = math.random(1, #safe)
                if(queryTileAddThing(target, safe[rand]) == RETURNVALUE_NOERROR) then
                    doTeleportThing(target, safe[rand], true)
                end
        end
        doSendDistanceShoot(pos, getPlayerPosition(target), 35)
        setPlayerStorageValue(target, 14680, 0)
        doSendMagicEffect(getCreaturePosition(target), 10)
    return true
    end
end]]></event>

<instant name="Kawarimi no Jutsu" words="kawarimi" lvl="30" mana="200" needlearn="0" event="script"><![CDATA[
    function onCastSpell(cid, var)
    if getPlayerStorageValue(cid, 14680) ~= 1 then
        setPlayerStorageValue(cid, 14680, 1)
        doPlayerSendCancel(cid,"Kawarimi no Jutsu casted.")
        return true
    else
        doPlayerSendCancel(cid,"You have already casted Kawarimi no Jutsu on you.")
        return false
    end
end]]></instant>
</mod>

Option B) LUA:
add to creaturescripts.xml

Lua:
<event type="attack" name="kawarimi" event="script" value="kawarimi.lua"/>
add to login.lua
Lua:
registerCreatureEvent(cid, "kawarimi")
create kawarimi.lua @creaturescripts/scripts:
Lua:
function onAttack(cid, target)
    if (isPlayer(target)) and getPlayerStorageValue(target, 14680) == 1 then
        doSendMagicEffect(getCreaturePosition(cid), 54)
        doCreatureAddHealth(cid, -getPlayerLevel(target))
        pos = getPlayerPosition(target)
        doSendMagicEffect(pos, 67)
        doSendAnimatedText(pos, "Kawarimi!", math.random(1,255))
    local safe = { 
                {x=math.random(pos.x+2,pos.x+2), y=math.random(pos.y+2,pos.y+2), z=pos.z},
                {x=math.random(pos.x-2,pos.x-2), y=math.random(pos.y-2,pos.y-2), z=pos.z},
                {x=math.random(pos.x+2,pos.x+2), y=math.random(pos.y-2,pos.y-2), z=pos.z},
                {x=math.random(pos.x-2,pos.x-2), y=math.random(pos.y+2,pos.y+2), z=pos.z}
                 }
        for i = 1, #safe do
            rand = math.random(1, #safe)
                if(queryTileAddThing(target, safe[rand]) == RETURNVALUE_NOERROR) then
                    doTeleportThing(target, safe[rand], true)
                end
        end
        doSendDistanceShoot(pos, getPlayerPosition(target), 35)
        setPlayerStorageValue(target, 14680, 0)
        doSendMagicEffect(getCreaturePosition(target), 10)
    return true
    end
end

add to spells/xml:
Lua:
<instant name="Kawarimi no Jutsu" words="kawarimi" lvl="40" mana="200" prem="1" exhaustion="0" needlearn="0" blockwalls="1" enabled="1" event="script" value="kawarimi.lua">
    <vocation id="3"/>
    <vocation id="7"/>
</instant>

create kawarimi.lua @ spells/scripts:
Lua:
function onCastSpell(cid, var)
    if getPlayerStorageValue(cid, 14680) ~= 1 then
        setPlayerStorageValue(cid, 14680, 1)
        doPlayerSendCancel(cid,"Kawarimi no Jutsu casted.")
        return true
    else
        doPlayerSendCancel(cid,"You have already casted Kawarimi no Jutsu on you.")
        return false
    end
end
 
Last edited:
Can you post a screenshot or small video of it? I'm a bit curious about it and this japanese? names don't give me any clue:p.
 
i'm too lazy to use snagit now, but it is a cool spell, give it a try
follow it by order, then you'll see the spell:
player A: casts the spell
player B: targets player A then he attacks him

or google@youtube: kawarimi no jutsu naruto then you'll know what I'm talking about
 
Can you post a screenshot or small video of it? I'm a bit curious about it and this japanese? names don't give me any clue:p.
added youtube video :thumbup:
 
cyber i'm got this error:
[25/11/2009 19:08:46] Loading ninpou.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/ninpou.xml
[25/11/2009 19:08:46] Line: 1, Info: XML declaration allowed only at the start of the document


[25/11/2009 19:08:46] failed!

and i have same problem in:
[MOD] Ninpou: Kage Mane no Jutsu (Shadow Imitation Technique)

=//
Help me i will add rep to you forever :wub:
sorry for bad english.
 
Last edited:
geez i'll make luas version then<_<
 
cyber i'm got this error:


and i have same problem in:


=//
Help me i will add rep to you forever :wub:
sorry for bad english.
I've updated both scripts, now they can be installed in LUA or MOD, as you prefer. If MOD doesnt work for you, use the LUAs then. Btw Kagemane works better now:peace:
 
Again, love your scripts Cyber!

I think in this one you could make the "safe spots" a bit safer (like getting tp'd offscreen or to an upper/lower floor or to town or so), because if the attacker is a paladin or any range shooter, it will be the same if you get tped 1 sqm farther than nothing :p

Keep it up!
 
if there is no lower/upper floor available then that would be a matter, this is more like a trap
 
I'm at work now!
when I get home I test to see if it works
before you add spell as I was having a problem with this script that there was not enough to attack on my ot
when i get home i say u if work

thanks
 
I tested the script on my aki ot
but heav a problem
players are not able to attack or monsters or other monsters
= /
 
that isn't a probleM, I scripted it like that
 
i dont understand
u gonna repair the jutsu?
"remembering that if the jutsu is activated the player not eventually able to attack"

I read the script and did not find any fault that run away from the logic

and i dont heav idea what do that

u dont forget nothing?
 
@up lol what was that? the script isn't bugged, it is like that -.-
 
arf
u dont understand
if the script is activate
nobody in the ot can attack

anybody attack

:(
 
<.< i know, i designed it to be like that
seems i'll have to fix that
 
Back
Top