pawn.lua failure

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
aasi888
Posts: 64
Joined: Fri May 15, 2009 5:13 am

pawn.lua failure

#1 Post by aasi888 » Sun Jul 12, 2009 4:22 pm

I ran update.lua many times but the problem comes back after a while of botting.

Image


Code: Select all

129	if( self.Alive ==nil or self.HP == nil or self.MaxHP == nil or self.MP == nil or self.MaxMP == nil or
130		self.MP2 == nil or self.MaxMP2 == nil or self.Name == nil or
131		self.Level == nil or self.Level2 == nil or self.TargetPtr == nil or
132		self.X == nil or self.Y == nil or self.Z == nil or self.Attackable == nil ) then
133
134		error("Error reading memory in CPawn:update()");
135	end


Bot mods:
modif_rest_function.lua is exercuted when mob is dead

Code: Select all

function CPlayer:rest()
-- rest to restore mana and healthpoint if under a certain level

	if( self.Battling == true) then return; end;		-- if aggro, go back

	--if( settings.profile.options.MP_REST == nil ) then  settings.profile.options.MP_REST = 15; end;
	if( settings.profile.options.HP_REST == nil ) then  settings.profile.options.HP_REST = 15; end;

	-- some classes dont have mana, in that cases Player.mana = 0
	hf_mana_rest = (player.MaxMana * settings.profile.options.MP_REST / 100);	-- rest if mana is lower then
	hf_hp_rest   = (player.MaxHP   * settings.profile.options.HP_REST / 100);	-- rest if HP is lower then
	hf_mp_continue = (player.MaxMana * settings.profile.options.MP_CONTINUE / 100);	-- rest if mana is lower then
	hf_hp_continue   = (player.MaxHP   * settings.profile.options.HP_CONTINUE / 100);	-- rest if HP is lower then

	if( player.Mana >= hf_mp_continue  and player.HP >= hf_hp_continue   ) then	-- nothing to do
		return;								-- go back
	end;
	
	self:clearTarget();		-- get rid of mob, so we dont cast while resting
	hf_count = 30 + math.random( 69 );			-- set rest time, up to 99 sec pause
	cprintf(cli.green, "resting %s sec for %s mana and %s HP\n", hf_count, hf_mp_continue, hf_hp_continue);		-- resting x sec for Mana and HP
	while hf_count > 0 do
		yrest(1000);
		hf_count = hf_count - 1;	
		self:update();

		if( self.Battling ) then          -- we get aggro,
			self:clearTarget();       -- get rid of mob to be able to target attackers
			printf("get aggro at sec %s\n", hf_count );   -- get aggro at sec x
			hf_count = 0;		-- stop countdown
		end;
		if( player.Mana >= hf_mp_continue  and		-- some chars have MaxMana = 0
 	 	    player.HP   >= hf_hp_continue ) then		-- Mana and HP are full
			printf("full at sec %s\n", hf_count );   -- full at sec x
			hf_count = 0;				-- stop countdown
		end;

		self:checkPotions();   
		self:checkSkills(); 		-- check if we need to cast buffs/heals.

	end;			-- end of while

end

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

Re: pawn.lua failure

#2 Post by Administrator » Sun Jul 12, 2009 4:32 pm

Does the problem still happen if you disable the modification you made mention of?

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

Re: pawn.lua failure

#3 Post by aasi888 » Sun Jul 12, 2009 4:53 pm

changed these up from value 0

Code: Select all

	<option name="MP_REST" value="2" />
	<option name="MP_CONTINUE" value="3" />
Haven't faced the problem for a while now.

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

Re: pawn.lua failure

#4 Post by d003232 » Sun Jul 12, 2009 6:02 pm

aasi888 wrote:changed these up from value 0

Code: Select all

	<option name="MP_REST" value="2" />
	<option name="MP_CONTINUE" value="3" />
Haven't faced the problem for a while now.
You changed the mod a little and make a new option 'MP_CONTINUE'.

At the moment your modifikation goes to the rest 'while hf_count > 0 do' routine only if 'player.Mana >= hf_mp_continue', means if mana is lower then 3%. And it leaves the rest 'while hf_count > 0 do' routine if mana if higher then 3%???

I suppose what you want to do is to enter the rest function if mana is lower then 'MP_REST' and leave it if mana is higher then 'MP_CONTINUE'? That means you should change

Code: Select all

   if( player.Mana >= hf_mp_continue  and player.HP >= hf_hp_continue   ) then   -- nothing to do
      return;                        -- go back
   end;
back to the hf_mana_rest/hf_hp_rest variables.

The reason for the update error could be founded in the place where you call the rest function. The rest function uses a 'self:clearTarget();'. So you have to be sure, that after that the target is not needed any more. If not, you could get a problem like that. I had problems like that at the beginning also (see here). Thats also the reason that the rest function is called in an own if statement and not in the following one

Code: Select all

	if( player:haveTarget() ) then	
		player:rest();			
	end;					

	if( player:haveTarget() ) then
.
The RoM Bot Online Wiki needs your help!

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

Re: pawn.lua failure

#5 Post by aasi888 » Mon Jul 13, 2009 6:47 am

Disabled the mod and I still get it. I don't get it on other characters.

Post Reply

Who is online

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