Help with non-party follow/heal script

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Help with non-party follow/heal script

#1 Post by noobbotter » Wed Aug 27, 2014 9:52 am

Hi guys. I have been using this little script I made to allow a healer bot to follow me and heal me while not in a party (being in party while killing mobs doesn't give me as much XP/TP). So this is supposed to operate kind of similar to the Party Heal function/script, but I don't want to be in a party.

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>
Thanks.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Help with non-party follow/heal script

#2 Post by lisa » Thu Aug 28, 2014 2:08 am

*peers around the corner for a look*

ok I shall be brutal muhahahahah

This is probably the main issue your having is you don't have a target when you try to follow your target.

Code: Select all

RoMScript("FollowUnit('myTarget');");
that needs to be

Code: Select all

RoMScript("FollowUnit('target');");
and it will only follow your current target, so if you have no target then you have nothing to follow, you can't use the in game FollowUnit command to follow a pawn of the bot.

Ok now to make things simpler for you.

for follow just do

Code: Select all

getNameFollow()
In your profile make sure to have the characters name you want to follow in the option, PARTY_FOLLOW_NAME
Example.

Code: Select all

<option name="PARTY_FOLLOW_NAME" 	value="Charname" /> 
it will also handle mounting for you.

For healing you can use the profile skills and not disable them.

Code: Select all

char = CPawn(player:findNearestNameOrId(settings.profile.options.PARTY_FOLLOW_NAME).Address)
player:target(player)
player:checkSkills(true)
player:target(char)
player:checkSkills(true)
getNameFollow()
That is pretty much all you need, untested, only issue might be in the CPawn bit.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests