MZ Spawn picture with copied parameters based on current MovePicture command?

Hi everyone,

I have a minigame with several Pictures on a Map, that move around unpredictably.
They do little steps with ~15 Frames duration and check for their next step individually. Their Movement is based on Variables in the MovePicture command.

You can place a marker on one of these icons to gain control. It's a Picture as well, and I figured out how to do a "Show Picture" command with script to copy the current coordinates of the icon and show the marker on the same position.
After that, the MovePicture will always be done for the icon and the marker and they move as one.

The issue is, if the icon is currently moving, and has like 5 Frames done, when the marker spawns, the icon will move on to the destination for 10 more frames. The marker won't move the rest of the step, as it didn't get the original MovePicture inbetween.

So, there's always a hickup before they start moving correctly.

Is there any way to inherit an ongoing MovePicture to the Picture, that gets spawned in the middle of the route with copied parameters?

Thank you!
From what I understand of your problem, making the icon stop when the marker spawns seems like a solution too. And to do that, the following code should work for you:
JavaScript:
let icon = $gameScreen.picture(id); //replace id with the id of the icon picture
icon._duration = 0;

If you really want to copy the movement (in progress) of another image, it's a little more complex, but we can do that too:
JavaScript:
let icon = $gameScreen.picture(id); //replace id with the id of the icon picture
let mark = $gameScreen.picture(id); //replace id with the id of the marker picture

mark.move(
    icon.origin(),
    icon._targetX,
    icon._targetY,
    icon._targetScaleX,
    icon._targetScaleY,
    icon._targetOpacity,
    icon.blendMode(),
    icon._duration,
    icon._easingType
);
If you really want to copy the movement (in progress) of another image, it's a little more complex, but we can do that too:
JavaScript:
let icon = $gameScreen.picture(id); //replace id with the id of the icon picture
let mark = $gameScreen.picture(id); //replace id with the id of the marker picture

mark.move(
    icon.origin(),
    icon._targetX,
    icon._targetY,
    icon._targetScaleX,
    icon._targetScaleY,
    icon._targetOpacity,
    icon.blendMode(),
    icon._duration,
    icon._easingType
);
Thank you! It works perfectly.

Original thread: https://forums.rpgmakerweb.com/threads/spawn-picture-with-copied-parameters-based-on-current-movepicture-command.178899/