SwiftIllusion

Veteran
Veteran
Joined
Jan 8, 2016
Messages
103
Reaction score
169
First Language
English
Primarily Uses
RPG maker MV 1.0.1


I've run into a significant issue where the engine doesn't actually delete events as it should be doing.


I've confirmed this in a new project without plugins and couldn't find any posts regarding it via searching the forums/google.

The problem I have is that I'm trying to check if there aren't events at locations, but each time any event is 'erased' at that location, they aren't actually erased and are telling my conditional checks that events exist where they don't.
The reproducible version of the check in the blank project was:
6e646752157cbae45556dffaabed1134.png


An event besides this, at (9,6) is 'erased' when switch #0001 is turned on, and sure it disappears and then I'm pushed back.
But I move back to the event above and click on it, and sure enough I'm moved up again, even though that event should be gone.
At this point it completely stops a core function of my project because I need to make sure there are no events in front of my player for an action I want to perform, however when events are 'erased' on the map it causes the action to seemingly randomly not perform because of invisible events that aren't actually removed.
I hope this isn't intentional functionality? Would appreciate any information regarding this.
 

Liak

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,788
Reaction score
270
First Language
German
Primarily Uses
That has always been the case I believe. The wording is simply wrong. It should be "Erase Event Content" or something along these lines. If you want to get rid of an event, all you can really do is move it to a different location in addition to turning it off via "Erase Event" or switch.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,880
First Language
English
Correct, events that are erased are simply hidden from view.


This is because if you wanted the event to come back, you wouldn't have to keep track of the event's location or anything.


You can define a new method that will return all of the events at that position that aren't erased


Game_Map.prototype.eventsXyNotErased = function(x, y) {
return this.events().filter(function(event) {
return !event.isErased() && event.pos(x, y);
});
};

Game_Event.prototype.isErased = function() {
return this._erased
};


This would return a list of events at that position, and then you could do something with that information.

Code:
if ($gameMap.eventsXyNotErased(1, 2).length !== 0) {
  // do something if there is a non-erased event at position (1, 2)
}
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,721
Reaction score
8,504
First Language
German
Primarily Uses
RMMV
The reason is that the mapfiles are read-only and can't be changed. Because of this, all events are reloaded on entering a map and you'll have to use plugins for saving changed positions and switches (or other independent conditions) for storing changes in the story/map.
 

Vianoce

Villager
Member
Joined
Dec 23, 2014
Messages
8
Reaction score
1
First Language
English
Primarily Uses
You could just move the event out of the way (until you need it there) with a script call. By starting a new page with its Autonomous Movement set to custom, and using the following script call you can move the event to a safe location, then move it back if the need arises.


$gameMap.event(eventID).setPosition(x, y)
 
Last edited by a moderator:

Liak

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,788
Reaction score
270
First Language
German
Primarily Uses
I keep being astonished by how quickly many of you guys jump to plugins and script calls. There's an event command called "Set Event Location" already. :p  Use that with a Parallel Process and it's done as well.
 

Vianoce

Villager
Member
Joined
Dec 23, 2014
Messages
8
Reaction score
1
First Language
English
Primarily Uses
I keep being astonished by how quickly many of you guys jump to plugins and script calls. There's an event command called "Set Event Location" already. :p  Use that with a Parallel Process and it's done as well.



I'm amazed that their always seems to be that one person who, for lack of a better word criticizes people for using "advanced" techniques to solving problems. Everyone has their methods. If someone is trying to avoid using too many parallel processes then the method you mentioned might not work for them. It is a good method, but in this instance I would just have it set in the autonomous movement settings so it is quick and only processes once without having to do more than a very simple script call, uncheck a check box and click ok.  To me this just seems more efficient; than using a parallel process that either repeatedly sets the events location or having to give the event page additional content to prevent it from continuously processing. I would only use your method if I was eventing a cut scene that had more going on than just moving the event, it isn't worth using a parallel process to me.


In case you're wondering I worry about wants running because I want to play my games on my tablet and my tablet is a piece of junk. 


I think it's great that you point out that these problems can be solved with event commands. It can be encouraging to those that are less inclined to use script calls. However I see no reason that people should be criticized for their willingness to use script calls though. The engine itself has a number of script calls that are there for the purpose of allowing developers be more efficient in their eventing. When the engine comes with built in script calls, they are just advanced event command that expand on the 3 default event command pages and each individual developer is able to figure out how to use them for themselves to help with their eventing. I don't use script calls for everything, but there is nothing wrong with using them for a quick solution to a little problem. I am just surprised how often people make an advanced method seem like a bad thing or something. 
 

SwiftIllusion

Veteran
Veteran
Joined
Jan 8, 2016
Messages
103
Reaction score
169
First Language
English
Primarily Uses
Thanks a lot for all your responses and clarifications :)!!

