Keeping Actors in certain spots...

Status
Not open for further replies.

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
214
Reaction score
146
First Language
English
Primarily Uses
RMMV
so I have a way to have actors and enemies not return to their original home positions in battle. but it's a double edged sword lol. people can wander off too far in any direction, going off screen. sooo, my question is... is there a way to check the positions of everyone in battle and if they were to go past a certain point of the screen, basically have an action make them jump back to a different location? the action I'd know how to do... but I'm not sure how to get the positions. and if I have them, would I have a common event check them after every turn in a variable or something? any suggestions would be helpful. thanks everyone!
 

Reylegh

Villager
Member
Joined
Nov 30, 2015
Messages
7
Reaction score
0
First Language
Polish/German
Hmm, does that edge of the screen move?
I ask, since I see 2 possibilities that should be quite easy to achieve - one is a region event (check Yanfly's channel) - so an actor might wander off to a reqion that triggers an even causing the actor to move into a different/preprogrammed location.

However if the edge is moving, then you don't want static regions, in that case you could create a paralel event for each actor that checks his location and trigger a branch when certain requirements are met. Not sure, here, but I think it should be possible to create 'distance' as a requirement.
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
214
Reaction score
146
First Language
English
Primarily Uses
RMMV
does that stuff work during battle? essentially my actors and enemies don't have to return to their starting position and I didn't want them going off screen potentially... but I wasn't aware some like that would work during a battle? or am I confused or something lol
 

Reylegh

Villager
Member
Joined
Nov 30, 2015
Messages
7
Reaction score
0
First Language
Polish/German
ahh, sorry, I didn't realize you meant in battle.

I think there was a way to anchor players in battle, but I have no idea. This doesn't happen in my game :(
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,287
Reaction score
3,608
First Language
English
Primarily Uses
RMMV
Is a a question specific to a particular plugin you are using? Or are you simply asking how it should be done in javascript?
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
214
Reaction score
146
First Language
English
Primarily Uses
RMMV
Someone basically made a plugin for me where how normally during Yanfly action sequences, actors go back to whatever there set home position is... this makes wherever that move ends them, their new home position. meaning if you aren't careful, enemies and actors can end up in really weird places. tho I've found a way around that. just always have a set point or points for them to end up at after attacks end. usually actors jump back to a position anyways in my game. so this looks fine enough.

basically what I wanna know how to do is see if there's a way to track the end position of a move if I DON'T tell the actor/enemy to hop back to a certain spot. If I know that say an enemy was pushed back to 400 x but I feel that's too far back... then is there a way to check if they're past 400 x on the screen? I would then use like an if else statement to put them automatically back to a certain point on the screen.

Sorry if this isn't making sense... I essentially want to be able to let the game know "hey, they're too far in this direction and are about to go off screen, have them jump back to this point"... the reason for this is so I can let things happen naturally in battle without me ALWAYS needing to set predetermined landing points after ever move.

But yeah, I'm basically asking with Javascript codes, is it possible to track actors and enemies positions on the screen and be able to have a way to control event or statements with said information.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
194
Reaction score
60
First Language
English
Primarily Uses
RMMV
This recent thread has a script to get the x or y I guess.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,287
Reaction score
3,608
First Language
English
Primarily Uses
RMMV
Yes you can track objects on the screen. The property is pretty straightforward, it's called x and y, the hard part would be identifying the sprite object itself and changing the position at the right moment in the code. Unless Yanfly has a way to modify the position through eventing or notes, or another method, the only way to achieve that is through the code.

I'm sorry, I'm not too good with Yanfly plugins since I usually code my own plugins and don't use a lot of third party plugins. Perhaps someone else knows a way to do what you're looking for for your Yanfly battle plugins. Until we know if this has to do with a specific Yanfly plugin, or you need to modify the code yourself, or to make a request for someone to do it for you, I won't move the thread (since all those situations would mean a different subforum).
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
214
Reaction score
146
First Language
English
Primarily Uses
RMMV
This recent thread has a script to get the x or y I guess.
This helped me figure it out actually! so basically with SceneManager._scene._spriteset._actorSprites[0]._homeX, I will always know where my actor ends up. as a test, I had it set in a variable. I called the variable in an if... else statement at the end of a Yanfly action sequence. from there you can say, if the actor is past say... 700X by the end of the action, have them jump back to a certain point automatically, and if not... stay put. Thanks everyone! this is extremely helpful!
 

zerobeat032

Cloaked Wanderer...
Veteran
Joined
Mar 28, 2014
Messages
214
Reaction score
146
First Language
English
Primarily Uses
RMMV
Yes, this thread can be closed. I think I can figure out from here how to do this for enemies as well as I've found the code I'd need in another thread.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,287
Reaction score
3,608
First Language
English
Primarily Uses
RMMV
Alright, perfect!

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.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Weather and time system twin release. Now with weather icons and possibility to add them in your custom clock!
Kingdom Under Fire: The Crusaders is finally being ported to PC. I loved playing that game on the original Xbox.
A friend told me to stop making nomnom or gulping noise when eating or drinking. Plot twist of my life. I thought people can't hear that!
Inside you are two wolves. They take in oxygen while getting rid of the Co2 gas in your body...
Ah wait, sorry. Lungs. Not wolves. that'd be silly. Wolves are huge. You probably couldnt even fit one wolf inside you.

Forum statistics

Threads
94,407
Messages
920,736
Members
124,197
Latest member
FJS
Top