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

13.x Datapack with Potions exhausting spells

marcinmj321

New Member
Joined
Nov 30, 2024
Messages
2
Reaction score
1
Hello :)
I'm very interested in having my potions giving cooldown to my spells. I've already made my attack spells cooldowning healing spells by assigning them to same spell groups (all have both attack and healing groups). With that, is there a possibility to make same with potions, so that spells do not give cooldown on potions but using them prior to spell will do?
 

Attachments

You need to make it as a spell item instead of an action item
LUA:
local potionRune = Spell("instant")

function potionRune.onCastSpell(creature, variant)

LUA:
local flaskPotion = Action()

function flaskPotion.onUse
 
Okay, tried to do it in potions.lua, but failed to work. So made a completely different file, deactivated potion from potions.lua, copied entire code from UH rune to mana potion.lua, tuned it up for potion and works perfectly fine :))

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

function onGetFormulaValues(player, level, maglevel)
    return 50, 100
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local rune = Spell("rune")

function rune.onCastSpell(creature, var, isHotkey)
    if Monster(var:getNumber(1073762188)) then
        creature:sendCancelMessage("Sorry, not possible.")
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    else
    return combat:execute(creature, var) and creature:say("Aaaah...", MESSAGE_POTION)
end

rune:group("healing", "attack")
rune:name("mana potion")
rune:impactSound(SOUND_EFFECT_TYPE_ITEM_USE_POTION)
rune:runeId(268)
rune:allowFarUse(false)
rune:charges(1)
rune:level(0)
rune:magicLevel(0)
rune:cooldown(1 * 1000)
rune:groupCooldown(1 * 1000, 1 * 1000)
rune:isAggressive(false)
rune:needTarget(true)
rune:isBlocking(true)
rune:register()
 
Last edited:

Similar threads

Back
Top