Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 07:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Your walk function

Discussion on Your walk function within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2015
Posts: 8
Received Thanks: 1
Your walk function

#Solved
RainbowJ is offline  
Old 10/14/2023, 13:02   #2
 
elite*gold: 0
Join Date: Dec 2011
Posts: 43
Received Thanks: 19
Hey,
can u add comments to your code to help us to understand what you try to do at which point. But i can tell your distance is wrong because you dont know the player position only the goto position and you dont know if the player is moving or not (there is a memory flag).
JONNST4R is offline  
Old 10/14/2023, 19:21   #3
 
elite*gold: 0
Join Date: Nov 2015
Posts: 8
Received Thanks: 1
Quote:
Originally Posted by JONNST4R View Post
Hey,
can u add comments to your code to help us to understand what you try to do at which point. But i can tell your distance is wrong because you dont know the player position only the goto position and you dont know if the player is moving or not (there is a memory flag).
Hello! Thank you for your comment.
I know the player position, receiving the "at" packet when i change map, or when i start the bot, just moving the player, with the first "walk" packet that i receive moving the player normally via client.

The code commented:

Code:
Func GoTo($x2, $y2)
	$x1 = $Me[0]   ;My current x position
	$y1 = $Me[1]    ;My current y position
	Dim $x2Iniz = $x2   ;Saving the x destination
	Dim $y2Iniz = $y2   ;Saving the y destination
;##########################################
;That just calcolate the best destination point
While ( ($x1 <> $x2) Or ($y1 <> $y2) )
	$x1 = $Me[0]
	$y1 = $Me[1]


	$WalkDistance = Sqrt( Abs($x1 - $x2)^2 + Abs($y1 - $y2)^2 )

	While ($WalkDistance > 6)

			If ($x1 > $x2) Then
			If($y1 > $y2) Then
				$x2=$x2+1
				$y2 = $y2+1
			ElseIf($y1 < $y2) Then
				$x = $x2+1
				$y2 = $y2-1
			Else
				$x2 = $x2+1
			EndIf
		ElseIf ($x1 < $x2) Then
			If($y1 > $y2) Then
				$x2 = $x2-1
				$y2 = $y2+1
			ElseIf($y1 < $y2) Then
				$x2 = $x2-1
				$y2 = $y2-1
			Else
				$x2 = $x2-1
			EndIf
		ElseIf ($x1 = $x2) Then
			If($y1 > $y2) Then
				$y2 = $y2+1
			Else
				$y2 = $y2-1
			EndIf
		EndIf
	$WalkDistance = Sqrt( Abs($x1 - $x2)^2 + Abs($y1 - $y2)^2 )
	WEnd
;##########################################


		If Mod($x2 + $y2,3) == 1 Then ;The walk packet wants 1 in the parameter if destionation's (x+y) % 3 == 1
		PacketLogger_SendPacket($PacketLogger_OpenSockets[0], "walk " & $x2 & " " & $y2 & " 1 16")
		Else
		PacketLogger_SendPacket($PacketLogger_OpenSockets[0], "walk " & $x2 & " " & $y2 & " 0 16")
EndIf
;Resetting starting destination's x and y 
		$x2 = $x2Iniz
		$y2 = $y2Iniz
;just tracking movement
		ConsoleWrite($x1 & " " & $y1)
		Sleep(600)
		PacketLogger_Handle($PacketLogger_OpenSockets[0], IncomingPacket) ;Receive eventual packets
		Sleep(600)
		;tp 1 myID 142 1 0 
;Receive the "tp" packet, just to show me in the destination
		PacketLogger_RecvPacket($PacketLogger_OpenSockets[0], "tp 1 "& id & " " & $Me[0] & " " & $Me[1])
		
;Just debugging
		;ConsoleWrite( "walk " & $x2 & " " & $y2 & " 0 11")
WEnd

EndFunc


Quote:
Originally Posted by JONNST4R View Post
you dont know if the player is moving or not (there is a memory flag).
Why should i not be moving after sending a walk packet?
RainbowJ is offline  
Old 10/14/2023, 19:56   #4
 
elite*gold: 0
Join Date: Dec 2011
Posts: 43
Received Thanks: 19
Im sorry i dont use packets, I have some questions about them.
  1. Is there a packet, if you get a debuff like stun/blackout that makes you stop moving?
  2. Can u get the current player position all the time with the "at" packet?
