Warden Pet [Heavy Mod]

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
iam_clint
Posts: 9
Joined: Sat Jan 23, 2010 11:22 pm

Warden Pet [Heavy Mod]

#1 Post by iam_clint » Sun Jan 24, 2010 7:38 am

player.lua new function

Code: Select all

function CPlayer:petHeal()
	if ( settings.profile.options.PET_HEAL ) then
		self:update();
		while ((self.petHP/self.petMaxHP*100) < settings.profile.options.PET_HEAL_PCT) do
			cprintf(cli.yellow, "Pet heal! Pet Health [%i/%i]\n", self.petHP, self.petMaxHP);
			self:update();	
			keyboardPress( settings.hotkeys.TARGET_PET.key );
			yrest(50);
			keyboardRelease(settings.hotkeys.MOVE_FORWARD.key);
			keyboardPress( key[settings.profile.options.PET_HEAL_KEY] );
			yrest(4000);
		end;
	end;
end
Mod checkPotions function -- Figured this would be a good place to heal

Code: Select all

function CPlayer:checkPotions()

	self:petHeal();

player.lua, everywhere you see

Code: Select all

target.TargetPtr ~= self.Address
change to

Code: Select all

and target.TargetPtr ~= self.PetPtr
result

Code: Select all

target.TargetPtr ~= self.Address and target.TargetPtr ~= self.PetPtr
check_aggro_before_cast mod

Code: Select all

if( target.TargetPtr == self.Address or target.TargetPtr == self.PetPtr) then	-- it is the right aggressor

in moveto function -- put this directly above the other if self.battling

Code: Select all

self:update();	
		if (self.Battling and self.petTarget~=0 and self.TargetPtr==0) then --assist your pet
			cprintf(cli.yellow, "Assisting Pet\n");
			keyboardPress( settings.hotkeys.TARGET_PET.key );
			yrest(100);
			keyboardPress( settings.hotkeys.ASSIST_KEY.key );
			yrest(100);
			self:fight();
			failreason = WF_COMBAT;
			break;
		end;
modify the inside moveto

Code: Select all

if( self.Battling and self.petTarget~=0	and		-- we have aggro
	 	    self.Fighting == false  and		-- we are not coming from the fight routines (bec. as melee we should move in fight)
	 	    waypoint.Type ~= WPT_RUN  and	-- only stop if not waypoint type RUN
			waypoint.Type ~= WPT_TRAVEL and
	 	    os.difftime(os.time(), player.LastAggroTimout ) > 10 ) then		-- dont stop 10sec after last aggro wait timeout
			keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
			keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
			keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
			success = false;
			failreason = WF_COMBAT;
			break;
		end;
in update

Code: Select all

self.petTarget =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnTargetPtr_offset), language[41]);

Code: Select all

self.PetPtr = debugAssert(memoryReadInt(getProc(), self.Address + addresses.pawnPetPtr_offset), language[41]);
self.petHP =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnHP_offset), language[41]);
self.petMaxHP =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnMaxHP_offset), language[41]);
self.petTarget =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnTargetPtr_offset), language[41]);


pawn.lua define these variable in the cpawn class

Code: Select all

self.PetPtr = 0;
self.petHP = 0;
self.petMaxHP = 0;
cpawn update

Code: Select all

	self.PetPtr = debugAssert(memoryReadInt(proc, self.Address + addresses.pawnPetPtr_offset), memerrmsg);
	self.petTarget = debugAssert(memoryReadInt(proc, self.Address + addresses.pawnTargetPtr_offset), memerrmsg);
	self.petHP =  debugAssert(memoryReadInt(proc, self.PetPtr + addresses.pawnHP_offset), memerrmsg);
	self.petMaxHP =  debugAssert(memoryReadInt(proc, self.PetPtr + addresses.pawnMaxHP_offset), memerrmsg);

settings.lua hotkeys

Code: Select all

	ASSIST_KEY = {key = _G.key.VK_F, modifier = nil},
	TARGET_PET = {key = _G.key.VK_F2, modifier = nil}
profile options

Code: Select all

			PET_HEAL_PCT=50,
			PET_HEAL_KEY="VK_6",
			PET_HEAL = false,

Profile XML for your character

Code: Select all

		<option name="PET_HEAL"			value="true" />
		<option name="PET_HEAL_KEY"			value="VK_2" />
		<option name="PET_HEAL_PCT"			value="95" />


I believe I got all the modifications posted in here to make you assist your pet and heal your pet.

Another mod i've made myself.
Last edited by iam_clint on Sun Jan 24, 2010 3:28 pm, edited 1 time in total.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Warden Pet [Heavy Mod]

#2 Post by Exempt » Sun Jan 24, 2010 1:24 pm

