• 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+] !exiva on/off

Adorius Black

Advanced OT User
Joined
Mar 31, 2020
Messages
301
Solutions
3
Reaction score
180
Hi OTLanders. I'm browsing otserver webpages to insiped myself with something and I came across an interesting feature which has one ots.

!exiva on/off - lets say its only for vocation Sorcerer and it works like that:
when you use:
!exiva off - nobody can exiva you
but when you use:
!exiva on - everybody can again exiva you.

Is here anybody who can make talkaction or spell like this?
 
Solution
in exiva file under local target = Player(variant:getString()) add:
Lua:
if target:getStorageValue(3944) == 1 then
    player:sendCancelMessage('You can not exiva him')
    return true
end

Lua:
function onSay(player, words, param)
    if not param or param == '' then
        player:sendTextMessage(36, "Usage: !exiva on or !exiva off")
        return false
    end
    if not player:getVocation():getId() == 1 or not player:getVocation():getId() == 5 then
        return true
    end
    local storage = 3944
    if param == "on" then
        if player:getStorageValue(storage) == 1 then
            player:setStorageValue(storage, -1)
            player:sendTextMessage(36, "Players can exiva you now.")
        end
    elseif param == "off"...
in exiva file under local target = Player(variant:getString()) add:
Lua:
if target:getStorageValue(3944) == 1 then
    player:sendCancelMessage('You can not exiva him')
    return true
end

Lua:
function onSay(player, words, param)
    if not param or param == '' then
        player:sendTextMessage(36, "Usage: !exiva on or !exiva off")
        return false
    end
    if not player:getVocation():getId() == 1 or not player:getVocation():getId() == 5 then
        return true
    end
    local storage = 3944
    if param == "on" then
        if player:getStorageValue(storage) == 1 then
            player:setStorageValue(storage, -1)
            player:sendTextMessage(36, "Players can exiva you now.")
        end
    elseif param == "off" then
        if player:getStorageValue(storage) == -1 then
            player:setStorageValue(storage, 1)
            player:sendTextMessage(36, "Players can not exiva you now.")
        end
    end
    return false
end
 
Last edited:
Solution
in exiva file under local target = Player(variant:getString()) add:
Lua:
if target:getStorageValue(3944) == 1 then
    player:sendCancelMessage('You can not exiva him')
    return true
end

Lua:
function onSay(player, words, param)
    if not param or param == '' then
        player:sendTextMessage(36, "Usage: !exiva on or !exiva off")
        return false
    end
    if not player:getVocation():getId() == 1 or not player:getVocation():getId() == 5 then
        return true
    end
    local storage = 3944
    if param == "on" then
        if player:getStorageValue(storage) == 1 then
            player:setStorageValue(storage, -1)
            player:sendTextMessage(36, "Players can exiva you now.")
        end
    elseif param == "off" then
        if player:getStorageValue(storage) == -1 then
            player:setStorageValue(storage, 1)
            player:sendTextMessage(36, "Players can not exiva you now.")
        end
    end
    return false
end
Pretty quick answer :) you are amazing. Anyway I didn't know how to use your script correctly so I little bit edit this code for using it as spell.
Here is to anyone who would like use edited script:
put in data/spells/spells.xml
XML:
    <instant group="support" spellid="904" name="Tor" words="tor" lvl="14" mana="50" aggressive="0" selftarget="1" exhaustion="2000" groupcooldown="2000" needlearn="0" script="support/tor.lua">
        <vocation name="Hacker" /> <!-- Vocation who can use Tor spell -->
        <vocation name="Dark Hacker" /> <!-- Vocation who can use Tor spell -->
    </instant>
then put in data/spells/scripts/support/tor.lua
Lua:
    function onCastSpell(player, words, param)
        local storage = 59646985
            if player:getStorageValue(storage) == 1 then
                player:setStorageValue(storage, -1)
                player:say("Tor is [OFF]!", TALKTYPE_MONSTER_SAY)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
            else
                player:setStorageValue(storage, 1)
                player:say("Tor is [ON]!", TALKTYPE_MONSTER_SAY)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
            end
        return false
    end
and also in your exiva spell in tfs1.4 = data/spells/scripts/support/find person.lua
put under local target = Player(variant:getString()) like Levi999x said this code:

Lua:
    if target:getStorageValue(59646985) == 1 then
        creature:sendTextMessage(MESSAGE_INFO_DESCR, target:getName() .. " is using tor right now...")
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end

You can switch between OFF and ON just by simply write word "tor" in game without " ".

Here is result:

tor final.png

toron.png
 
Last edited:
Back
Top