• 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 TFS 1.3 Check condition

majsters

New Member
Joined
Jun 7, 2010
Messages
18
Reaction score
1
How to check condition for mastermind potion?

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_SUBID, 8)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_BUFF_SPELL, true)


I found this and I don't know how to use it :(

Condition(conditionType[, conditionId = CONDITIONID_COMBAT])
condition:getId()
condition:getSubId()
condition:getTicks()
 
I tried to remove some conditions when changing my form (as a druid), it wasn't working, and @Infernum 's tip helped me.

Lua:
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(1800000)

function onCastSpell(creature, variant)
    local returnValue = RETURNVALUE_NOERROR
    local monster_name = variant:getString()
    local monsterType = MonsterType(monster_name)

    if not monsterType then
        returnValue = RETURNVALUE_CREATUREDOESNOTEXIST
    elseif not creature:hasFlag(PlayerFlag_CanIllusionAll) and
        not monsterType:isIllusionable() then
        returnValue = RETURNVALUE_NOTPOSSIBLE
    end

    if returnValue ~= RETURNVALUE_NOERROR then
        creature:sendCancelMessage(returnValue)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if monster_name == "kongra" then
        creature:setAttackSpeed(2000)
        if creature:getCondition(CONDITION_HASTE) then
            creature:removeCondition(CONDITION_HASTE)
        end
        if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 2) then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 2)
        end
        local skill = Condition(CONDITION_ATTRIBUTES)
        skill:setParameter(CONDITION_PARAM_SUBID, 1)
        skill:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 150)
        skill:setParameter(CONDITION_PARAM_TICKS, 1800000)
        skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
        creature:addCondition(skill)
    elseif monster_name == "midnight panther" then
        creature:setAttackSpeed(500)
        if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 1) then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 1)
        end
        if creature:hasCondition(CONDITION_HASTE) then
            creature:removeCondition(CONDITION_HASTE)
        end
        local skill = Condition(CONDITION_ATTRIBUTES)
        skill:setParameter(CONDITION_PARAM_SUBID, 2)
        skill:setParameter(CONDITION_PARAM_SKILL_FISTPERCENT, 150)
        skill:setParameter(CONDITION_PARAM_TICKS, 1800000)
        skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
        creature:addCondition(skill)
    elseif monster_name == "husky" then
        creature:setAttackSpeed(1000)
        if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 1) then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 1)
        end
        if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 2) then
            creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 2)
        end
        local skill = Condition(CONDITION_HASTE)
        skill:setParameter(CONDITION_PARAM_TICKS, 1800000)
        creature:addCondition(skill)
    end

    condition:setOutfit(monsterType:getOutfit())
    creature:addCondition(condition)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end
 
Last edited:
Back
Top