What are you using to open the .lua files?

iam_clint
Posts: 9
Joined: Sat Jan 23, 2010 11:22 pm

Re: Warden Pet [Heavy Mod]

#3 Post by iam_clint » Sun Jan 24, 2010 2:44 pm

i'm using notepad++

InadequateCoder
Posts: 33
Joined: Fri Jan 22, 2010 1:23 am

Re: Warden Pet [Heavy Mod]

#4 Post by InadequateCoder » Sun Jan 24, 2010 5:26 pm

iam_clint wrote:i'm using notepad++
I forget where to download that from. Post a link?

iam_clint
Posts: 9
Joined: Sat Jan 23, 2010 11:22 pm

Re: Warden Pet [Heavy Mod]

#5 Post by iam_clint » Sun Jan 24, 2010 5:28 pm

InadequateCoder wrote:
iam_clint wrote:i'm using notepad++
I forget where to download that from. Post a link?
http://notepad-plus.sourceforge.net/uk/site.htm

InadequateCoder
Posts: 33
Joined: Fri Jan 22, 2010 1:23 am

Re: Warden Pet [Heavy Mod]

#6 Post by InadequateCoder » Sun Jan 24, 2010 8:55 pm

Tyvm :D

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Warden Pet [Heavy Mod]

#7 Post by Administrator » Sun Jan 24, 2010 11:17 pm

You'll notice that player.PetPtr and player.Pet already exist (inherited from CPawn). It would make more sense to use these instead of reimplementing them. For instance, instead of making a copy of petHP in the player class, just grab it out of the pet's class.

Code: Select all

if( self.PetPtr ) then
  if( self.Pet.HP/self.Pet.MaxHP*100 < somePercentage ) then
    -- do something
  end
end
Also, I think petHeal() could be improved. Here's some pseudo-code:

Code: Select all

if( self.PetPtr == 0 ) then
  return; -- We don't have a pet
end;

local origTarget = self.TargetPtr; -- the target we are attacking
self.TargetPtr = self.PetPtr; -- target our pet


for i,v in pairs(settings.profile.skills) do
  if( this skill is a pet heal skill ) then
    self:cast(v); -- cast it
  end
end

self.TargetPtr = origTarget; -- we're back to our original target
This would require less configuration on the users' part (as they won't have to set up specific hotkeys for the heals; they just add them to their skill list in the profile). Plus, it should be less buggy, as the target swapping is almost guaranteed to be accurate and on-time.

iam_clint
Posts: 9
Joined: Sat Jan 23, 2010 11:22 pm

Re: Warden Pet [Heavy Mod]

#8 Post by iam_clint » Sun Jan 24, 2010 11:41 pm

Administrator wrote:You'll notice that player.PetPtr and player.Pet already exist (inherited from CPawn). It would make more sense to use these instead of reimplementing them. For instance, instead of making a copy of petHP in the player class, just grab it out of the pet's class.

Code: Select all

if( self.PetPtr ) then
  if( self.Pet.HP/self.Pet.MaxHP*100 < somePercentage ) then
    -- do something
  end
end
Also, I think petHeal() could be improved. Here's some pseudo-code:

Code: Select all

if( self.PetPtr == 0 ) then
  return; -- We don't have a pet
end;

local origTarget = self.TargetPtr; -- the target we are attacking
self.TargetPtr = self.PetPtr; -- target our pet


for i,v in pairs(settings.profile.skills) do
  if( this skill is a pet heal skill ) then
    self:cast(v); -- cast it
  end
end

self.TargetPtr = origTarget; -- we're back to our original target
This would require less configuration on the users' part (as they won't have to set up specific hotkeys for the heals; they just add them to their skill list in the profile). Plus, it should be less buggy, as the target swapping is almost guaranteed to be accurate and on-time.

Thanks for the suggestions.. I haven't entirely been through the code i've just been adding in what i've needed figured I would post.


I tried manually changing the target pointer for myself and it didn't seem to change my target is that what you are doing here?

Code: Select all

self.TargetPtr = self.PetPtr; -- target our pet
if so thats great didn't know I could do that.


I probably should have looked through the classes before implementing my own changes but what can I say I downloaded the bot 2 days ago heh. Nice development on micromacro btw.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Warden Pet [Heavy Mod]

#9 Post by Administrator » Mon Jan 25, 2010 1:13 am

Actually, yeah, don't know what I was thinking there. It should be more like this:

Code: Select all

local origTarget = self.TargetPtr; -- the target we are attacking
memoryWriteInt(getProc(), self.Address + addresses.pawnTargetPtr_offset, self.PetPtr); -- target our pet

memoryWriteInt(getProc(), self.Address + addresses.pawnTargetPtr_offset, origTarget); -- target our original target

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: Warden Pet [Heavy Mod]

