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

Auto useitem healing Archlight

speery

New Member
Joined
Mar 16, 2017
Messages
26
Reaction score
1
I'm playing ArchLight server from @Sir Knighter

But healing there is a little different, you need to use item, not use item and after with you...

So i've tried to change my healing from candybot:
Code:
Helper.safeUseInventoryItemWith(item:getId(), player, BotModule.isPrecisionMode())

Code:
Helper.safeUseInventoryItem(item:getId(), player, BotModule.isPrecisionMode())

But it's healing just one time after active, after dont heal

Full script:
Code:
-- Auto Healing Logic
SupportModule.AutoHeal = {}
AutoHeal = SupportModule.AutoHeal

local nextHeal = {}

local settings = {
  [RestoreType.cast] = 'AutoHeal',
  [RestoreType.item] = 'AutoHealthItem'
}

function AutoHeal.onHealthChange(player, health, maxHealth, oldHealth, restoreType)
  local Panel = SupportModule.getPanel()
  if not Panel:getChildById(settings[restoreType]):isChecked() then
    return -- has since been unchecked
  end

  local itemHealthValue = Panel:getChildById('ItemHealthBar'):getValue()
  local item = Panel:getChildById('CurrentHealthItem'):getItem()

  local lowSpellText = Panel:getChildById('HealSpellText'):getText()
  local lowHealthValue = Panel:getChildById('HealthBar'):getValue()
  local lowManaValue = Panel:getChildById('ManaBar'):getValue()

  if (player:getHealthPercent() < itemHealthValue and item) and restoreType == RestoreType.item then
    if player:hasState(PlayerStates.Pz) then
      return Helper.safeDelay(8000, 12000)
    end
    --Helper.safeUseInventoryItemWith(item:getId(), player, BotModule.isPrecisionMode())
    Helper.safeUseInventoryItem(item:getId(), player, BotModule.isPrecisionMode())
    Helper.safeDelay(2000, 3000)
  elseif (player:getHealthPercent() < lowHealthValue and player:getManaPercent() >= lowManaValue) and restoreType == RestoreType.cast then
    if player:hasState(PlayerStates.Pz) then
      return Helper.safeDelay(8000, 12000)
    end
    g_game.talk(lowSpellText)
    Helper.safeDelay(2000, 3000)
  end

end

function AutoHeal.executeCast(player, health, maxHealth, oldHealth)
  AutoHeal.onHealthChange(player, health, maxHealth, oldHealth, RestoreType.cast)
end

function AutoHeal.ConnectCastListener(listener)
  if g_game.isOnline() then
    local player = g_game.getLocalPlayer()
    addEvent(AutoHeal.onHealthChange(player, player:getHealth(),
      player:getMaxHealth(), player:getHealth(), RestoreType.cast))
  end

  connect(LocalPlayer, { onHealthChange = AutoHeal.executeCast })
end

function AutoHeal.DisconnectCastListener(listener)
  disconnect(LocalPlayer, { onHealthChange = AutoHeal.executeCast })
end

function AutoHeal.executeItem(player, health, maxHealth, oldHealth)
  AutoHeal.onHealthChange(player, health, maxHealth, oldHealth, RestoreType.item)
end

function AutoHeal.ConnectItemListener(listener)
  if g_game.isOnline() then
    local player = g_game.getLocalPlayer()
    addEvent(AutoHeal.onHealthChange(player, player:getHealth(),
      player:getMaxHealth(), player:getHealth(), RestoreType.item))
  end

  connect(LocalPlayer, { onHealthChange = AutoHeal.executeItem })
end

function AutoHeal.DisconnectItemListener(listener)
  disconnect(LocalPlayer, { onHealthChange = AutoHeal.executeItem })
end
 
Back
Top