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

Mana Spell ?

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
how do i make so this spell take mana its bugged right now..
Code:
	<instant name="adori die" words="adori die" lvl="45" mana="200" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" script="attack/bom.lua">
		<vocation name="Hunter"/>
		<vocation name="royal Hunter"/>
		<vocation name="Warrior"/>
		<vocation name="Elite Warrior"/>
	</instant>
Code:
local arr = {}

arr[1] = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

arr[2] = {
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 0, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 0, 0, 1, 0},
    {1, 0, 0, 0, 2, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 0, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0}
}

arr[3] = {
    {0, 0, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 1, 0},
    {1, 0, 0, 2, 0, 0, 1},
    {0, 1, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0}
}

arr[4] = {
    {0, 0, 1, 0, 0},
    {0, 1, 0, 1, 0},
    {1, 0, 2, 0, 1},
    {0, 1, 0, 1, 0},
    {0, 0, 1, 0, 0}
}

arr[5] = {
    {0, 1, 0},
    {1, 2, 1},
    {0, 1, 0}
}

arr[6] = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 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},
    {1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
    {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, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

local formulas = {
    [6] = {COMBAT_FORMULA_LEVELMAGIC, -4.0, -200, -5.3, -400}
}

local function onTileComb(cid, pos)
    if(isCreature(cid) == TRUE) then
        doSendDistanceShoot(pos, getThingPos(cid), 36)
    end
end

local combats = {}
for i, v in pairs(arr) do
    combats[i] = createCombatObject()
    setCombatParam(combats[i], COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    if(i < #arr) then
        _G["callback" .. i] = onTileComb --Mwahaha
        setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "callback" .. i)
    else
        setCombatParam(combats[i], COMBAT_PARAM_EFFECT, 37)
    end

    if(formulas[i] ~= nil) then
        setCombatFormula(combats[i], unpack(formulas[i]))
    end

    setCombatArea(combats[i], createCombatArea(v))
end

local isCharging = {}
local function eventFunc(p)
    local cid = p.cid
    local n = p.n or 1

    if(isCreature(cid) == FALSE) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    if(isCharging[cid] and n == 1) then
        if(isPlayer(cid) == TRUE) then
            doPlayerSendCancel(cid, "You are already charging it.")
        end
        return LUA_ERROR
    end

    isCharging[cid] = (n < #combats)

    local pos = getThingPos(cid)
    if(getTilePzInfo(pos) ~= FALSE) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    local var = positionToVariant(pos)
    if(doCombat(cid, combats[n], var) == LUA_ERROR) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    if(isCharging[cid]) then
        addEvent(eventFunc, 1000-n*100, {cid=cid, n=n+1})
    end
    return LUA_NO_ERROR
end

function onCastSpell(cid, var)
    return eventFunc({cid=cid})
end
 
Code:
local arr = {}

arr[1] = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

arr[2] = {
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 0, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 0, 0, 1, 0},
    {1, 0, 0, 0, 2, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 0, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0}
}

arr[3] = {
    {0, 0, 0, 1, 0, 0, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 1, 0, 0, 0, 1, 0},
    {1, 0, 0, 2, 0, 0, 1},
    {0, 1, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0}
}

arr[4] = {
    {0, 0, 1, 0, 0},
    {0, 1, 0, 1, 0},
    {1, 0, 2, 0, 1},
    {0, 1, 0, 1, 0},
    {0, 0, 1, 0, 0}
}

arr[5] = {
    {0, 1, 0},
    {1, 2, 1},
    {0, 1, 0}
}

arr[6] = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 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},
    {1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
    {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, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

local formulas = {
    [6] = {COMBAT_FORMULA_LEVELMAGIC, -4.0, -200, -5.3, -400}
}

local function onTileComb(cid, pos)
    if(isCreature(cid) == TRUE) then
        doSendDistanceShoot(pos, getThingPos(cid), 36)
    end
end

local combats = {}
for i, v in pairs(arr) do
    combats[i] = createCombatObject()
    setCombatParam(combats[i], COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    if(i < #arr) then
        _G["callback" .. i] = onTileComb --Mwahaha
        setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "callback" .. i)
    else
        setCombatParam(combats[i], COMBAT_PARAM_EFFECT, 37)
    end

    if(formulas[i] ~= nil) then
        setCombatFormula(combats[i], unpack(formulas[i]))
    end

    setCombatArea(combats[i], createCombatArea(v))
end

local isCharging = {}
local function eventFunc(p)
    local cid = p.cid
    local n = p.n or 1

    if(isCreature(cid) == FALSE) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    if(isCharging[cid] and n == 1) then
        if(isPlayer(cid) == TRUE) then
            doPlayerSendCancel(cid, "You are already charging it.")
        end
        return LUA_ERROR
    end

    isCharging[cid] = (n < #combats)

    local pos = getThingPos(cid)
    if(getTilePzInfo(pos) ~= FALSE) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    local var = positionToVariant(pos)
    if(doCombat(cid, combats[n], var) == LUA_ERROR) then
        isCharging[cid] = false
        return LUA_ERROR
    end

    if(isCharging[cid]) then
        addEvent(eventFunc, 1000-n*100, {cid=cid, n=n+1})
    end
    return LUA_NO_ERROR
end

function onCastSpell(cid, var)
    return TRUE
end
should do it
 
Back
Top