#10 Post by fred55555 » Thu Aug 19, 2010 3:15 pm

ok So looks kind of confusing

Can anyone simplify it for me so I can add it to my character.xml

just need check pet health if it is lower than 75% then ill cast a druid recover on it, not worried about targeting the last target just want the pet healed up over 75% and move onto next mob.

pretty please and thnx

sdude13
Posts: 76
Joined: Thu Aug 19, 2010 9:36 am

Re: Warden Pet [Heavy Mod]

#11 Post by sdude13 » Thu Aug 19, 2010 3:24 pm

healing another party member should also be possible that way no ?
;)

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: Warden Pet [Heavy Mod]

#12 Post by fred55555 » Fri Aug 20, 2010 2:13 pm

from what i read there is not function to call or target another person builkd in.

but there is a function call for the pet to be targeted.

would like to still get a simplified syntax of

check pet health
heal with "recover" if pet hp below 75%
continue on

Valleyguy
Posts: 100
Joined: Wed Aug 04, 2010 11:34 pm
Location: Canada

Re: Warden Pet [Heavy Mod]

#13 Post by Valleyguy » Fri Aug 20, 2010 8:24 pm

sdude13 wrote:healing another party member should also be possible that way no ?
;)
I wish this was possible and youd think it would be a easy mod ... I just dont have a clue where to start ...

i.e. profile option "HealBot" = "true/false" (tells it if its gonna fight like normal bot or just be a healbot and only fight back the aggros on the bot (Something like what RBAssist allready does)

"HealBotName" = "playerName" of the player the bot will constantly /follow and monitor health

rest is allready there in the skills options if hppr="50" would mean if either your HP or the Targets HP falls below 50% cast the skill.

I just don't know how to add the functions for the follow and heal monitor as well as incorporating what RBAssist allready is doing with maintaining the HP monitor..
Image

Valleyguy
Posts: 100
Joined: Wed Aug 04, 2010 11:34 pm
Location: Canada

Re: Warden Pet [Heavy Mod]

#14 Post by Valleyguy » Fri Aug 20, 2010 8:49 pm

another thought to start forget even fighting back just maintain a target on the character you have the healbot on monitor its HP hen low cast a heal ... .. shoudl be possible cause all the code is allready in there monitoring a targets HP for fighting just reverse it with some calls for healing ... himm brain hurts lol ...
Image

Valleyguy
Posts: 100
Joined: Wed Aug 04, 2010 11:34 pm
Location: Canada

Re: Warden Pet [Heavy Mod]

#15 Post by Valleyguy » Sat Aug 21, 2010 7:42 pm

Admin:

in this code i assume hes pulling down the memory addresses to assign to the self.pet functions? this is the part i am foggy with :

Code: Select all

self.PetPtr = debugAssert(memoryReadInt(getProc(), self.Address + addresses.pawnPetPtr_offset), language[41]);
self.petHP =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnHP_offset), language[41]);
self.petMaxHP =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnMaxHP_offset), language[41]);
self.petTarget =  debugAssert(memoryReadInt(getProc(), self.PetPtr + addresses.pawnTargetPtr_offset), language[41]);
is there memory addresses to pull down (there must be cause healbot 2 and those other addons pull down HP checks on raids and party's.. ) i just dont understand how these calls are being made to add my own for party...

I think most of the work here specially the assignment of the F2 key which by default is party member 1 (he must change it in his config to target his pet... )

if i could just learn this faster heh but basically reusing most of this work to monitor party member 1 instead of a pet would make a heal-bot that assists in a 2 man team wouldn't it?

sorry I am a 3rd rate noob with basic code skills ....
Image

sdude13
Posts: 76
Joined: Thu Aug 19, 2010 9:36 am

Re: Warden Pet [Heavy Mod]

#16 Post by sdude13 » Mon Aug 23, 2010 8:52 am

fred55555 wrote:from what i read there is not function to call or target another person builkd in.

but there is a function call for the pet to be targeted.

would like to still get a simplified syntax of

check pet health
heal with "recover" if pet hp below 75%
continue on
there is a modification of the rombot assist script i found (posted by Bubi, just search for it),
which goes through all players in a group, checking if it need heal or not.

I can't get it to work, but it seems like that way it sholud work...

fred55555
Posts: 101
Joined: Sat Aug 07, 2010 7:57 pm

Re: Warden Pet [Heavy Mod]

#17 Post by fred55555 » Tue Aug 24, 2010 2:54 pm

So hate being a pain, but still confused.

Could someone simplify this for the warden pet.

if pet health below 75% then cast pet heal

not worrying about last target or anything just get the heal off and then continue

:)

thnx

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests