• 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!

Add monster spells

leeebux

Awsome
Joined
May 18, 2009
Messages
116
Reaction score
17
Location
Sweden
Hello all!

I would like to add 2 spells for my new monster

First one:
LUA:
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 OmnislashStrike(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 == 15 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(OmnislashStrike,333,cid,combat,var,times+1,opos,Target)
    end
end

function onCastSpell(cid, var)
    return addEvent(OmnislashStrike,0,cid,combat,var,0,getCreaturePosition(cid),getCreatureTarget(cid))
end

And
LUA:
local scom1 = createCombatObject() 
local scom2 = createCombatObject() 

local combat1 = createCombatObject() 
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) 
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 255) 
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 24) 
setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 0.3, -500, 0.5, -600) 
  
local combat2 = createCombatObject() 
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) 
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 0) 
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 24) 
setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0.3, -500, 0.5, -600) 

arr1 = { 
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
{1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1}, 
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, 
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, 
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0} 
} 

arr2 = { 
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, 
{0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, 
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 
{1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1}, 
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 
{0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0}, 
{0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, 
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0} 
} 

local area1 = createCombatArea(arr1) 
local area2 = createCombatArea(arr2) 
setCombatArea(scom1, area1) 
setCombatArea(scom2, area2) 

function onTargetTile(cid, pos) 
    return doCombat(cid,combat1,positionToVariant(pos)) 
end 

function onTargetTile2(cid, pos) 
    return doCombat(cid,combat2,positionToVariant(pos)) 
end 

setCombatCallback(scom1, CALLBACK_PARAM_TARGETTILE, "onTargetTile") 
setCombatCallback(scom2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2") 

local function onCastSpell1(parameters) 
    return doCombat(parameters.cid, scom1, parameters.var) 
end 
  
local function onCastSpell2(parameters) 
    return doCombat(parameters.cid, scom2, parameters.var) 
end 
  
function onCastSpell(cid, var) 
local parameters = { cid = cid, var = var} 
addEvent(onCastSpell1, 100, parameters) 
addEvent(onCastSpell2, 200, parameters) 
return TRUE 
end

Is this possible and so can anyone help me out? Rep++ to the one that's help me :)
 
Back
Top