• 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 Ninja Vocation Spells

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,285
Location
Sweden?
pehMdQyi.gif

Code:
AREA1 = {
    {0, 0, 0},
    {0, 3, 0},
    {0, 0, 0}
}

local function sendHealingEffect(cid, position, loopCount)
    local player = Player(cid)
    if not player then
        return
    end

    position:sendDistanceEffect(player:getPosition(), CONST_ANI_SMALLHOLY)
    player:addHealth(math.max(100, 150))
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    if loopCount == 0 then
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
    end
end

function onCastSpell(creature, var)
    local playerPos = creature:getPosition()
    local loopCount = 12

    creature:say('Heal me my brothers!', TALKTYPE_MONSTER_SAY)
   
    for i = 1, loopCount do
        local position = Position(playerPos.x + math.random(-4, 3), playerPos.y + math.random(-3, 2), playerPos.z)
        addEvent(doAreaCombatHealth, i * 75, creature:getId(), COMBAT_PHYSICALDAMAGE, position, createCombatArea(AREA1), 0, 0, CONST_ME_ASSASSIN)
        addEvent(sendHealingEffect, i * 75, creature:getId(), position, loopCount - i)
    end
    return false
end

CjIKp8V7.gif

Code:
local function targetEffect(cid)
    local player = Player(cid)
    if not player then
        return
    end

    local effect =  CONST_ANI_REDSTAR
    local orig = player:getPosition()
    local d1, d2 = {z = orig.z}, {z = orig.z}

    d1.x = orig.x - 5
    d2.x = orig.x + 5
    for i = -2, 2 do
        d1.y = orig.y + i
        d2.y = d1.y
        orig:sendDistanceEffect(d1, effect)
        orig:sendDistanceEffect(d2, effect)
    end

    d1.y = orig.y - 3
    d2.y = orig.y + 3
    for i = -4, 4 do
        d1.x = orig.x + i
        d2.x = d1.x
        orig:sendDistanceEffect(d1, effect)
        orig:sendDistanceEffect(d2, effect)
    end
end

local function backOldPosition(cid, oldPosition)
    local player = Player(cid)
    if not player then
        return
    end
   
    player:teleportTo(oldPosition)
    player:setGhostMode(false)
end

local function jumpEffect(cid, target)
    local player = Player(cid)
    if not player then
        return
    end

    local target = Creature(target)
    if target then
        player:getPosition():sendDistanceEffect(target:getPosition(), CONST_ANI_EXPLOSION)
    end
end

local function jumpOnTarget(cid, target, targetCount, oldPosition)
    local player = Player(cid)
    if not player then
        return
    end

    local target = Creature(target)
    if target then
        addEvent(targetEffect, 100, cid)
        player:teleportTo(target:getPosition())
        player:setGhostMode(true)
        doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN)
        if targetCount == 0 then
            addEvent(backOldPosition, 400, cid, oldPosition)
        end
    end
end

