need assistance with my healerhelper script
Posted: Thu Aug 13, 2015 7:42 am
Hi everyone. I was creating a custom healer function to use when farming easy mode bosses. I would run this script on my healer and it does a real good job of following the payer I'm playing manually and keeping us both healed (I didn't use the default party healer script because I also use this in other areas when we're not necessarily in a party together, and also because I wanted to change the distance at which the healer follows). I plan to make a different copy of this for different instances and customizing each for that specific instance requirements (such as if need serenstum before boss fight or at certain boss HP percentages).
The problem I'm faced with right now is when after I kill the boss if I decide to run out of instance to come back in (farming it). I run my DPS char out of instance and of course now my healer doesn't see him so he stops. I don't have a problem alt tabbing to manually move the healer out of instance and back in, but the script always errors out when I do so. I'm assuming it's because the healer's address changes after porting out? What would you suggest for how to fix that?
I just thought about the possibility of adding a part in the spot where when party member (calling it that, though not always in a party) is not found to check for a nearby portal and if there is one, to go through it. I wonder if that would fix the problem?
Here's my script in case anyone wants to dissect it to help me figure out how to fix it.
The problem I'm faced with right now is when after I kill the boss if I decide to run out of instance to come back in (farming it). I run my DPS char out of instance and of course now my healer doesn't see him so he stops. I don't have a problem alt tabbing to manually move the healer out of instance and back in, but the script always errors out when I do so. I'm assuming it's because the healer's address changes after porting out? What would you suggest for how to fix that?
I just thought about the possibility of adding a part in the spot where when party member (calling it that, though not always in a party) is not found to check for a nearby portal and if there is one, to go through it. I wonder if that would fix the problem?
Here's my script in case anyone wants to dissect it to help me figure out how to fix it.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
--=============== My follow/heal member Script ====================
--===============================================================
--================================================================
<onLoad><![CDATA[
loadProfile("myhealerprofile")
whoToFollow = "toonnametofollow" --changed to protect the innocent
--============ Disable skills and enable Healing ====================
for k,v in pairs(settings.profile.skills) do
v.AutoUse = false
end
useMySkills = false
settings.profile.options.LOOT = false
settings.profile.options.LOOT_ALL = false
settings.profile.options.EGGPET_ENABLE_ASSIST = true
speed()
function toggleSkills(status) -- toggleSkills is to be called when the healer running this script needs to enable or disable certain skills (when player being followed dies or gets revived)
if player.Class1 == CLASS_PRIEST then
if status == false then -- if status == false this means called the command to disable skills
if useMySkills == true then --useMySkills is basically the current status of the skills: true = enabled, false = disabled
changeProfileSkill("PRIEST_URGENT_HEAL" , "AutoUse", false)
changeProfileSkill("PRIEST_ICEWIND_BLADE" , "AutoUse", false)
changeProfileSkill("MAGE_FIREBALL" , "AutoUse", false)
changeProfileSkill("MAGE_LIGHTNING" , "AutoUse", false)
changeProfileSkill("MAGE_SILENCE" , "AutoUse", false)
useMySkills = false
end
else -- want to turn skills on so if they are currently disabled, enable them
if useMySkills == false then
changeProfileSkill("PRIEST_URGENT_HEAL" , "AutoUse", true)
changeProfileSkill("PRIEST_ICEWIND_BLADE" , "AutoUse", true)
changeProfileSkill("MAGE_FIREBALL" , "AutoUse", true)
changeProfileSkill("MAGE_LIGHTNING" , "AutoUse", true)
changeProfileSkill("MAGE_SILENCE" , "AutoUse", true)
useMySkills = true
end
end
elseif player.Class1 == CLASS_MAGE then -- same as above except this is if mage class is primary (priest class secondary)
if status == false then
if useMySkills == true then
changeProfileSkill("PRIEST_URGENT_HEAL" , "AutoUse", false)
changeProfileSkill("MAGE_FLAME" , "AutoUse", false)
changeProfileSkill("MAGE_FIREBALL" , "AutoUse", false)
changeProfileSkill("MAGE_LIGHTNING" , "AutoUse", false)
changeProfileSkill("MAGE_PURGATORY_FIRE" , "AutoUse", false)
changeProfileSkill("MAGE_SILENCE" , "AutoUse", false)
changeProfileSkill("MAGE_INTENSIFICATION" , "AutoUse", false)
changeProfileSkill("MAGE_ELEMENTAL_CATALYSIS" , "AutoUse", false)
useMySkills = false
end
else
if useMySkills == false then
changeProfileSkill("PRIEST_URGENT_HEAL" , "AutoUse", true)
changeProfileSkill("MAGE_FLAME" , "AutoUse", true)
changeProfileSkill("MAGE_FIREBALL" , "AutoUse", true)
changeProfileSkill("MAGE_LIGHTNING" , "AutoUse", true)
changeProfileSkill("MAGE_PURGATORY_FIRE" , "AutoUse", true)
changeProfileSkill("MAGE_SILENCE" , "AutoUse", true)
changeProfileSkill("MAGE_INTENSIFICATION" , "AutoUse", true)
changeProfileSkill("MAGE_ELEMENTAL_CATALYSIS" , "AutoUse", true)
useMySkills = true
end
end
end
end
function findFriend(friendName)
localfriend = player:findNearestNameOrId(friendName)
if not localfriend then
-- my new section for when party member not found:
repeat
localfrienddistance = 1000
localfriend = player:findNearestNameOrId(friendName)
yrest(500)
if localfriend then
localfriend = CPawn(localfriend.Address)
localfrienddistance = distance(localfriend.X,localfriend.Z,player.X,player.Z)
end
until localfriend and 999 > localfrienddistance
--==================================================
else
localfriend = CPawn(localfriend.Address)
end
return true
end
-- updated custom follow function:
function hb_getNameFollow()
player:updateXYZ()
local whofollow
whofollow = player:findNearestNameOrId(whoToFollow)
if not whofollow then
-- my new section for when party member not found:
repeat -- going to repeat this loop until party member is found and is relatively close by (less than 1000)
whofollowdistance = 1000
whofollow = player:findNearestNameOrId(whoToFollow)
yrest(500)
if whofollow then
whofollow = CPawn(whofollow.Address)
whofollowdistance = distance(whofollow.X,whofollow.Z,player.X,player.Z)
end
until whofollow and 999 > whofollowdistance
--==================================================
else -- this runs if party member is found:
whofollow = CPawn(whofollow.Address)
end
if whofollow then
if distance(whofollow.X,whofollow.Z,player.X,player.Z) > 225 then -- this is the follow function. seems to work well... stay way back from party member but within heal range.
player:moveTo(CWaypoint(whofollow.X,whofollow.Z),true,nil,200)
end
-- player:target(whofollow)
-- RoMCode("FollowUnit('target');"); -- disabled these lines. the in-game follow follows too close for my comfort (Boss AOE hits healer)
-- Mount()
local mounted = whofollow.Mounted
printf("mounted = %s\n",mounted)
--mounted = bitAnd(attackableFlag, 0x10000000)
if not player.Mounted then
if mounted then
player:mount()
end
end
if not mounted then
if player.Mounted then
player:dismount()
end
end
end
end
--============= main routine starting: =====================
while(true) do
useGoodie("Casting")
if findFriend(whoToFollow) then
char = CPawn(player:findNearestNameOrId(whoToFollow).Address)
char:updateHP() -- char is always the person I'm following
char:updateAlive()
player:updateHP() -- player is the healer running this script
player:updateAlive()
charHPpct = (char.HP/char.MaxHP*100)
playerHPpct = (player.HP/player.MaxHP*100)
if player:isAlive() then
if char:isAlive() then -- if party member is alive:
toggleSkills(false)
if playerHPpct >= 98 and charHPpct >= 98 then
yrest(50)
elseif playerHPpct > charHPpct then -- if healer has more hp% than party member, heal party member first
if 30 > charHPpct then -- had this line because was going to use soul source but disabled it for now
--player:cast("PRIEST_SOUL_SOURCE");
player:target(char)
player:cast("PRIEST_HEAL");
elseif 60 > charHPpct then
player:target(char)
player:cast("PRIEST_HEAL");
elseif 98 > charHPpct then
player:target(char)
player:cast("PRIEST_URGENT_HEAL");
elseif 60 > playerHPpct then
player:target(player)
player:cast("PRIEST_HEAL");
elseif 98 > playerHPpct then
player:target(player)
player:cast("PRIEST_URGENT_HEAL");
end
elseif charHPpct >= playerHPpct then -- if healer has fewer HP, heal self first
if 30 > playerHPpct then
player:cast("PRIEST_SOUL_SOURCE");
player:target(player)
player:cast("PRIEST_HEAL");
elseif 60 > playerHPpct then
player:target(player)
player:cast("PRIEST_HEAL");
elseif 98 > playerHPpct then
player:target(player)
player:cast("PRIEST_URGENT_HEAL");
elseif 60 > charHPpct then
player:target(char)
player:cast("PRIEST_HEAL");
elseif 98 > charHPpct then
player:target(char)
player:cast("PRIEST_URGENT_HEAL");
end
end
hb_getNameFollow() -- run command to make sure I'm following party member
else -- party member is not alive... enable skills buff self, heal and fight
toggleSkills(true)
repeat
if not player:hasBuff(500527) then
player:cast("PRIEST_HEALING_SALVE");
end
if 30 > playerHPpct then -- if low on HP, first save self
player:cast("PRIEST_HOLY_AURA");
useGoodie("casting")
player:cast("PRIEST_URGENT_HEAL");
elseif 75 > playerHPpct then -- if low on HP, first save self
useGoodie("casting")
player:cast("PRIEST_URGENT_HEAL");
else -- once my HP is high enough, increase casting speed and then burn target with flame.
player:findTarget()
player:fight()
end
until not player:isAlive() or player.Battling == false
end
yrest(50)
else
sleep() -- if healer dies, script goes to sleep
end
end
end
]]></onLoad>
</waypoints>