Log in

View Full Version : Need Help with my targeting



papizak
01-31-2013, 07:25 PM
Bot is changing target really often when targeting distance enemies like lizard Legionnaire or Lizard Dragon Priest also sometimes hit it to "red" and go away. Often lure loots of monster around it causing a bit danger of death.


function equipSoftBoots()
local BOOTS1ID = 6529 -- Soft Boots ID
local SOFTSINUSE = 3549 -- softs being in use
local Backpack = Container.GetFirst()
if (Self.Feet().id == 6530) then
for Spot = 0, Backpack:ItemCount() do
local Boots = Backpack:GetItemData(Spot)
if (Boots.id == DefaultBoots) then
Backpack:MoveItemToEquipment(Spot, "feet")
end
end
elseif (math.floor((Self.Mana() / Self.MaxMana()) * 100)) < ManaToEquip and (Self.Feet().id ~= SOFTSINUSE) then
for Spot = 0, Backpack:ItemCount() do
local Boots = Backpack:GetItemData(Spot)
if (Boots.id == BOOTS1ID) then
Backpack:MoveItemToEquipment(Spot, "feet")
end
end
elseif (math.floor((Self.Mana() / Self.MaxMana()) * 100)) > ManaToEquip and (Self.Feet().id ~= DefaultBoots) then
for Spot = 0, Backpack:ItemCount() do
local Boots = Backpack:GetItemData(Spot)
if (Boots.id == DefaultBoots) then
Backpack:MoveItemToEquipment(Spot, "feet")
end
end
end
end

function equipLifeRing()
local Backpack = Container.GetFirst()
if (Self.Ring().id ~= 3089) then
for Spot = 0, Backpack:ItemCount() do
local Ring = Backpack:GetItemData(Spot)
if (Ring.id == 3052) then
Backpack:MoveItemToEquipment(Spot, "ring")
end
end
end
end

Self.HealthPercent = function ()
return math.abs(Self.Health() / (Self.MaxHealth() * 0.01))
end

function healer()
if (Self.HealthPercent() < 90) and (Self.HealthPercent() > 71) and (Self.CanCastSpell("exura")) then
Self.Say("exura")
elseif (Self.HealthPercent() < 75) and (Self.HealthPercent() > 56) and (Self.CanCastSpell("exura gran")) then
Self.Say("exura gran")
elseif (Self.HealthPercent() < 60) and (Self.CanCastSpell("exura gran san")) then
Self.Say("exura gran san")
end
end

function SpellCast(spell)
local Monster1 = "Lizard High Guard"
local Monster2 = "Lizard Legionnaire"
local Monster3 = "Lizard Dragon Priest"
local Monster4 = "Killer Caiman"
local TargetID = Self.TargetID()
local Target = Creature.GetByID(TargetID)
local pos = Self.Position()
if (Self.CanCastSpell(spell)) and (Target:Name() == Monster1) and (getDistanceBetween(Target:Position(), pos) <= 4) then
Self.Say(spell)
elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster2) and (getDistanceBetween(Target:Position(), pos) <= 4) then
Self.Say(spell)
elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster3) and (getDistanceBetween(Target:Position(), pos) <= 4) then
Self.Say(spell)
elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster4) and (getDistanceBetween(Target:Position(), pos) <= 4) then
Self.Say(spell)
elseif (not Self.MeetsSpellRequirements(spell)) then
print("%s can not be cast. You either lack the mana or required level!", spell)
end
end

while (true) do
healer()
SpellCast("exori san")
equipSoftBoots()
equipLifeRing()
if (Self.DistanceFromPosition(33197, 31347, 6) < 1) then
gotoLabel("AfterTP")
wait(1000)
elseif (Self.DistanceFromPosition(33144, 31248, 6) < 1) then
gotoLabel("AfterTP1")
wait(1000)
elseif (Self.DistanceFromPosition(33200, 31347, 6) < 1) then
gotoLabel("AfterTP2")
wait(1000)
elseif Self.ItemCount(236) >= 1 and (Self.HealthPercent() <= 65) then
Self.UseItemWithMe(236)
sleep(math.random(200, 600))
elseif Self.ItemCount(283) >= (math.random(10, 15)) then
Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 283, 284, 285)
elseif Self.ItemCount(10328) > 0 then
Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 10328)
elseif Self.ItemCount(3450) >= 1 then
local MainBp = Container.GetFirst()
local DestinationBp = Container.GetByName(BoltsBp)
for spot = 0, MainBp:ItemCount() do
local item = MainBp:GetItemData(spot)
if (item.id == 3450) then
MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
wait(500)
break
end
end
end
wait(200)
end