Page 1 of 1

Improved Jumping Ability!

Posted: Sun Jan 16, 2011 1:38 am
by jduartedj
Ever wanted to make you bot jump normally? To that exact spot?

I did, and so I did it! I added a couple of code lines to CPlayer and one small change to CPawn and now he jumps properly :D

The bot jumps to land in the next Waypoint so

Code: Select all

<waypoint A>CPlayer:jump();</waypoint>
<waypoint B></waypoint>
A----------jump--B(lands)

note:distance(jump,B) = 50

The code is:

Code: Select all

		if( dist<=50 and self.Jump == true ) then 
			keyboardPress(settings.hotkeys.JUMP.key);
			self.Jump = false;
		end
inside the CPlayer:moveTo() movement loop --> "while( dist > successDist ) do"

and:

Code: Select all

self.Jump = false;
on the CPawn constructor, and finally but optional:

Code: Select all

function CPlayer:jump()
		self.Jump = true;
end
since you can just use "self.Jump = true;" instead!

Re: Improved Jumping Ability!

Posted: Sun Jan 16, 2011 2:41 am
by rock5
There are a few things that could affect your speed and therefore your jumping distance. The main one is if you're mounted. Maybe you could check if your mounted and change the jump distance.

Re: Improved Jumping Ability!

Posted: Sun Jan 16, 2011 3:17 am
by lisa
Some mobs have slow down abilities that they hit you with, it depends on the situation your trying to use it in that would affect if you need to detect these things.
If you are doing a daily where you don't need to kill anything and don't use mount. It would work fine without alterations but if you do either or both of those things then I'd say you need some additional coding to allow for other situations.

Re: Improved Jumping Ability!

Posted: Sun Jan 16, 2011 3:21 am
by jduartedj
rock5 wrote:There are a few things that could affect your speed and therefore your jumping distance. The main one is if you're mounted. Maybe you could check if your mounted and change the jump distance.
Yeah well I though of adding:

Code: Select all

 if( dist<=self.Speed and self.Jump == true ) then 
instead

since Speed would be in Units/sec and jump time is aprox. 1sec Speed = dist

But I would have to include a speed update based on buff (mount,food,pot,etc) base speed is 50, then multiply by bonus so

Code: Select all

player.Speed = 50*(1+bonus/100) --bonus in %
a second option would be to determine the speed based on a calculation but that would be somewhat inacurate like in here:

Code: Select all

function speed()
	local X=player.X 
	local Z=player.Z 
	local timed=os.time() 
	local speed
	while true do 
		player:update()
		printf("Speed: %f\n",distance(X,Z,player.X,player.Z)/(os.time()-timed)) 
		speed = distance(X,Z,player.X,player.Z)/(os.time()-timed);
		player:update()
		X=player.X 
		Z=player.Z 
		timed=os.time() 
		yrest(1000) 
	end
	
end
But it this this most useful while not on a mount and probably in specific situations :P

Re: Improved Jumping Ability!

Posted: Sat Jan 07, 2012 2:35 pm
by revolver
Thats really nice but could you make a more noob guide for us..cause i didn't understand anything ...thank you :D

Re: Improved Jumping Ability!

Posted: Sat Jan 07, 2012 4:54 pm
by kanta
This post is a few days short of 1 year old. If it hasn't been added to the base code by now it most likely won't be.

Re: Improved Jumping Ability!

Posted: Sun Jan 08, 2012 12:24 am
by rock5
It's an interresting idea but I think the bot isn't accurate enough to do this reliably. It would be nearly impossible to make it jump at exactly the right time.

Re: Improved Jumping Ability!

Posted: Thu Jan 26, 2012 9:49 am
by MustHave
I'm testing the cyclops farm run and it seems to be it would be helpful for jumping into the instance.