• 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 Omnislash [100% Working ALL vocations]

Hyresu

Professional Dumb
Joined
Apr 7, 2012
Messages
56
Solutions
8
Reaction score
23
Location
Chile
Hello, this is me again.... now i got a spell... second post..
OK
go to data/spells/scripts
Create a new .txt file and name it omnislash.lua
and open it and put this
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.0, -0, 1.0, -0)

function KinaStrike(cid,combat,var,times,opos,Target)
    if not isCreature(cid) then
        doCreatureSetNoMove(Target, false)
        return true
    end
    if not isCreature(Target) then
        doCreatureSetNoMove(cid, false)
        return true
    end
    doCreatureSetNoMove(Target, true)
    doCreatureSetNoMove(cid, true)
    local newPos = getOppositeSidePos(cid,getCreaturePosition(Target))
    if times == 20 then
        if not doComparePositions(getCreaturePosition(cid),opos) then
            doTeleportThing(cid,opos)
            doSendDistanceShoot(newPos, opos, getWeaponDistanceEffect(getPlayerWeapon(cid).uid))
        end
        doCreatureSetNoMove(Target, false)
        doCreatureSetNoMove(cid, false)
        return doCombat(cid, combat, var)
    else
        if isWalkable(cid,newPos) and newPos ~= getCreaturePosition(cid) then
            local fromPos = getCreaturePosition(cid)
            doTeleportThing(cid,newPos)
            doSendDistanceShoot(fromPos, newPos, getWeaponDistanceEffect(getPlayerWeapon(cid).uid))
        end
        doCombat(cid, combat, var)
        return addEvent(KinaStrike,280,cid,combat,var,times+1,opos,Target)
    end
end

function onCastSpell(cid, var)
    return addEvent(KinaStrike,0,cid,combat,var,0,getCreaturePosition(cid),getCreatureTarget(cid))
end
Then save it....
Now go to spells.xml and put this
Code:
<instant name="Omnislash" words="utevo slash" lvl="300" mana="200" prem="1" range="1" needtarget="1" needweapon="0" exhaustion="1000" needlearn="1" event="script" value="omnislash.lua">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="3"/>
		<vocation id="4"/>
		<vocation id="5"/>
		<vocation id="6"/>
		<vocation id="7"/>
		<vocation id="8"/>
   </instant>
Then save it...
Now go to data/libs
open your 050-function.lua
and put this inside the file
Code:
function isWalkable(cid,pos)
    local aux = pos
    aux.stackpos = 253
    if doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(aux).uid) == FALSE then
        return TRUE
    end
    return FALSE
end

function getWeaponDistanceEffect(uid) 
    local WeaponType = getItemWeaponType(uid) 
    if WeaponType == WEAPON_CLUB then 
        return CONST_ANI_WHIRLWINDCLUB 
    elseif WeaponType == WEAPON_SWORD then 
        return CONST_ANI_WHIRLWINDSWORD 
    elseif WeaponType == WEAPON_AXE then 
        return CONST_ANI_WHIRLWINDAXE 
    elseif WeaponType == WEAPON_WAND then
        return CONST_ANI_HOLY 
    elseif WeaponType == WEAPON_DISTANCE then
        return CONST_ANI_HOLY
    else 
        return CONST_ANI_NONE 
    end 
end

function getOppositeSidePos(cid,centerPos)
    local otherSideDirTable = {                                              
        {SOUTH,SOUTHWEST,SOUTHEAST},  --NORTH
        {WEST,SOUTHWEST,NORTHWEST},   --EAST
        {NORTH,NORTHWEST,NORTHEAST},     --SOUTH
        {EAST,SOUTHEAST,NORTHEAST},   --WEST
        {NORTH,EAST,NORTHEAST},       --SOUTHWEST
        {NORTH,WEST,NORTHWEST},       --SOUTHEAST
        {SOUTH,EAST,SOUTHEAST},       --NORTHWEST
        {SOUTH,WEST,SOUTHWEST}        --NORTHEAST
    }   
    local PlayerDirection = (getDirectionTo(centerPos,getCreaturePosition(cid)))+1
    local newDirection = otherSideDirTable[PlayerDirection][math.random(1,3)]
    local newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,getPosByDir(centerPos,newPos)) then
        return newPos
    end
    if newDirection == 1 then
        local rand = math.random(2,3)
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][5-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    elseif newDirection == 2 then
        local rand = math.random(1,2)
        if rand == 2 then rand = 3 end
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][4-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    elseif newDirection == 3 then
        local rand = math.random(1,2)
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][3-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    end
    otherSideDirTable = {
        {EAST,WEST},                    --NORTH     
        {NORTH,SOUTH},                  --EAST      
        {EAST,WEST},                    --SOUTH     
        {NORTH,SOUTH},                  --WEST      
        {SOUTHEAST,NORTHWEST},          --SOUTHWEST 
        {SOUTHWEST,NORTHEAST},          --SOUTHEAST 
        {SOUTHWEST,NORTHEAST},          --NORTHWEST 
        {SOUTHEAST,NORTHWEST}           --NORTHEAST 
    }
    local rand = math.random(1,2)
    newDirection = otherSideDirTable[PlayerDirection][rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    newDirection = otherSideDirTable[PlayerDirection][3-rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    otherSideDirTable = {
        {NORTHWEST,NORTHEAST},                    --NORTH     
        {SOUTHEAST,NORTHEAST},                    --EAST      
        {SOUTHWEST,SOUTHEAST},                    --SOUTH     
        {SOUTHWEST,NORTHWEST},                    --WEST      
        {SOUTH,WEST},                             --SOUTHWEST 
        {EAST,SOUTH},                             --SOUTHEAST 
        {NORTH,WEST},                             --NORTHWEST 
        {NORTH,EAST}                              --NORTHEAST 
    }
    local rand = math.random(1,2)
    newDirection = otherSideDirTable[PlayerDirection][math.random(1,2)]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    newDirection = otherSideDirTable[PlayerDirection][3-rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    return getPosByDir(centerPos,PlayerDirection-1)
end
Then save it... RELOAD spells from your ot and
it will be perfect ;)
Thanks for watching!!
Credits
99.99999999% Scarlet Ayleid
0.00000001% Ledtheron
If you wana post in another forum.. put credits please c:
 
000-function.lua
Spells.xml
And a little function of omnislash.lua
 
aw.. didnt worked on 9.10 server..
it "works" but it doesnt make the character move around the target :c

Edit: oh wena, sos chileno wn? xD uta, sabes que hice todo lo señalado (uso el 4funserver 9.10) y resulta que el skill "funciona" pero no se teletransporta al rededor del mob con los efectos de la espada y todo eso :c
 
[30/01/2013 11:14:32] [Error - Spell Interface]
[30/01/2013 11:14:32] In a timer event called from:
[30/01/2013 11:14:32] data/spells/scripts/omnislash.lua:eek:nCastSpell
[30/01/2013 11:14:32] Description:
[30/01/2013 11:14:32] (luaGetThing) Thing not found
 
Back
Top