random jumping idea

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
raff
Posts: 96
Joined: Thu Jan 22, 2009 10:46 am

random jumping idea

#1 Post by raff » Mon Nov 02, 2009 4:38 am

Hi,

cause i think it looks more human, if the bot will randomly jump, i wrote this function:

Code: Select all

	function randomjump()
	
	if( math.random(100) > 50 ) then
		keyboardHold(settings.hotkeys.JUMP.key);
		yrest(500);
		keyboardRelease(settings.hotkeys.JUMP.key);
end
end
So, when i will put

Code: Select all

randomjump();
in every waypoint, it works good for me.

But my question is:

is it possible to write a random timer that goes down from a random time like 10-40sek and then it will run this code?

Then it wouldnt be so hard to put randomjump(); between every waypoint

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

Re: random jumping idea

#2 Post by d003232 » Mon Nov 02, 2009 4:47 am

raff wrote:is it possible to write a random timer that goes down from a random time like 10-40sek and then it will run this code?
You could remeber the last jump with

Code: Select all

player.LastJump = os.time();
JumpGap = 10 + math.random(30)
and then do the check for that gap value

Code: Select all

if( os.difftime(os.time(), player.LastJump) > JumpGap ) then
...
I agree that the walking of the bot look not very human. In my opinion it is much to straight. And I think only to jump from time to time is not enough. If you jump to often, and I suppose ever 30 seconds is to often it looks also bottish. And perhaps that function should be called while walking, not while reaching a waypoint. Because of the fights between the waypoints, if would be difficult to find a good gap value ... I suppose you don't want to jump at every waypoit reach? :-)



Think if you see one farming at a place. After two hours he is still there farming and jumping. That also looks not so great.

I would like to have a some options to configure the walking. One option/timer for random jumps and some for walking not so straight.
The RoM Bot Online Wiki needs your help!

raff
Posts: 96
Joined: Thu Jan 22, 2009 10:46 am

Re: random jumping idea

#3 Post by raff » Mon Nov 02, 2009 5:25 am

thanks for your fast answer :),

yes 30sek are really too often, of course it would be much better when it would triggered while walking, my lua skills arent good, that was the the only solution for me :P, but i'm still reading about lua, this bot motivates me to learn more about lua :)

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

Re: random jumping idea

#4 Post by d003232 » Mon Nov 02, 2009 5:54 am

raff wrote:thanks for your fast answer :),

yes 30sek are really too often, of course it would be much better when it would triggered while walking, my lua skills arent good, that was the the only solution for me :P, but i'm still reading about lua, this bot motivates me to learn more about lua :)
take a look at 'player:moveto'. I suppose that would be the right place for a global solution. But be carefully, that function is also used to move closer while into a fight.
The RoM Bot Online Wiki needs your help!

raff
Posts: 96
Joined: Thu Jan 22, 2009 10:46 am

Re: random jumping idea

#5 Post by raff » Mon Nov 02, 2009 8:29 pm

thanks for your help d003232 :)

so i tried it at first with that code:

Code: Select all

if player:moveTo(CWaypoint(posX, posZ), true) and
	math.random(100) > 80 then
		keyboardHold(settings.hotkeys.JUMP.key);
		yrest(500);
		keyboardRelease(settings.hotkeys.JUMP.key);
but without success, bot will go to a empty waypoint after run this code.

a friend of mine helped me alot and wrote this code for me:

Code: Select all

if (self.Battling == false and self.Fighting == false) then
	JumpGap = 40 + math.random(120);
	
	if (not LastJump) then
		print("No last jump, jumping.");
		keyboardHold(settings.hotkeys.JUMP.key);
		yrest(500);
		keyboardRelease(settings.hotkeys.JUMP.key);
		LastJump = os.time();
	else
		if( os.difftime(os.time(), LastJump) > JumpGap ) then
			print("Jumping after "..os.difftime(os.time(), LastJump).."s ("..JumpGap.."s cooldown)");
			keyboardHold(settings.hotkeys.JUMP.key);
			yrest(500);
			keyboardRelease(settings.hotkeys.JUMP.key);
			LastJump = os.time();
		else
	end
end
end
i added this code in player.lua line 1140, this works for me without adding something to my waypoints

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], crazzy and 1 guest