Reset events on area change.

Joined
Dec 24, 2018
Messages
59
Reaction score
3
First Language
Finnish
Primarily Uses
RMMV
So, I have enemies that walk a round the map, and once fought dissapear. I would like for these enemies to be reset on map change, which would at the moment require the transition to somehow changes all the enemies Self-Switches off. How on earth would I go around doing this?

So to elaborate, at the moment when an enemy is encountered, their script switches their Self-Switch to A, which activates the event page that turns them off and invisible.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
You could use a script call in the event used to change map. In the said script call you can change the value of all your events self switches:
Code:
var eventList = [id1, id2, id3, etc]; // change these to be the IDs of your events
eventList.foreach = function(id) {
  $gameSelfSwitches.setValue([$gameMap.mapId(), id, 'A'], false);
};
More about MV script calls can be found in this thread, that also contains an example similar to the one I used.

NOTE: be sure to place this BEFORE the transfer player command.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,370
Reaction score
7,678
First Language
German
Primarily Uses
RMMV
So to elaborate, at the moment when an enemy is encountered, their script switches their Self-Switch to A, which activates the event page that turns them off and invisible.
that is where you went wrong.

remove the self-switch and the second page and just use the "erase event" command.
The switches make this permanent, if you erase the event from memory it will be automatically reloaded if you leave and re-enter the map.
 
Joined
Dec 24, 2018
Messages
59
Reaction score
3
First Language
Finnish
Primarily Uses
RMMV
that is where you went wrong.

remove the self-switch and the second page and just use the "erase event" command.
The switches make this permanent, if you erase the event from memory it will be automatically reloaded if you leave and re-enter the map.
Ah thanks, yeah didn't think of this, as I originally had them leaving corpses behind, but decided against it later.

You could use a script call in the event used to change map. In the said script call you can change the value of all your events self switches:
Code:
var eventList = [id1, id2, id3, etc]; // change these to be the IDs of your events
eventList.foreach = function(id) {
  $gameSelfSwitches.setValue([$gameMap.mapId(), id, 'A'], false);
};
More about MV script calls can be found in this thread, that also contains an example similar to the one I used.

NOTE: be sure to place this BEFORE the transfer player command.
Thanks for your help!
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games? And, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top