Use Urgent Heal, Regenerate, Imunity how to do inside.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Use Urgent Heal, Regenerate, Imunity how to do inside.

#1 Post by kumpel100 » Sat Jun 20, 2009 7:03 am

http://www.solarstrike.net/phpBB3/viewt ... f=21&t=401

this works better or more easy use than my idear.
Last edited by kumpel100 on Sun Jul 12, 2009 11:38 am, edited 2 times in total.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#2 Post by d003232 » Tue Jun 23, 2009 5:41 am

kumpel100 wrote:feedback welcome :)
I like that idee to make the bot unkillable. :twisted:

This morning, sitting in the waiting romm by the doctor, I was thinking about your suggestion and code changes. I think there should be a way, to define that special urgent emergency cast more close to the standard bot solution. What's about some new options for the normal skills in the profile, like:

Code: Select all

        <skill name="PRIEST_IMMUNITY" hotkey="VK_8" emergency_hp="15"  order="1" level="" />
        <skill name="PRIEST_URGENT_HEAL" hotkey="VK_7" emergency_hp="15" order="2" level="" />
        <skill name="PRIEST_URGENT_HEAL" hotkey="VK_7" emergency_hp="15" order="3" level="" />
There would be two new options:
  • emergency_hp, that means your own HP value in percent. The skill is triggert if the HP falls under that level
  • order, all skills with the same 'emergency' event/level will be cast in the given order
That means for that example, the bot will first cast immunity, and then cast 2x urgent heal.

That would 'only' need some changes in 'function CPlayer:checkSkills()' (ok, that changes are at the moment behind my limit of understanding of the bot :oops: ). And it would be so flexible, that you can use if for all classes and configure it very individual without to have to define new hotkeys.

btw: I could also imagine to define a 'final strike' cast in that way. Means if the hp of your mob is at a very low level (and yours to !) it could be better to use the 'final strike' instead to try to heal yourselfe before.
The RoM Bot Online Wiki needs your help!

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#3 Post by kumpel100 » Tue Jun 23, 2009 11:53 am

i like your idear, a good option would be use skills without use alot of hotkeys.
something like:

ingame macro:


/cast Holy Aura
/wait 1
/cast Urgent Heal
/wait 1
/cast Urgent Heal
/wait 1

or if you are Priest:

/cast Holy Aura
/wait 1
/cast Soul Source ; intant full HP 5min cooldown.

best part would be Cast skills without using Hotkeys.


for atm we can use it this way:

Code: Select all

-- Check if you need to use Imunity, and use them.
function CPlayer:checkImunity()
-- Still cooling down, don't use.
   if( os.difftime(os.time(), self.ImunityLastUseTime) < settings.profile.options.IMUNITY_COOLDOWN ) then
   cprintf(cli.red, "Imunity in Cooldown\n");
   end
   
   if( os.difftime(os.time(), self.ImunityLastUseTime) < settings.profile.options.IMUNITY_COOLDOWN ) then
      return;
   end

if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_USE_IMUNITY ) and ( self.Battling ) then
        self.ImunityLastUseTime = os.time();
        cprintf(cli.red, "Use Imunity\n");
      local modifier = settings.profile.hotkeys.HP_LOW_IMUNITY.modifier
      if( modifier ) then keyboardHold(modifier); end
      keyboardPress(settings.profile.hotkeys.HP_LOW_IMUNITY.key);
      if( modifier ) then keyboardRelease(modifier); end
      yrest(250);
   end

-- If we need a Urgent Heal
   if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_URGENT ) then
       cprintf(cli.red, "Urgent Heal\n");
      local modifier = settings.profile.hotkeys.CAST_HEAL_URGENT.modifier
      if( modifier ) then keyboardHold(modifier); end
      keyboardPress(settings.profile.hotkeys.CAST_HEAL_URGENT.key);
      if( modifier ) then keyboardRelease(modifier); end
      yrest(1000);
   end

