• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Pair Of Soft Boots that regenerate by percentage

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
1,222
Solutions
137
Reaction score
1,511
Location
London
GitHub
MillhioreBT
Twitch
millhiore_bt
YouTube
millhiorebt
You need to remove the active and inactive Id settings in items.xml, in this case the pair of soft boots, 2640 and 6132
You should also delete the configuration of movements.xml

Then you can use the following script to have your pair of soft boots with percentage regeneration that is updated when you level up so that it always regenerates the real amount of % according to your maximum health:
data/scripts/pair_of_soft_boots.lua
Lua:
local config = {
    activeId = 2640,
    inactiveId = 6132,
    level = 8,
    slot = "feet",
    healthGainPercent = 5,
    healthTicks = 1000,
    manaGainPercent = 5,
    manaTicks = 1000,
}

local isItemAbilityEnabled = {}

local moveEvent = MoveEvent()

function moveEvent.onEquip(player, item, slot, isCheck)
    if player:getLevel() < config.level then
        return RETURNVALUE_NOERROR
    end

    if isCheck then
        return RETURNVALUE_NOERROR
    end

    if isItemAbilityEnabled[player:getId()] then
        return RETURNVALUE_NOERROR
    else
        isItemAbilityEnabled[player:getId()] = true
    end

    item:transform(config.activeId)
    local conditionRegeneration = Condition(CONDITION_REGENERATION, CONDITIONID_FEET)
    conditionRegeneration:setTicks(-1)
    conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHGAIN, player:getMaxHealth() * config.healthGainPercent / 100)
    conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHTICKS, config.healthTicks)
    conditionRegeneration:setParameter(CONDITION_PARAM_MANAGAIN, player:getMaxMana() * config.manaGainPercent / 100)
    conditionRegeneration:setParameter(CONDITION_PARAM_MANATICKS, config.manaTicks)
    player:addCondition(conditionRegeneration)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    player:say("The pair of soft boots have been activated.", TALKTYPE_MONSTER_SAY)
    return RETURNVALUE_NOERROR
end

moveEvent:id(config.inactiveId)
moveEvent:level(config.level)
moveEvent:slot(config.slot)
moveEvent:register()

local moveEvent = MoveEvent()

function moveEvent.onDeEquip(player, item, slot)
    isItemAbilityEnabled[player:getId()] = nil
    item:transform(config.inactiveId)
    player:removeCondition(CONDITION_REGENERATION, CONDITIONID_FEET)
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:say("The pair of soft boots have been deactivated.", TALKTYPE_MONSTER_SAY)
    return RETURNVALUE_NOERROR
end

moveEvent:id(config.activeId)
moveEvent:level(config.level)
moveEvent:slot(config.slot)
moveEvent:register()

local creatureEvent = CreatureEvent("playerRegenerationUpdate")

function creatureEvent.onAdvance(player, skill, oldLevel, newLevel)
    if skill == SKILL_LEVEL then
        player:removeCondition(CONDITION_REGENERATION, CONDITIONID_FEET)
        local conditionRegeneration = Condition(CONDITION_REGENERATION, CONDITIONID_FEET)
        conditionRegeneration:setTicks(-1)
        conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHGAIN, player:getMaxHealth() * config.healthGainPercent / 100)
        conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHTICKS, config.healthTicks)
        conditionRegeneration:setParameter(CONDITION_PARAM_MANAGAIN, player:getMaxMana() * config.manaGainPercent / 100)
        conditionRegeneration:setParameter(CONDITION_PARAM_MANATICKS, config.manaTicks)
        player:addCondition(conditionRegeneration)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
        player:say("The pair of soft boots have been updated.", TALKTYPE_MONSTER_SAY)
    end
    return true
end

creatureEvent:register()

local creatureEvent = CreatureEvent("playerRegenerationLogin")

function creatureEvent.onLogin(player)
    player:registerEvent("playerRegenerationUpdate")
    return true
end

creatureEvent:register()
GIF 27-08-2022 03-51-47 a. m..gif
 

