• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Potion on Use

Helliot1

Owner of Empire Online
Joined
Jul 26, 2017
Messages
315
Solutions
1
Reaction score
60
Hello, I have a problem, need a mana potion that only need use to heal my mana, without "Use with" "Hotkey", somebody can help me ?
I'm using OTX3 8.60 , and a custom spr and dat. then how properties I use in Item editor too ?

This is my script.

Code:
<action itemid="1831" script="others/potions.lua"/>

Code:
local potions = {
    [1831] = {mana = {50, 75}, flask = 1841}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if type(target) == "userdata" and not target:isPlayer() then
        return false
    end

    if potion.health or potion.mana then
        if potion.health then
            doTargetCombatHealth(0, target, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE)
        end

        if potion.mana then
            doTargetCombatMana(0, target, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE)
        end

        target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        player:RemoveItem(potion.mana, 1)       
        player:addItem(potion.flask, 1)
    end

    if potion.condition then
        player:addCondition(potion.condition)
        player:say(potion.text, TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(potion.effect)
    end

    if potion.transform then
        item:transform(potion.transform.id[math.random(#potion.transform.id)])
        item:getPosition():sendMagicEffect(potion.effect)
        return true
    end

    item:remove(1)
    return true
end
 
Last edited:
Yea, already are "Force Use" in otbm, but I cant use, and when I create a single potion, it shows 160 potions.

I used but don't works nothing, I get a error:

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/others/potions.lua:onUse
LuaScriptInterface::luaDoTargetCombatMana(). Creature not found
stack traceback:
        [C]: in function 'doTargetCombatMana'
        data/actions/scripts/others/potions.lua:23: in function <data/actions/scripts/others/potions.lua:6>
 

Similar threads

Back
Top