-- If we need a Urgent Heal
   if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_URGENT ) then
       cprintf(cli.red, "Urgent Heal\n");
      local modifier = settings.profile.hotkeys.CAST_HEAL_URGENT.modifier
      if( modifier ) then keyboardHold(modifier); end
      keyboardPress(settings.profile.hotkeys.CAST_HEAL_URGENT.key);
      if( modifier ) then keyboardRelease(modifier); end
      yrest(1000);
   end

end


should be not a very good fix but Imunity,Heal,Heal would do the Job.

ay0304
Posts: 2
Joined: Mon Jun 29, 2009 8:40 am

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#4 Post by ay0304 » Mon Jun 29, 2009 8:45 am

sorry, i am new to the bot.


-del-
Last edited by ay0304 on Mon Jun 29, 2009 8:50 am, edited 2 times in total.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#5 Post by d003232 » Mon Jun 29, 2009 8:49 am

ay0304 wrote:i need the regenerate function badly.
Using regenerate is function, you can do without any modification. You have to:
  • activate self cast in your ingame options
  • Insert' <skill name="PRIEST_REGENERATE" hotkey="VK_4" priority="40" level="" />
    ' in your *charname*.xml profile file under the skills
  • and put your regenerate spell at the right hotkey, you defined just before (in this example it it the hotkey '4'.
With the '<option name="HP_LOW" value="95" />' in your profile, you define when to cast regenerate. I would suggest to take a high value around 90% to cast regenerate very early in a fight. In this case, I use it at 95% health points.
The RoM Bot Online Wiki needs your help!

ay0304
Posts: 2
Joined: Mon Jun 29, 2009 8:40 am

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#6 Post by ay0304 » Mon Jun 29, 2009 8:54 am

d003232 wrote:
ay0304 wrote:i need the regenerate function badly.
Using regenerate is function, you can do without any modification. You have to:
  • activate self cast in your ingame options
  • Insert' <skill name="PRIEST_REGENERATE" hotkey="VK_4" priority="40" level="" />
    ' in your *charname*.xml profile file under the skills
  • and put your regenerate spell at the right hotkey, you defined just before (in this example it it the hotkey '4'.
With the '<option name="HP_LOW" value="95" />' in your profile, you define when to cast regenerate. I would suggest to take a high value around 90% to cast regenerate very early in a fight. In this case, I use it at 95% health points.
thx a lot....i vn't tickt the self-cast
that the reason...

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#7 Post by d003232 » Thu Jul 02, 2009 7:18 pm

I just detected in the coding that there is an option 'maxhpper' for the skills defined in the skill database. That's amazing. That's allready the function to define more heal casts at different health levels.

@Admin: you should really take that into the documentation. :-)

I changed now my skills.xml to

Code: Select all

	<skill name="PRIEST_HOLY_AURA" mana="60" cooldown="120" type="buff" target="self" maxhpper="20" />
	<skill name="PRIEST_URGENT_HEAL" mana="25" manainc="2.5" range="250" casttime="1" type="heal" target="friendly" maxhpper="20" />
	<skill name="PRIEST_SOUL_SOURCE" cooldown="300" type="heal" target="self" priority="100" maxhpper="15" />
and insert that three casts into my profile. I was wondering, if I can't define 'maxhpper' directly in the profile to override the 'default' values from skills.xml ?

And I would like to define the 'InBattle' option with 'true'. That means to cast 'PRIEST_SOUL_SOURCE' and 'PRIEST_HOLY_AURA' only IN combat so I don't waste them outside of combat. Thats not coded if I see that right.
The RoM Bot Online Wiki needs your help!

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

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#8 Post by Administrator » Thu Jul 02, 2009 7:26 pm

d003232 wrote: @Admin: you should really take that into the documentation. :-)
Yeah, there is a lot to be documented, but as it stands now the instructions are already monolithic.
and insert that three casts into my profile. I was wondering, if I can't define 'maxhpper' directly in the profile to override the 'default' values from skills.xml ?
Doesn't work like that currently, but will in the future.
And I would like to define the 'InBattle' option with 'true'. That means to cast 'PRIEST_SOUL_SOURCE' and 'PRIEST_HOLY_AURA' only IN combat so I don't waste them outside of combat. Thats not coded if I see that right.
You can already do that. Add inbattle="true" to the entry in skills.xml. I've updated it on my end and committed to SVN.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#9 Post by d003232 » Thu Jul 02, 2009 7:46 pm