diegolimax

New Member
Joined
Jul 1, 2015
Messages
11
Reaction score
1
You need to remove the active and inactive Id settings in items.xml, in this case the pair of soft boots, 2640 and 6132
You should also delete the configuration of movements.xml

Then you can use the following script to have your pair of soft boots with percentage regeneration that is updated when you level up so that it always regenerates the real amount of % according to your maximum health:
data/scripts/pair_of_soft_boots.lua
Lua:
local config = {
    activeId = 2640,
    inactiveId = 6132,
    level = 8,
    slot = "feet",
    healthGainPercent = 5,
    healthTicks = 1000,
    manaGainPercent = 5,
    manaTicks = 1000,
}

local isItemAbilityEnabled = {}

local moveEvent = MoveEvent()

function moveEvent.onEquip(player, item, slot, isCheck)
    if player:getLevel() < config.level then
        return RETURNVALUE_NOERROR
    end

    if isCheck then
        return RETURNVALUE_NOERROR
    end

    if isItemAbilityEnabled[player:getId()] then
        return RETURNVALUE_NOERROR
    else
        isItemAbilityEnabled[player:getId()] = true
    end

    item:transform(config.activeId)
    local conditionRegeneration = Condition(CONDITION_REGENERATION, CONDITIONID_FEET)
    conditionRegeneration:setTicks(-1)
    conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHGAIN, player:getMaxHealth() * config.healthGainPercent / 100)
    conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHTICKS, config.healthTicks)
    conditionRegeneration:setParameter(CONDITION_PARAM_MANAGAIN, player:getMaxMana() * config.manaGainPercent / 100)
    conditionRegeneration:setParameter(CONDITION_PARAM_MANATICKS, config.manaTicks)
    player:addCondition(conditionRegeneration)
    player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    player:say("The pair of soft boots have been activated.", TALKTYPE_MONSTER_SAY)
    return RETURNVALUE_NOERROR
end

moveEvent:id(config.inactiveId)
moveEvent:level(config.level)
moveEvent:slot(config.slot)
moveEvent:register()

local moveEvent = MoveEvent()

function moveEvent.onDeEquip(player, item, slot)
    isItemAbilityEnabled[player:getId()] = nil
    item:transform(config.inactiveId)
    player:removeCondition(CONDITION_REGENERATION, CONDITIONID_FEET)
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:say("The pair of soft boots have been deactivated.", TALKTYPE_MONSTER_SAY)
    return RETURNVALUE_NOERROR
end

moveEvent:id(config.activeId)
moveEvent:level(config.level)
moveEvent:slot(config.slot)
moveEvent:register()

local creatureEvent = CreatureEvent("playerRegenerationUpdate")

function creatureEvent.onAdvance(player, skill, oldLevel, newLevel)
    if skill == SKILL_LEVEL then
        player:removeCondition(CONDITION_REGENERATION, CONDITIONID_FEET)
        local conditionRegeneration = Condition(CONDITION_REGENERATION, CONDITIONID_FEET)
        conditionRegeneration:setTicks(-1)
        conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHGAIN, player:getMaxHealth() * config.healthGainPercent / 100)
        conditionRegeneration:setParameter(CONDITION_PARAM_HEALTHTICKS, config.healthTicks)
        conditionRegeneration:setParameter(CONDITION_PARAM_MANAGAIN, player:getMaxMana() * config.manaGainPercent / 100)
        conditionRegeneration:setParameter(CONDITION_PARAM_MANATICKS, config.manaTicks)
        player:addCondition(conditionRegeneration)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
        player:say("The pair of soft boots have been updated.", TALKTYPE_MONSTER_SAY)
    end
    return true
end

creatureEvent:register()

local creatureEvent = CreatureEvent("playerRegenerationLogin")

function creatureEvent.onLogin(player)
    player:registerEvent("playerRegenerationUpdate")
    return true
end

creatureEvent:register()
View attachment 70129
in case I can do with any item? just change the Slot and the item ID only?
 
Top