local function extractRandomValuesFromTable(tbl) --By Printer(This will make sure not to select a value twice from the table)
    if #tbl == 0 then
        return false
    end
          return table.remove(tbl, math.random(#tbl))
end

function onCastSpell(creature, var)
    local targets = {}

    local playerPos = creature:getPosition()
    local spectators = Game.getSpectators(playerPos, false, false, 0, 10, 0, 10)
    for i = 1, #spectators do
        local specs = spectators[i]
        if specs ~= creature and not specs:isNpc() then
            targets[#targets+1] = specs
        end
    end

    if #targets == 0 then
        creature:sendCancelMessage('There is no targets in sight.')
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local targetCount = #targets
    for i = 1, #targets do
        local randTarget = extractRandomValuesFromTable(targets)
        addEvent(jumpOnTarget, i * 400, creature:getId(), randTarget:getId(), targetCount - i, playerPos)
        addEvent(jumpEffect, i * 300, creature:getId(), randTarget:getId())
    end
    return false
end

nEKfQCG5.gif

Code:
local function sendDistanceEffectDelay(cid, fromPos, toPos, effect)
    local player = Player(cid)
    if not player then
        return
    end

    fromPos:sendDistanceEffect(toPos, effect)
end

local function ninjaJumpDash(cid, target, oldPos, lastJump, back)
    local player = Player(cid)
    if not player then
        return
    end

    local target = Creature(target)
    if not target then
        player:setGhostMode(false)
        return
    end
   
    if lastJump then
        player:setGhostMode(false)
    end

    if back then
        player:teleportTo(oldPos)
    else
        player:teleportTo(target:getPosition())
    end
    doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_THUNDER)
end

function onCastSpell(creature, var)
    local cid = creature:getId()
    local playerPos = creature:getPosition()

    creature:setGhostMode(true)
    addEvent(ninjaJumpDash, 0, cid, target:getId(), playerPos, false, false)
    addEvent(sendDistanceEffectDelay, 100, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY)
    addEvent(sendDistanceEffectDelay, 300, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY)
    addEvent(ninjaJumpDash, 400, cid, target:getId(), playerPos, false, true)

    addEvent(ninjaJumpDash, 600, cid, target:getId(), playerPos, false, false)
    addEvent(sendDistanceEffectDelay, 700, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY)
    addEvent(sendDistanceEffectDelay, 1000, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY)
    addEvent(ninjaJumpDash, 1100, cid, target:getId(), playerPos, false, true)

    addEvent(ninjaJumpDash, 1300, cid, target:getId(), playerPos, false, false)
    addEvent(sendDistanceEffectDelay, 1400, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY)
    addEvent(sendDistanceEffectDelay, 1700, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY)
    addEvent(ninjaJumpDash, 1800, cid, target:getId(), playerPos, true, true)
    return false
end

C9kyGonr.gif

Code:
function isWalkable(cid, pos)
    local tile = Tile(pos)
    if not tile then
        return false
    end

    if tile:queryAdd(cid) == 1 and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        return true
    end
    return false
end

local function jumpBehindTarget(cid, target)
    local player = Player(cid)
    local target = Creature(target)
    local targetPos = target:getPosition()
    local targetPositions = {
        north = Position(targetPos.x, targetPos.y-1, targetPos.z),
        east = Position(targetPos.x+1, targetPos.y, targetPos.z),
        west = Position(targetPos.x-1, targetPos.y, targetPos.z),
        south = Position(targetPos.x, targetPos.y+1, targetPos.z)
    }

    local targetDir = target:getDirection()
    if targetDir == NORTH then
        dir = targetPositions.south
    elseif targetDir == EAST then
        dir = targetPositions.west
    elseif targetDir == WEST then
        dir = targetPositions.east
    elseif targetDir == SOUTH then
        dir = targetPositions.north
    end
    return dir
end

local function oldPos(cid, oldPos)
    local player = Player(cid)
    if not player then
        return
    end

    player:teleportTo(oldPos)
end

local function checkHasTarget(cid, count, oldPos)
    local player = Player(cid)
    if not player then
        return
    end

    if count < 1 then
        player:setGhostMode(false)
        return
    end
   
    local target = player:getTarget()
    if target then
        local behindTarget = jumpBehindTarget(cid, target:getId())
        if isWalkable(cid, behindTarget) then
            player:teleportTo(behindTarget)
        else
            player:teleportTo(target:getPosition())
            addEvent(backOldPos, 100, cid, oldPos)
        end
        player:setDirection(target:getDirection())
        player:setGhostMode(false)
        doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -20, -100, CONST_ME_FIREATTACK)
        return true
    end
    addEvent(checkHasTarget, 1 * 100, cid, count - 1)
end

function onCastSpell(creature, var)
    local playerPos = creature:getPosition()

    creature:setGhostMode(true)
    playerPos:sendMagicEffect(CONST_ME_POFF)
    addEvent(checkHasTarget, 1 * 250, creature:getId(), 50, playerPos)
    return false
end
 
Idea for ninja spell:
It would be a spell that whoever atacks u, deals the same damage to them but not to you, you know? like an utito tempo but last 1 sec and every damage dealed to you will be dealed back to the attacker (maybe 50% of the dmg) but you will be reciving no dmg for 1 second, this most have a long cooldown like 15 secs
 
Idea for ninja spell:
It would be a spell that whoever atacks u, deals the same damage to them but not to you, you know? like an utito tempo but last 1 sec and every damage dealed to you will be dealed back to the attacker (maybe 50% of the dmg) but you will be reciving no dmg for 1 second, this most have a long cooldown like 15 secs
Sorry, but i will not create any more spells. I'm working full time on my own project.
 
Oh we are missing the dash spell. That one was my favorite... Is there any chance when you get the time that you could post that one for us?
 
4th will be nice and useful if your invisible spell works on players (they can't see you).
Rest, 1st 2nd and 3rd will cause huge headache after few minutes of playing. Better are spells where screen isn't shock-jumping all the time (It's possible and easy to do without it).

Shock-jumping screen? - Ninja isn't my favorite anymore... :)
 
Last edited:
Code:
[20/02/2015 12:12:04] [Error - Spell Interface]
[20/02/2015 12:12:04] data/spells/scripts/ninja.lua:onCastSpell
[20/02/2015 12:12:04] Description:
[20/02/2015 12:12:04] data/spells/scriptslee/ninja.lua:80: attempt to index local 'creature' (a number value)
[20/02/2015 12:12:04] stack traceback:
[20/02/2015 12:12:04]     data/spells/scripts/ninja.lua:80: in function <data/spells/scripts/ninja.lua:77>

Any reason? :/
 
Code:
[20/02/2015 12:12:04] [Error - Spell Interface]
[20/02/2015 12:12:04] data/spells/scripts/ninja.lua:onCastSpell
[20/02/2015 12:12:04] Description:
[20/02/2015 12:12:04] data/spells/scriptslee/ninja.lua:80: attempt to index local 'creature' (a number value)
[20/02/2015 12:12:04] stack traceback:
[20/02/2015 12:12:04]     data/spells/scripts/ninja.lua:80: in function <data/spells/scripts/ninja.lua:77>

Any reason? :/

Change

function onCastSpell(creature, var)

To

function onCastSpell(cid, var)
local creature = Creature (cid)
 
I changed and now:
Code:
[20/02/2015 23:28:38] [Error - Spell Interface] 
[20/02/2015 23:28:38] data/spells/scripts/ninja.lua:onCastSpell
[20/02/2015 23:28:38] Description: 
[20/02/2015 23:28:38] data/spells/scripts/ninja.lua:78: attempt to call global 'Creature' (a nil value)
[20/02/2015 23:28:38] stack traceback:
[20/02/2015 23:28:38]     data/spells/scripts/ninja.lua:78: in function <data/spells/scripts/ninja.lua:77>

But thanks for trying to help me, I appreciate it :)
 
I'm the asshole with 854 posts in the past year and three months, with 253 likes, posts all over support and release boards, you are the leach with 343 posts in the past 5 years, 9 likes, and not one thread of your own release. Move on leach.
 
that your an asshole :D
That's kinda true (at least right now), you shouldn't react like that... Since he is right, the post is missing a lot of info even if some people can easily tell if the scripts are for 1.0 branch or not.
 
I'm the asshole with 854 posts in the past year and three months, with 253 likes, posts all over support and release boards, you are the leach with 343 posts in the past 5 years, 9 likes, and not one thread of your own release. Move on leach.
Lol, otland died many times, its not my fault im not on otland all the time lol
 
Back
Top