• 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 Make player/creature cant move

Ruan Sebast

New Member
Joined
Nov 9, 2014
Messages
38
Reaction score
0
Location
Brazil
Theres any way to i make that for some seconds? or any spell that make player paralyzed(cant move) for 10seconds.
 
Code:
function onCastSpell(cid, var)

       
        local function Func()
    
        local Spee = getCreatureSpeed(cid)
        doChangeSpeed(cid, - 900)
        end

        addEvent(Func, 900, nil)
        doChangeSpeed(cid, Spee)
    
    return doCombat(cid, combat, var)
end

I cant move now, but how i add my speed to normal after some time?
 
Last edited:
Code:
function onCastSpell(cid, var)
    local speed = getCreatureSpeed(cid)

    doChangeSpeed(cid, -speed)
    addEvent(doChangeSpeed, 10000, cid, speed)
 
    return doCombat(cid, combat, var)
end
 
They are arguments for the doCombat() function.
cid is the creature id of the creature that casts the spell.
combat is the combat object to use.
var is the variant in which the spell is involved in
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onGetFormulaValues(player, level, maglevel)
    min = -((level / 5) + (maglevel * 1.4) + 8)
    max = -((level / 5) + (maglevel * 2.2) + 14)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    local speed = getCreatureSpeed(cid)

    doChangeSpeed(cid, -speed)
    addEvent(doChangeSpeed, 10000, cid, speed)

    return doCombat(cid, combat, var)
end

Giving that error when i cast the spell ._.
http://2.ii.gl/Whekm_FEl.png
 
Code:
function onCastSpell(creature, var)
    local speed = creature:getSpeed()

    creature:changeSpeed(-speed)
    addEvent(function (id, speed)
        local creature = Creature(id)
        if not creature then
            return true
        end

        creature:changeSpeed(speed)
    end, 10000, creature:getId(), speed)

    return combat:execute(creature, var)
end
 
You can use compat.lua as example to change TFS 0.2 functions to TFS 1.0/1.1 functions.
If you don't have compat.lua in your datapack or if it's not loaded (by global.lua) then all these 0.2 functions in compat.lua will still be a nil value.

You can find the all TFS 1.0/1.1 functions in luascript.cpp.
 
Back
Top Bottom