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

permanent bonus

  • Thread starter Thread starter verdehile95
  • Start date Start date
V

verdehile95

Guest
Hello, I am looking for a potion code that gives the player a permanent bonus of 25 hp and mana
 
Solution
If the bonus is permanent, simply increase its maximum life/mana and that's it.

This could be a simple option for TFS 1.x+
LUA:
local POTION_ID = 0000
local storageKey = 00000

local extraHP = 25
local extraMP = 25

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local storageValue = tonumber(player:getStorageValue(storageKey)) or -1
    if storageValue ~= -1 then
        player:sendCancelMessage("You have already used this potion.")
        return true
    end

    player:setStorageValue(storageKey, 1)
    player:setMaxHealth(player:getMaxHealth() + extraHP)
    player:setMaxMana(player:getMaxMana() + extraMP)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format(
        "You...
If the bonus is permanent, simply increase its maximum life/mana and that's it.

This could be a simple option for TFS 1.x+
LUA:
local POTION_ID = 0000
local storageKey = 00000

local extraHP = 25
local extraMP = 25

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local storageValue = tonumber(player:getStorageValue(storageKey)) or -1
    if storageValue ~= -1 then
        player:sendCancelMessage("You have already used this potion.")
        return true
    end

    player:setStorageValue(storageKey, 1)
    player:setMaxHealth(player:getMaxHealth() + extraHP)
    player:setMaxMana(player:getMaxMana() + extraMP)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format(
        "You have used a potion and gained %d extra HP and %d extra MP.",
        extraHP, extraMP))
    item:remove(1)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end

action:id(POTION_ID)
action:register()
 
Solution
If the bonus is permanent, simply increase its maximum life/mana and that's it.

This could be a simple option for TFS 1.x+
LUA:
local POTION_ID = 0000
local storageKey = 00000

local extraHP = 25
local extraMP = 25

local action = Action()

function action.onUse(player, item, fromPos, target, toPos, isHotkey)
    local storageValue = tonumber(player:getStorageValue(storageKey)) or -1
    if storageValue ~= -1 then
        player:sendCancelMessage("You have already used this potion.")
        return true
    end

    player:setStorageValue(storageKey, 1)
    player:setMaxHealth(player:getMaxHealth() + extraHP)
    player:setMaxMana(player:getMaxMana() + extraMP)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format(
        "You have used a potion and gained %d extra HP and %d extra MP.",
        extraHP, extraMP))
    item:remove(1)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end

action:id(POTION_ID)
action:register()
Thanks
 
Se o bônus for permanente, basta aumentar sua vida/mana máxima e imediatamente.

Esta pode ser uma opção simples para o TFS 1.x+
LUA:
POTION_ID local = 0000
chave de armazenamento local = 00000

HP extra local = 25
MP extra local = 25

ação local = Ação()

função action.onUse(jogador, item, fromPos, alvo, toPos, isHotkey)
    valor de armazenamento local = tonumber(player:getStorageValue(storageKey)) ou -1
    se storageValue ~= -1 então
        player:sendCancelMessage("Você já usou essa poção.")
        retornar verdadeiro
    fim

    jogador:setStorageValue(chave de armazenamento, 1)
    jogador:setMaxHealth(jogador:getMaxHealth() + extraHP)
    jogador:setMaxMana(jogador:getMaxMana() + extraMP)
    jogador:sendTextMessage(MESSAGE_INFO_DESCR, string.format(
        "Você usou uma poção e ganhou %d HP e %d MP extras.",
        HP extra, MP extra))
    item:removedor(1)
    jogador:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    retornar verdadeiro
fim

ação:id(POTION_ID)
ação:registrar()
E É possível ter um script com 2 poções, onde uma aumenta o dano em 50% e a outra reduz o dano recebido em 50%? Only during the effect of the potions, which in this case would be 10 minutes.
 

Similar threads

  • Question Question
Replies
4
Views
318
Xikini
X
Back
Top