Administrator wrote:You can already do that. Add inbattle="true" to the entry in skills.xml. I've updated it on my end and committed to SVN.
THX for that very fast service. :arrow:
The RoM Bot Online Wiki needs your help!

kumpel100
Posts: 47
Joined: Sat May 09, 2009 11:12 am

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#10 Post by kumpel100 » Fri Jul 03, 2009 1:51 pm

Edit version:



i addet alot of new code to makes my Mage/Priest close to Unkillable:

Player LUA Line ~192-224 from the new SVN code overwrite the whole function CPlayer:checkPotions()
with this code:

Code:

Code: Select all

-- Check if you need to use Imunity, and use them.
function CPlayer:checkImunity()
self:checkPotions();
-- Still cooling down, don't use.
  -- if( os.difftime(os.time(), self.ImunityLastUseTime) < settings.profile.options.IMUNITY_COOLDOWN ) then
 --  cprintf(cli.red, "Imunity in Cooldown\n");
 --  end
   
   if( os.difftime(os.time(), self.ImunityLastUseTime) < settings.profile.options.IMUNITY_COOLDOWN ) then
      return;
   end

if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_USE_IMUNITY ) and ( self.Battling ) then
        self.ImunityLastUseTime = os.time();
        cprintf(cli.red, "Use Imunity\n");
      local modifier = settings.profile.hotkeys.HP_LOW_IMUNITY.modifier
      if( modifier ) then keyboardHold(modifier); end
      keyboardPress(settings.profile.hotkeys.HP_LOW_IMUNITY.key);
      if( modifier ) then keyboardRelease(modifier); end
      yrest(250);

	  
if( settings.profile.options.URGENT_HEAL_USE == true ) then 	  
cprintf(cli.red, "Urgent Heal\n");
local modifier = settings.profile.hotkeys.CAST_HEAL_URGENT.modifier	  
keyboardPress(settings.profile.hotkeys.CAST_HEAL_URGENT.key);
yrest(1000);
cprintf(cli.red, "Urgent Heal\n");
keyboardPress(settings.profile.hotkeys.CAST_HEAL_URGENT.key);
yrest(500);  
end 
end
end


-- Check if you need to use any potions, and use them.
function CPlayer:checkHealth1()
if( (self.Mana/self.MaxMana*100) < settings.profile.options.MP_LOW_HEAL_URGENT ) and ( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_URGENT ) then
	cprintf(cli.red, "Low on Mana for Urgent\n");
	return;
	end
-- If we need to use a health potion
	if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_URGENT ) then
	    cprintf(cli.red, "Urgent Heal\n");
		local modifier = settings.profile.hotkeys.CAST_HEAL_URGENT.modifier
		if( modifier ) then keyboardHold(modifier); end
		keyboardPress(settings.profile.hotkeys.CAST_HEAL_URGENT.key);
		if( modifier ) then keyboardRelease(modifier); end
		yrest(1200);
	end
end


-- Check if you need to use any potions, and use them.
function CPlayer:checkHealth()
	-- Still cooling down, don't use.
	if( os.difftime(os.time(), self.HealLastUseTime) < settings.profile.options.HEAL_COOLDOWN ) then
		return;
	end

