Save Event Position

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
Save Event Position
2015.11.12
by Shaz

Introduction
This plugin lets you set a position and direction where an event will be the next time the map is loaded

How to use
Add to your plugins folder (file name is irrelevant, but I use SaveEventPosition.js). There are no parameters to set.

Use any of the following plugin calls to save or forget the current event's position:
SavePos
SavePos x y
SavePos x y dir
ForgetPos

Use any of the following plugin calls to save or forget another event's position:
SaveOtherPos eventId
SaveOtherPos eventId x y
SaveOtherPos eventId x y dir
SaveOtherPos mapId eventId x y dir
ForgetOtherPos eventId
ForgetOtherPos mapId eventId

Use any of the following script calls inside a move route to save or forget the target's position (applies to events only):
this.savePos();
this.savePos(x, y);
this.savePos(x, y, dir);
this.forgetPos();

mapId, eventId, x, y and dir can be values or formulae to be evaluated. If using a formula in a plugin call, ensure it has no spaces.


Plugin
Download from pastebin

Credit
- Shaz

Terms
- free for use in commercial games

Notes

- This plugin does not MOVE an event to the specified position on the current map.  It simply records the 'starting' position for next time the map is loaded.  If you want an event to move to a certain position and then stay there on subsequent map loads, you need to move it there first, with a Set Move Route or a Set Event Location command or similar, and then add the plugin call to save the location.
 
Last edited by a moderator:

Obsidian

Villager
Member
Joined
Jun 14, 2015
Messages
20
Reaction score
12
First Language
English
If I move an event, save it, and then move it again, would I need to forget, move route, and then save again? Or would I just move the event as usual and then save again? 

Thanks a lot for this, the location resets were making things very frustrating. 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
You just need to save it again after moving it again.  You don't need to forget.  There is only one save location for an event, and each time you save, it overwrites what was there previously.  You only need to forget if you want it to go back to its in-editor position.
 
Last edited by a moderator:
  • Like
Reactions: Bex

majigecchu

Warper
Member
Joined
Dec 26, 2015
Messages
1
Reaction score
0
First Language
Chinese
Hi Shaz,

Is there a way to get the event's current x location or y location?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
If you want an event to save its current position, just call it without passing the x and y variables at all. It defaults to the current x and current y if you don't pass them.
 
  • Like
Reactions: Bex

Oddlaw

Villager
Member
Joined
Mar 20, 2016
Messages
7
Reaction score
0
First Language
Spanish
Primarily Uses
Hi, about the forgetPos pluggings command;


None of them works for me.


I have this event that given the moment change of location and savepos. All working until there, but when I want to do that event forgetpos and go back to the in-editor position it does nothing and retains the savepos position.


I dont know if I'm missing something or is the plugging.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
Can you please post a screenshot of the event with the plugin commands visible?  I'd like to see both the ones to make it remember its position, and the one to forget its position, just for clarification.  Please include the entire event window, not just the command list.  I'm interested in the triggers and tab numbers as well as the commands themselves.
 

Oddlaw

Villager
Member
Joined
Mar 20, 2016
Messages
7
Reaction score
0
First Language
Spanish
Primarily Uses
I made a new project just to be sure that there wasn't any other plugging interfering.


First, the savepos command; (it works)

Event 1.jpg



