Return SV Battlers' (Actors and Enemies) X and Y Coordinates?

Yoraee

Veteran
Veteran
Joined
May 29, 2016
Messages
211
Reaction score
484
Primarily Uses
Apologies for the bombardment of questions today. I've actually held on to  this one for some time and tried to figure it out on my own, with not much success sadly.


I want to be able to store each actor and enemy X and Y coordinates in a battle in variables, to be accessed later by common events. The variables will be updated with every battle.


I have read about the Sprite_Actor.prototype.setActorHome. Is there a function that would have the effect of "getActorHomeX" and "getActorHomeY"?


Thanks,
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
717
Reaction score
570
First Language
French
Primarily Uses
Hi @Yoraee!


This is one way to get the actor coordinates:


SceneManager._scene._spriteset._actorSprites[index]._homeX
SceneManager._scene._spriteset._actorSprites[index]._homeY


Indexes start at 0 for the first party member.


And you can get enemy coordinates with these:


$gameTroop.members()[enemyIndex]._screenX
$gameTroop.members()[enemyIndex]._screenY




To note: there are likely other ways to get those coordinates. I just shared the one I use.
 

Yoraee

Veteran
Veteran
Joined
May 29, 2016
Messages
211
Reaction score
484
Primarily Uses
@Astfgl66 These worked for me! Thank you very much! :D


I actually tried looking through the console (like you taught me in a previous post), and looked through $gameActor, $gameSystem and Sprite_Actor, but didn't go further. Now I know where to look next time! 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

My old project is now a sitcom
How to do implementation the social politcal mechanics in rpg maker? Thank you for quick spark of ideas. Fear of going to the thread lol.
MerlinCross wrote on Switz's profile.
Not sure if you'll see this but I stumbled across your "Open Locker" sprite in a topic. Could I use those?
topic in question
Going to watch an episode of The Office and eat something after this little progress!

Forum statistics

Threads
100,780
Messages
979,421
Members
132,415
Latest member
evaxephongamer
Top