Drag And Drop with Path-Finding


Idk if was a post already. But how to i drag and drop an object that has path finding codded into it? Here is the code I have so far:
if treached = false {
    sprite_index = spr_villagerMoving
    if (!instance_exists(target))
        // create new target
        var gx = random(room_width) div 16 * 16 + 8;
        var gy = random(room_height) div 16 * 16 + 8;
        if (mp_grid_path(global.grid, path, x, y, gx, gy, 1))
            target = instance_create_layer(gx, gy, "Instances", obj_target);
            path_start(path, 2, path_action_stop, false)
        // follow target
        if (place_meeting(x, y, target)) {
            treached = true
            timer = room_speed*irandom_range(2,5)
            sprite_index = spr_villagerIdle
Its picking a random location from around the room and obj_villagers moves toward that location. Once there they stop and wait a few seconds before deciding they wanna walk around some more. I cant really figure it out as the last 2 code sets i tryed just with the drag and drop alone didnt work.