MV Accessing map destination variables after mouse move click

I'm sorry if the answer to this question is obvious, but I've been searching for awhile and can't find any reference to it.

I'm trying to figure out how to access the variables that store the map coordinate a player is moving to when you click the mouse button somewhere, and can't figure out where this information is stored or how to access it.

Ultimately, the problem I'm trying to fix is that the world map of my game contains multiple events representing multiple controllable units, sort of like a real time strategy game. The player can swap between these events by turning them into the player character with a button press. The issue is: if a unit is currently moving toward a destination when I switch control to a new unit, the old unit stops moving and the new unit starts moving toward that destination instead. I can fix this with a script if I can just store the clicked map location as a variable, and then update the movement of both units after I switch control. I just can't find where that destination information is stored.

I hope my question makes sense, thanks for any tips.
$gameTemp.destinationX() and $gameTemp.destinationY()
Thanks so much! This worked.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/accessing-map-destination-variables-after-mouse-move-click.137821/