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

Make utani hur toggle

BulawOw

Soul of Shinobi
Joined
Sep 15, 2014
Messages
204
Solutions
8
Reaction score
62
Could somebody show me how to change utani hur so players can turn it on and off, also if the utani hur is on it takes 5mana per sec and turns off when there is not enough mana on tfs 1.3
 
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
combat:setCondition(condition)

local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)

function onCastSpell(creature, var)
    local pos = creature:getPosition()
    if not creature:getCondition(CONDITION_HASTE, CONDITIONID_DEFAULT) then
        pos:sendMagicEffect(13)
        regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, -5)
        creature:addCondition(regenCondition)
        creature:say("[ON]", TALKTYPE_MONSTER_SAY)
        return combat:execute(creature, var)
    end
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
end
return true
 
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
combat:setCondition(condition)

local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)

function onCastSpell(creature, var)
    local pos = creature:getPosition()
    if not creature:getCondition(CONDITION_HASTE, CONDITIONID_DEFAULT) then
        pos:sendMagicEffect(13)
        regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, -5)
        creature:addCondition(regenCondition)
        creature:say("[ON]", TALKTYPE_MONSTER_SAY)
        return combat:execute(creature, var)
    end
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
end
return true

It works good but it does not end while not enough mana

Also line 6 had to be changed to combat:addCondition(condition) i guess setCondition is outdated
 
Last edited:
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
combat:addCondition(condition)

local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)

function onCastSpell(creature, var)
    local pos = creature:getPosition()
    if not creature:getCondition(CONDITION_HASTE, CONDITIONID_DEFAULT) then
        pos:sendMagicEffect(13)
        regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, -5)
        creature:addCondition(regenCondition)
        creature:say("[ON]", TALKTYPE_MONSTER_SAY)
        return combat:execute(creature, var)
    end
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
    end
    if player:getMana() < 5 then
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
end
return true
 
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
combat:addCondition(condition)

local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)

function onCastSpell(creature, var)
    local pos = creature:getPosition()
    if not creature:getCondition(CONDITION_HASTE, CONDITIONID_DEFAULT) then
        pos:sendMagicEffect(13)
        regenCondition:setParameter(CONDITION_PARAM_MANAGAIN, -5)
        creature:addCondition(regenCondition)
        creature:say("[ON]", TALKTYPE_MONSTER_SAY)
        return combat:execute(creature, var)
    end
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
    end
    if player:getMana() < 5 then
    pos:sendMagicEffect(14)
    creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    creature:removeCondition(regenCondition)
    return creature:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT)
end
return true

error just sneaked in
 
i dont really know how to fix the line 26 it just trying to get the player mana and just execute the code below i also try creature instead of player and still dont work
 
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
combat:addCondition(condition)

local regenCondition = Condition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
regenCondition:setTicks(-1)
regenCondition:setParameter(CONDITION_PARAM_MANATICKS, 1000)
combat:addCondition(regenCondition)

function onCastSpell(creature, var)
    local pos = creature:getPosition()

    if creature:isPlayer() and creature:getCondition(CONDITION_HASTE) and player:getMana() < 5 then
        creature:removeCondition(CONDITION_HASTE)
        creature:removeCondition(regenCondition)
        pos:sendMagicEffect(14)
        creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
        return true
    end

    if creature:getCondition(CONDITION_HASTE) then
        creature:removeCondition(CONDITION_HASTE)
        creature:removeCondition(regenCondition)
        creature:say("[OFF]", TALKTYPE_MONSTER_SAY)
    else
        return combat:execute(creature, var) and creature:say("[ON]", TALKTYPE_MONSTER_SAY) and pos:sendMagicEffect(13)
    end
end
 
Back
Top