• 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 Potion add armor access on usage + adds nametag

Joriku

Working in the mines, need something?
Premium User
Joined
Jul 16, 2016
Messages
1,141
Solutions
15
Reaction score
432
Location
Sweden
This script, is it possible to even manage to do it?
The potion is example 7439 - Berserk Potion
What it does - Opens access to put on armor/item once used + Adds a name tag [ICE] as example.
WIthout the potion used you cannot equip an item/items.

This needs to be done thru movements to, right?

Berserk potion:
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if item.itemid == 7440 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        end
    end

    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)

    item:remove(1)
    return true
end
 
Last edited:
Back
Top