OTHispano
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Ir abajo
··¤Ledtheron¤··
··¤Ledtheron¤··
Miembro
Mensajes Mensajes : 32

[Spell] Omnislash (TODAS las vocaciones) Empty [Spell] Omnislash (TODAS las vocaciones)

Dom Abr 22, 2012 7:11 pm
Hola, soy yo denuevo.. mi segundo post...
OK
vallan a data/spells/scripts
Creen un nuevo .txt y ponganle de nombre omnislash.lua
abranlo y pegenle esto adentro
Código:

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 
Guardalo..
Anda a spells.xml y pon esto
Código:

<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>
Guardenlo...
Ahora vamos a data/libs
abre tu 050-function.lua
pon esto dentro del archivo
Código:

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
Guardenlo... y hagan reload en su ot
sera perfecto Wink
Gracias x verlo!!
Credits
99.99999999% Scarlet Ayleid
0.00000001% Ledtheron
Volver arriba
Permisos de este foro:
No puedes responder a temas en este foro.