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

Lua A spell bug need help! asap

Lpe95

https://soundcloud.com/saintdmusic/sail-remix
Joined
Mar 3, 2013
Messages
308
Reaction score
12
Location
Music preformer.
Hey i use the old natalaaa and their utura con spell is fckt up it wont' do any dmg and when they use it the server lagging a bit


here is script any one sees the problem?


And this is comping up on my console about the bug on the spell


Code:
[18/03/2014 20:06:29] [Error - Spell Interface]
[18/03/2014 20:06:29] In a callback: data/spells/scripts/attack/spear.lua:onGetFormulaValues
[18/03/2014 20:06:29] (Unknown script file)
[18/03/2014 20:06:30] Description:
[18/03/2014 20:06:30] (luaGetPlayerSkillLevel) Player not found

[18/03/2014 20:06:30] [Error - Spell Interface]
[18/03/2014 20:06:30] In a callback: data/spells/scripts/attack/spear.lua:onGetFormulaValues
[18/03/2014 20:06:30] (Unknown script file)
[18/03/2014 20:06:30] Description:
[18/03/2014 20:06:30] data/spells/scripts/attack/spear.lua:62: attempt to perform arithmetic on local 'distance' (a boolean value)


Code:
local config =
{
    --Spell made by me special for OTLand.net
    --If you have some question or you are interested in buying v2 where enchanted arrows, burst's AoE, spears and trowning stars are supported feel free to PM
    --You can use and edit this spell for your OTS, but you can't publish it somewhere without my permission
    --You can't remove author line from script.
        author = "andu",
    --All rights to andu: "otland.net/members/andu/"; "facebook.com/olrios", olrios is my 2nd nickname
    ----------------- CONFIGURATION ----------------
    removeAmmo = false, -- set true to remove one ammo per each shot. true is better for more RPG (remember to add , after "true" or "false")
    alwaysHits = false, -- set true to make this spell always hits, otherwise hits will be afected by your distance
    damageMultipiler = 1.2, -- 0.75 mean 75% of you normal damage will be apiled per each shot (1.0 = 100%, 2.0 = 200% ...)
    shots =
    {
        perLevel = true, -- set false to make spell shooting everytime the same amount of arrows, otherwise it will shoot more if your level is higher
        multipiler = 80, -- (if perLevel is false - leave this alone) shoots "level/multipiler" arrows at once. ex. level 300 will shot 10 arrows at once (300/30=10) Multipiler CANT BE LESS THEN 1!
        amount = 0, -- here is the amount of arrows shooted if perLevel is set to false
        time = 120, -- time between shoots (120 is good number there)
    },
    criticals =
    {
        enable = true, -- set false to make spell unable to do critical strikes
        chance = 5, -- in percents
        multipiler = 1.45, -- 2.0 mean: criticals will be 2 times much stronger, (1.0 mean same as non crits)
        info =
        {
            enable = true, -- set true to make enable "critical info"
            color = 180, -- check your data/lib/constant.lua for more avaible colors (can be a number between 0 and 255)
            onTarget = true -- set false to do "critical strike info" on you, otherwise it will be shown on target. for me onTarget looks much better
        }
    },
    ------------------------------------------------
    --- DO NOT TOUCHING ANYTHING BELOW THIS LINE ---
    ------------------------------------------------
    arrowsIds = {2544, 2545, 2546, 7364, 7365, 7838, 7840, 7839, 7850},
    boltsIds = {2543, 2547, 7629, 7363},
    effects = {
        [7366] = CONST_ANI_GREENSTAR,
        [2410] = CONST_ANI_THROWINGKNIFE,
        [10531] = CONST_ANI_DEATH,
        [4848] = CONST_ANI_SMALLICE,
    }
}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, false)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, false)
local function crit()
    return math.random(100)
end
function onGetFormulaValues(cid, level, maglevel)
    local pos = getCreaturePosition(cid)
    local tos = getCreaturePosition(getCreatureTarget(cid))
    local distance = getPlayerSkillLevel(cid, 4, false)
    local max = -(5*level^(1/1.5)+distance*1.5+25*2*distance/40-30)*config.damageMultipiler
    if config.alwaysHits == true then
        min = max
    else
        min = math.floor(max / 2)
    end
    if config.criticals.enable and crit() <= config.criticals.chance then
        min = min * config.criticals.multipiler
        max = max * config.criticals.multipiler
        if(config.criticals.info.onTarget == true) then
            pos = tos
        end
        doSendAnimatedText(pos, "CRITICAL", config.criticals.info.color)   
    end
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local function shot(param)
    if config.criticals.enable == false then
        config.criticals.info.enable = false
    end
    if(isCreature(getCreatureTarget(param.cid)) and (getCreatureHealth(getCreatureTarget(param.cid)) > 0)) then
        local tos = getCreaturePosition(getCreatureTarget(param.cid))
        local pos = getCreaturePosition(param.cid)
        local ammo = getPlayerSlotItem(param.cid, CONST_SLOT_AMMO)
        local weapon = getPlayerWeapon(param.cid)
        if(config.removeAmmo == true) then
            if((isInArray(config.arrowsIds, ammo.itemid) and(weapon.ammoType == arrow)) or(isInArray(config.boltsIds, ammo.itemid) and(weapon.ammoType == bolt))) then
                if(doPlayerRemoveItem(param.cid, ammo.itemid, 1) == true) then
                    doCombat(param.cid, combat, param.var)
                    doSendDistanceShoot(pos, tos, config.effects[weapon.itemid])
                else
                    doSendMagicEffect(pos, CONST_ME_POFF)
                end
            else
                doSendMagicEffect(pos, CONST_ME_POFF)
            end
        else
            doCombat(param.cid, combat, param.var)
            doSendDistanceShoot(pos, tos, config.effects[weapon.itemid])
        end
    end
    return true
end
function onCastSpell(cid, var)
    local weapon = getPlayerWeapon(cid)

    if((weapon.weaponType == distance) and ((weapon.ammoType == arrow) or (weapon.ammoType == bolt))) then
        local value = getPlayerLevel(cid) / config.shots.multipiler
        if(config.shots.perLevel == false) then
            value = config.shots.amount
        end
        for s = 1, value do
            addEvent(shot, s * config.shots.time, {cid = cid, var = var})
        end
    else
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    end
    return true
end
 
Back
Top