-- If we need to use a health potion
	if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_HEAL ) then
	    self.HealLastUseTime = os.time();
	    cprintf(cli.red, "Regenerate\n");
		local modifier = settings.profile.hotkeys.CAST_HEAL_REGENERATE.modifier
		if( modifier ) then keyboardHold(modifier); end
		keyboardPress(settings.profile.hotkeys.CAST_HEAL_REGENERATE.key);
		if( modifier ) then keyboardRelease(modifier); end
		yrest(500);
	end

end


-- Check if you need to use any potions, and use them.
function CPlayer:checkPotions()
	-- Still cooling down, don't use.
	if( os.difftime(os.time(), self.PotionLastUseTime) < settings.profile.options.POTION_COOLDOWN ) then
		return;
	end

if( settings.profile.options.HEAL_AND_PORTION_HEAL_USE == true ) and ( (self.Mana/self.MaxMana*100) > settings.profile.options.HEAL_PORTION_USE_TO_MANA_DOWN ) then
	-- If we need to use a health potion
	if( (self.HP/self.MaxHP*100) < settings.profile.options.HP_LOW_POTION ) then
	self.PotionLastUseTime = os.time();
		local modifier = settings.profile.hotkeys.HP_POTION.modifier
		if( modifier ) then keyboardHold(modifier); end
		keyboardPress(settings.profile.hotkeys.HP_POTION.key);
		if( modifier ) then keyboardRelease(modifier); end

		cprintf(cli.red, language[10]);

		yrest(500);
	end
end	

	-- If we need to use a mana potion(if we even have mana)
	if( self.MaxMana > 0 ) then
		if( (self.Mana/self.MaxMana*100) < settings.profile.options.MP_LOW_POTION ) then
		self.PotionLastUseTime = os.time();
			local modifier = settings.profile.hotkeys.MP_POTION.modifier
			if( modifier ) then keyboardHold(modifier); end
			keyboardPress(settings.profile.hotkeys.MP_POTION.key);
			if( modifier ) then keyboardRelease(modifier); end

			cprintf(cli.red, language[11]);

			yrest(500);
		end
	end
end

line ~ 520
yrest(1000); << fixes my loot problems

-- Monster is dead (0 HP) but still targeted.
-- Loot and clear target.

Code: Select all

-- Monster is dead (0 HP) but still targeted.
	-- Loot and clear target.
	self:checkPotions();
	self:update();



player.lua line ~ 488
self:checkPotions();
self:checkSkills();

overwrite with this code:

Code:

Code: Select all

       if( settings.profile.options.IMUNITY_USE == true ) then     
        player:checkImunity();                                             
        end 
		self:checkPotions();
		if( settings.profile.options.HEAL_USE == true ) then     
        self:checkHealth();                                             
        end 
        if( settings.profile.options.URGENT_HEAL_USE == true ) then     
        self:checkHealth1();                                             
        end  		
		self:checkSkills();
			end
player.lua line ~698
self:checkPotions();

overwrite with this code:
Code:

Code: Select all

 if( settings.profile.options.IMUNITY_USE == true ) then     
                 player:checkImunity();                                             
                end 
		        self:checkPotions();
				if( settings.profile.options.HEAL_USE == true ) then     
                self:checkHealth();                                             
                end 
				if( settings.profile.options.URGENT_HEAL_USE == true ) then     
                self:checkHealth1();                                             
                end 

bot.lua 291-294
if( player.TargetPtr == 0 ) then
player:checkPotions();
player:checkSkills();
end

overwrite with this code:

Code:

Code: Select all

if( player.TargetPtr == 0 ) then
		     	player:checkPotions();
			    if( settings.profile.options.IMUNITY_USE == true ) then     
                player:checkImunity();                                             
                end 
								if( settings.profile.options.HEAL_USE == true ) then     
                player:checkHealth();                                             
                end  
				if( settings.profile.options.URGENT_HEAL_USE == true ) then     
                player:checkHealth1();                                             
                end 
				                                                            
				player:checkSkills();
			end

