How to code route function for metin2?

07/25/2023 22:15 Apropos#1
Hello guys, im trying to code some metin2 internal cheats. I made a "run along recorded route" function. But its not waiting for next coordinate. I mean i need to move to the coord step by step but its running all coords in one second. So i need to check if char was came the selected coord or not. If it is then it can go next coord. Im using c4us'us source code. If im not wrong i need instance address from "PythonCharacterManagerInstance" this. Who can help me?
07/25/2023 22:30 Drewfire#2
#moved
07/27/2023 10:36 DonAirBerlin#3
First it is necessary that you share more information about what/how you want to do something. From your description no one here will be able to help you. Don't forget to mention what you already tried and how your data looks like.
Anyway for that to work its crucial to have access to the current players coordinates. If you have them you can try something like the following PSEUDO code:

Code:
# variables
recorded_route = [(x1, y1), (x2, y2), (x3, y3), ...]  # List of recorded coordinates
current_coord_index = 0  # Index to keep track of the current coordinate in the route

# Function to get character's current position
function get_character_position():
    # like mentioned get the coordinates here either by accessing the characters object or directly read it out from the recv function
    return character_instance.position  # Return character's position (x, y)

# Function to move character towards a target coordinate
function move_character_towards(target_x, target_y):
    current_x, current_y = get_character_position()  # Get current position
    # Calculate the direction vector towards the target
    direction_x = target_x - current_x
    direction_y = target_y - current_y
    # Normalize the direction vector (optional but recommended to control speed)
    direction_length = sqrt(direction_x^2 + direction_y^2)
    normalized_direction_x = direction_x / direction_length
    normalized_direction_y = direction_y / direction_length
    # Set the character's movement (you might have a function for this in your code)
    set_character_movement(normalized_direction_x, normalized_direction_y)

# Function to check if character reached the target coordinate
function has_character_reached(target_x, target_y):
    current_x, current_y = get_character_position()  # Get current position
    distance_to_target = distance(current_x, current_y, target_x, target_y)
    return distance_to_target < tolerance_threshold  # Check if character is close enough to the target

# Main function for running along the recorded route
function run_along_recorded_route():
    while current_coord_index < len(recorded_route):
        target_x, target_y = recorded_route[current_coord_index]  # Get the current target coordinate
        move_character_towards(target_x, target_y)  # Move character towards the target coordinate

        # Wait until the character reaches the target coordinate
        while not has_character_reached(target_x, target_y):
            wait_for_short_interval()  # Add a small delay to control the movement speed

        # Character reached the target coordinate, move to the next one
        current_coord_index += 1

    # Character has reached the end of the route
    set_character_movement(0, 0)  # Stop character's movement

# call main function
run_along_recorded_route()
07/28/2023 12:15 Apropos#4
Hey man i did it already. No need help anymore for this. Now i need to find IsDead function on cheat engine. Can you help me?