For the most part it works, but sometimes it won't follow the character and I have to manually click on character icon and select follow, then the script continues working normally.
Can anyone tell me any areas where I might increase the efficiency of this script and/or where it may be causing that little problem of not always following? Here's the script:
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
--=============== My follow/heal member Script ====================
--===============================================================
--
--
--================================================================
<onLoad><![CDATA[
function doMount()
if not player.Mounted then
player:mount()
yrest(500)
end
speed()
end
--============ Set variables ====================
myfriend = "Friendname" -- This is where I put in the name of the character I want to follow and heal
char = player:findNearestNameOrId(myfriend)
--============ Disable skills ====================
for k,v in pairs(settings.profile.skills) do
v.AutoUse = false
yrest(50)
end
--============= main routine starting: =====================
while(true) do
if not player.Mounted then
-- THIS IS THE SECTION THAT HAPPENS WHILE BOT IS NOT MOUNTED:
-- This part watches the bot's health to heal himself:
if 85 > (player.HP/player.MaxHP*100) then
player:clearTarget();
yrest(10)
keyboardPress( key.VK_E )
yrest(500)
end
--Then it will check my friend's HP (friend being the character I am playing manually)
player:target(char)
yrest(10)
myTarget = player:getTarget();
if myTarget.Name == myfriend then
if 80 > (myTarget.HP/myTarget.MaxHP*100) then
sendMacro("/cast Urgent Heal")
yrest(100)
end
-- If I see that "friend" is mounted, then bot will mount.
if myTarget.Mounted then
doMount()
end
-- after healing and mounting if needed, always follow up with a follow.
RoMScript("FollowUnit('myTarget');");
end
else
-- THIS IS THE SECTION THAT HEPPENS IF THE BOT IS MOUNTED
-- I don't want to watch HP and cast heal because it can slow down traveling through mobs. Instead, I will watch my health and dismount if I feel I need a heal.
player:target(char)
yrest(10)
myTarget = player:getTarget();
if myTarget.Name == myfriend then
if not myTarget.Mounted then --WHEN MOUNTED, IF MY FRIEND IS NOT MOUNTED, I CAST REGENERATE TO DISMOUNT
sendMacro("/cast Regenerate")
speed()
end
RoMScript("FollowUnit('myTarget');");
end
end
yrest(1000)
player:update()
end
]]></onLoad>
</waypoints>