Second, the forgetotherpos command; (doesn't work)

Event2.png



Third, the forgetpos command; (doesn't work)

Event1_2.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
Did you go to another map and then back here again to verify the event has not moved back to the original position?  Are you expecting the ForgetPos command to put the event back to its original position immediately?  None of the plugin commands actually cause the event to move anywhere - they just record (or forget) where the event is meant to be placed the next time the map is loaded.

Notes


- This plugin does not MOVE an event to the specified position on the current map.  It simply records the 'starting' position for next time the map is loaded.  If you want an event to move to a certain position and then stay there on subsequent map loads, you need to move it there first, with a Set Move Route or a Set Event Location command or similar, and then add the plugin call to save the location.


So this is only an issue if you have used the ForgetPos command, left the map, come back, and the event is still in its previously-saved location.  Is that what is happening?  Or have you just not left the map yet?
 
Last edited by a moderator:

Oddlaw

Villager
Member
Joined
Mar 20, 2016
Messages
7
Reaction score
0
First Language
Spanish
Primarily Uses
I tend to read well the instructions, specially when it doesnt work the way I tought. So yes, I have obviously left the map and come back (thats the main reason one may need this kind of plugging) therefore if you check the first screenshot you will see the door for leaving the map and coming back.


This is what happens;

  1. I move the event using the event editor, and save his location via savepos
  2. I leave the map and come back to check if it works (it does)
  3. I use the switch to forgetotherpos or I talk to the event to activate the forgetpos plugging.
  4. I leave the map and come back to check if it works (it doesn't) the events holds the previously-saved location.

No other plugging is installed and the F8 Devolper Tool shows no error.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
thanks. I'll see if I can reproduce and fix it.
 

DuraLexSedLex

Villager
Member
Joined
Feb 13, 2016
Messages
26
Reaction score
4
Primarily Uses
Hi, the plugin works fine if I run directly this.savePos(); inside a move route via an action button on an event. However, if I run the same through a common event, the position and direction is not saved and changes the direction to facing left upon exiting and returning to the map.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
please post a screenshot of your common event making sure to show the whole window, not just the list of commands.


Without seeing it, I am guessing you've either done a script call (not inside a move route) with this.savePos() or that your common event is an autorun or parallel process, which is not tied to any map event.
 

DuraLexSedLex

Villager
Member
Joined
Feb 13, 2016
Messages
26
Reaction score
4
Primarily Uses
The first picture is a normal event which upon meeting the conditions will set up a timer and change to a specific charset frame(Using Galv's plugins) and turn on some self switches(Using Yanfly's plugin) and save the position and direction(Using your script).


s1.jpg


The second picture is a common event being run in a parallel process via a normal event in a map. Upon meeting the conditions and using the same plugins, the common event will turn on some switches and change sprite frames, however, this time it won't save the position for event 39 upon exiting the map. And I've even tried to use the SaveOtherPos() plugin command.


w2.jpg


Both are two separate events and I'm using them for a farm system I'm trying to make. The 1st event is for the planting process, while the 2nd one is a checker to check if the plant has fully grown. Both are conditioned not to run the same process in conflict with each other and with itself.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
Do they both not work, or does the first one work and the second one doesn't?


Can you try it without Galv's plugin and see if it works?  It might be a compatibility issue.
 

DuraLexSedLex

Villager
Member
Joined
Feb 13, 2016
Messages
26
Reaction score
4
Primarily Uses
The first one works just fine, however the second one does not. I tested the second one without Galv's plugin as you said and used normal move routes(up,down,left,right) and sadly I think that it is a compatibility issue. I'm not sure why the first one works perfectly though. Thank you!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
So without Galv's plugin, the second one also works?  Does everything else in the common event run when you have both plugins active?
 

DuraLexSedLex

Villager
Member
Joined
Feb 13, 2016
Messages
26
Reaction score
4
Primarily Uses
Yes, the second works without Galv's plugin. I'm not sure what you mean, but the common event is conditioned to run only what is required and as an additional assurance, I added the exit event processing and will not run again unless another condition is met. And the only issue when both are active is that even though the sprite frame changed for the event, upon exiting the map and returning, the event changes to a specific frame. Thanks anyway, Shaz! I'll find a work around the common event. Great plugin!
 
Last edited by a moderator:

Annwfn

Veteran
Veteran
Joined
Nov 6, 2019
Messages
39
Reaction score
4
First Language
Romanian
Primarily Uses
RMMV
Hello! I know it's been long since this discussion, but I have a kind request. I would have a BIG issue with my project if a feature would not work (not tested it yet). If I switch maps, all my student events will vanish/ or be reset (won't appear due to timer conditional). Let's presume I will fix the timer thingy, is there a way to preserve the REMAINING movement commands of the events? Like, when I get back to the map they remain where they were through plugin,
but... stick to the remaining number of tiles they have to walk rather than reset and start all over (and end up moving on walls XD) And yes, before you ask, they are Parallel Events. And they are 80. That have to go through different directions, so 1 single parallel event to control them while I put them back as Action Button/ Event Touch would be... strange.

I found a possible solution, but would really not mind an easier way. Thank you in advance!

*I just am working towards the most mechanic-intricate RPG Maker MV game*
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,777
Reaction score
12,206
First Language
English
Primarily Uses
RMMV
No, this plugin won't do that. But I believe someone else has written something that might help you. I just don't remember who that was or what it was called. I suggest you post in plugin requests and ask for a plugin that will save the movement route position when leaving a map and resume from the current point when returning.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Ugh....When you spend hours doing something and then end up scrapping the idea >.<
Random joke of the day: This morning a man wearing a face mask robbed a supermarket in the town center. So far the police has arrested 240 suspects.
Hosting competitions using your game is always so nerve wracking!!!
Social distancing is great, apart from trying to work from home while the guy up the road now has ample time and apparently the only way to fill it is to ride his dirt bike up and down our street all day :(
I worry for the outsiders who send me emails trying to recruit me for their project, but don't even tell me what their project is or what they want in the first and second emails. This is not how you do it and why I like this site more. It is mandatory that you describe your project in detail in the recruitment section at the least!

Forum statistics

Threads
95,460
Messages
929,284
Members
125,695
Latest member
nasavat
Top