JONNST4R is offline  
Old 10/14/2023, 23:49   #5
 
Limoo's Avatar
 
elite*gold: 0
Join Date: Jan 2017
Posts: 475
Received Thanks: 192
Quote:
Originally Posted by JONNST4R View Post
Im sorry i dont use packets, I have some questions about them.
  1. Is there a packet, if you get a debuff like stun/blackout that makes you stop moving?
  2. Can u get the current player position all the time with the "at" packet?
The "at" packet gives you your exact coordinates however you only receive it when you change maps.

Quote:
Originally Posted by RainbowJ View Post
Why should i not be moving after sending a walk packet?
The "walk" packet is not accurate because it gives you the next cell at a distance of 4 (I think) and the final one if it is closer.
If you have to do 10 walk cells then it will give you the coordinates of cells 4, 8 and 10.

To emulate the packet walk you have to rely on the character's speed, so you know how many cells he can do in a given amount of time.
For the speed you can see the "cond" packet.

If you use the packet and not the game function for walking you will also have to use the "tp" packet to move the camera to the player's actual position (it's clientside, others see you walking).
Limoo is offline  
Thanks
2 Users
Old 10/18/2023, 08:56   #6
 
Diartios's Avatar
 
elite*gold: 2325
Join Date: Feb 2019
Posts: 160
Received Thanks: 39
Quote:
Originally Posted by JONNST4R View Post
Im sorry i dont use packets, I have some questions about them.
  1. Is there a packet, if you get a debuff like stun/blackout that makes you stop moving?
  2. Can u get the current player position all the time with the "at" packet?
about your first question check "cond" packet

cond entity_type entity_id cantattack cantwalk speed
Diartios is offline  
Thanks
1 User
Old 10/23/2023, 17:48   #7
 
elite*gold: 0
Join Date: Oct 2018
Posts: 257
Received Thanks: 207
Hey!

The logic implemented (checking for the position of the point, etc) will be fine if you don't have any obstacles. If you have an obstacle, you will need to implement a pathfinding algorithm, you can use A* which will be perfect for your use case.
Here is an example in C++:
Also you might be interested in a way to check for the "line of sight" (not willing to attack behind an obstacle, even thought the server will accept the request), the algorithm is:

Regarding the other details, you should walk not one cell by one cell but follow this formula:
As an example, if you have a speed of 10 (an adventurer without any speed boost), you will have to walk a distance of 3, which means that if you are walking in a straight line from 10;10 to the bottom, you will send walk 10 13. If you go to the lower right corner, you will not send walk 13 13 (because you will travel a distance of 4.25, (3²+3²)^0.5) but most probably walk 12 12 ((2²+2²)^0.5 is the latest value before exceeding a distance of 3).
Regarding the delay between each walk, you must follow this formula:
but use the actual distance traveled, not the calculated one, in the example with walk 12 12, you walk a distance of (2²+2²)^0.5=2.83, you have a speed of 10, so you must send the next walk not earlier than 2.83*2500/10=707ms.

You also need to follow two other things:
- you should not walk when you cannot (it was possible to walk while being stunned, but I think it has been patched) - so check for cond packet (rooted) and whether or not the character is alive
- you should listen to the tp packet - even though this implementation would make your walking algorithm really accurate and trustful, you might get a lag (in that case, the tp packet should restart your walk algorithm from the new position) but also, you might just get teleported
Apourtartt is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
How to walk in kalOnline with walk animation.
07/28/2016 - Kal Online - 8 Replies
Hello guys. before anything i used search function to find what i want but i just found this topic http://www.elitepvpers.com/forum/kal-hacks-bots-ch eats-exploits/236214-tut-walk-packets.html and as all see this is't complete topic. maybe the supplement of this topic in German language and i translated it . and i read Bakabug kalhack11 source code and i understood how it work. but i was trying to find walk function with ollydbg to make realtime walk. but really its seems hard thing. i...
std::function of a function returning an std::function
11/11/2013 - C/C++ - 19 Replies
Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann. Ich verzweifle an Folgendem Vorhaben: #include <Windows.h> #include <string> #include <iostream> using namespace std;



All times are GMT +1. The time now is 07:27.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.