@Tsukihime
Oh my goodness thank you SO MUCH :D! That worked perfectly!!
The reason other solutions wouldn't work like just moving events out of the way is I have an animation play at the events location upon being erased and don't want to have to make the event wait until the animation is completed before actually being 'erased'>moved as that's a period of time where it would still count as existing there, which I don't want.
So sincerely thanks for your awesome solution :D!


@Andar


Ahh, I hadn't encountered this yet, thanks for the heads up :).

@Vianoce


I've no problem with advanced techniques but forgive me if I'm incorrect, wouldn't your method to reach the same conclusion actually be more intensive? Having an additional page with a custom movement and script call, instead of just having the image being removed and moved to a location via movement route with erased below it on the same page?
 

Liak

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,788
Reaction score
270
First Language
German
Primarily Uses
Oh, you would actually need a second page for my solution as well, because events reset on re-entering the map. If you want to get rid of the event forever, you need to run the "Set Event Location" command every time you enter the map. So there's really nothing to gain here.


@Vianoce: I'm not against using advanced techniques at all. I was just saying that sometimes, they are in fact overkill. :)
 

Vianoce

Villager
Member
Joined
Dec 23, 2014
Messages
8
Reaction score
1
First Language
English
Primarily Uses
@Vianoce


I've no problem with advanced techniques but forgive me if I'm incorrect, wouldn't your method to reach the same conclusion actually be more intensive? Having an additional page with a custom movement and script call, instead of just having the image being removed and moved to a location via movement route with erased below it on the same page?



Sorry, one of my responses was to Liak.


That way works too, but it is hard to say without knowing the purpose you needed to perform this check and if the event is worth bringing back. Since were trying to erase the event then your method would be the better option, and you can just use the method Liak mention with the event command. The method I mentioned and failed to say why, was so you could move the event without having to erase it and allow for it to be used again later. It is all really situational and what works best for you. Unless you have something saving it's last location like Yanfly Engine Plugin - SaveEventLocation, then the event should move back when ever you re-enter a map. You could even make the event move back, or to a new location if the right conditions are met your self instead of having to re-enter the map. I have an npc that moves locations based on what time it is. On another RM forum I have shared a common event system that gives the game time, rising and setting sun, clocks, etc. The only script calling in the whole system is to store strings to game variables for message boxes. Back to the npc; there are times in the day where he is not "home." Event locations are not being saved on this map so when he isn't there he would not pass your check. I would have to move him and none of the event pages I have for him would work with a move route command added to the contents page nor using a move event command for that matter. What ever method you choose if the method works, it works. The question is what works for you. I just wanted to add a method I find myself using from time to time that I thought might help your situation or even maybe a future similar situation. I think it would work betting in the autonomous movement settings rather than in the contents page is because in theory it should process faster to move out of the way, depending on how you do it speed might be an issue. 


I really have no idea what you have planned for this check event but it gave me an idea of what I would do with something like that. Say your whole thing is for an item finding event, like treasure hunting or metal detecting. You could have a single event spawn in any number of locations randomly with a wait time before they appear. You wouldn't want the action to keep telling you there is an item where you just found one (unless another one spawned there). You could make a variable with a random value, then make conditional branches to switch pages with each page being for a desired spawn location based on that variable. I would make it so the initial page start out of reach of the player. This location would be it's dormant location waiting between spawns with a wait timer. This way even if an item were to appear in the same location it wouldn't happen right away. You could have a move event command on the first page for each conditional branch, or set it in the autonomous movement settings using the script call that I gave before. Having the initial page with the move event in the autonomous movement settings would save you from having to move the event back to 'the out of the way dormant position' on each page. 
 

SwiftIllusion

Veteran
Veteran
Joined
Jan 8, 2016
Messages
103
Reaction score
169
First Language
English
Primarily Uses
Looks like there's going to be hoops to jump over once I start working on larger projects with multiple/returning maps, thanks a lot @Liak and @Vianoce for taking the time to help me prepare for that :) I'll be sure to refer back for your methods once I need them, really appreciate it!


@Vianoce Ahh yeah makes a lot of sense, thanks for sharing those multiple use case examples and methods ^^!
 

Latest Threads

Latest Posts

Latest Profile Posts

My friend just gave me chocolate milk at lunch today! My day is now 1000x better. Yay, choco milky!! :kaojoy:
RivalRamen_Games wrote on jacobv1014's profile.
I really like your profile picture! Who is that in it? is she an OC?
Making his first game
This scene was suppose to be a test... but now, it's going in the game as official side/optional content. :kaosalute:

Forum statistics

Threads
115,330
Messages
1,089,060
Members
149,997
Latest member
MrEyeEYe
Top