Profil.xml

right after:
<profile>
<options>

insert this:
Code:

Code: Select all


           <option name="LOGOUT_TIME" value="240" /> 
	   <option name="LOGOUT_SHUTDOWN" value="true" />
	   
	   
	    <option name="IMUNITY_USE" value="true" />
	    <option name="HP_LOW_USE_IMUNITY" value="55" />
	    <option name="IMUNITY_COOLDOWN" value="120" />
		
	   <option name="HEAL_USE" value="true" />
	   <option name="HP_LOW_HEAL" value="85" />
	   <option name="HEAL_COOLDOWN" value="20" />
	   
	   <option name="URGENT_HEAL_USE" value="true" />
	   <option name="MP_LOW_HEAL_URGENT" value="20" />
	   <option name="HP_LOW_URGENT" value="65" />
	   
	   <option name="HEAL_AND_PORTION_HEAL_USE" value="true" />
	   <option name="HEAL_PORTION_USE_TO_MANA_DOWN" value="40" />
	   <option name="POTION_COOLDOWN" value="32" />
	   <option name="HP_LOW_POTION" value="40" />
           <option name="MP_LOW_POTION" value="60" />



and in <hotkeys>

insert this:

Code:
<hotkey name="HP_LOW_IMUNITY" key="VK_6" />
<hotkey name="CAST_HEAL_REGENERATE" key="VK_0" />
<hotkey name="CAST_HEAL_URGENT" key="VK_9" />




pawn.lua line line 63 below this self.PotionLastUseTime = 0;
add this:

Code:
self.ImunityLastUseTime = 0;
self.HealLastUseTime = 0;




to clear things up:

self explain:
<option name="IMUNITY_USE" value="true" />

at 50% HP the bot will use Imunity:
<option name="HP_LOW_USE_IMUNITY" value="50" />

Cooldowntimer of your Imunity spell:
<option name="IMUNITY_COOLDOWN" value="120" />

true means you want use Regenerate:
<option name="HEAL_USE" value="true" />

at 75% HP the Bot will cast Regenerate if the Timer is Up:
<option name="HP_LOW_HEAL" value="75" />

Cooldown Timer of Regenerate 20 = 20 seconds:
<option name="HEAL_COOLDOWN" value="20" />

true means use Urgent Heal, false dont use it:
<option name="URGENT_HEAL_USE" value="true" />

Bot only Cast Urgent Heal if your Mana higher then 30%:
<option name="MP_LOW_HEAL_URGENT" value="30" />

at 50% the bot will cast Urgent Heal when Mana > 30% and HP lower then 50%:
<option name="HP_LOW_URGENT" value="50" />

true means use use Heal Portions and Heal Spells, false dont use Heal Portion:
<option name="HEAL_AND_PORTION_HEAL_USE" value="true" />

Use Heal Portion only when your Mana greater then 40%:
<option name="HEAL_PORTION_USE_TO_MANA_DOWN" value="40" />



i know it can be codet better but for me personel works great.

aasi888
Posts: 64
Joined: Fri May 15, 2009 5:13 am

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#11 Post by aasi888 » Sun Jul 05, 2009 7:37 pm

Edit your 1st post so people can get the right code withouth having to read the whole thread. Looks amazing btw!

I'm having a problem. My bot won't eaat any potions.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Use Urgent Heal, Regenerate, Imunity how to do inside.

#12 Post by d003232 » Mon Jul 06, 2009 7:25 am

kumpel100 wrote:feedback welcome :)
As I wrote before, I like your idee, to give the bot more chances to survive. That was the reason to look deeper, whats possible to do with the bot. There are some undocumented function to use healing casts at different HP levels.

I think that functions are closer to the standard of the bot und are usable for all RoM classes without changes at the standard functions. That's the reason I try to describe them for all in a new post here. Thx for your work and ideas.
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 4 guests