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

how its works? (spells)

dracovisk

New Member
Joined
Aug 25, 2020
Messages
11
Solutions
1
Reaction score
2
Hi everyone, i wanna learn how scripts works and need to know how this 2 spells works..

Utani tempo hur
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_HASTE)
condition:setParameter(CONDITION_PARAM_SUBID, 3)
condition:setParameter(CONDITION_PARAM_TICKS, 5000)
condition:setFormula(0.9, -72, 0.9, -72)
combat:addCondition(condition)

function onCastSpell(creature, variant)
    local summons = creature:getSummons()
    if summons and type(summons) == 'table' and #summons > 0 then
        for i = 1, #summons do
            local summon = summons[i]
            local summon_t = summon:getType()
            if summon_t and summon_t:isPet() then
                local deltaSpeed = math.max(creature:getBaseSpeed() - summon:getBaseSpeed(), 0)
                local PetSpeed = ((summon:getBaseSpeed() + deltaSpeed) * 0.9) - 72
                local PetHaste = createConditionObject(CONDITION_HASTE)
                setConditionParam(PetHaste, CONDITION_PARAM_TICKS, 5000)
                setConditionParam(PetHaste, CONDITION_PARAM_SPEED, PetSpeed)
                summon:addCondition(PetHaste)
            end
        end
    end
    return combat:execute(creature, variant)
end

and

Paralyze Rune
Lua:
function onCastSpell(creature, var)
    local combat = Combat()
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
    local condition = Condition(CONDITION_PARALYZE)
    condition:setParameter(CONDITION_PARAM_TICKS, 20000)

    if creature:isPlayer() then
        local target = Creature(var.number)
        if not target or not target:isPlayer() then
            condition:setFormula(-0.55, 0, -1.4, 0)
        else
            local speed = target:getBaseSpeed() - 80
            if (speed - 80) <= 0 then
                speed = speed + 80
            end

            condition:setParameter(CONDITION_PARAM_SPEED, -speed)
        end
    else
        condition:setFormula(-0.55, 0, -1.4, 0)
    end

    combat:addCondition(condition)
    if not combat:execute(creature, var) then
        return false
    end

    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    return true
end
 
Solution
You should learn a bit of Lua first. Then you can read some documentation on OT scripting interface (idk if there is one) or you can always download TFS sources and check yourself
 
 
Solution
Back
Top