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,434
Reaction score
606
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
34,763
Reaction score
8,975
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:

Latest Threads

Latest Profile Posts

Anyone want dynamically soft shadow? :kaohi:
1643106068630.png
Happy Birthday, me!
Woops.
giphy.gif
Ack, I've got to make a script support thread... I hate doing it now; I feel like an annoyance to people. Especially because my questions are usually stupid. Or, at least I assume they are when I don't get any replies lol. Oh well, I'll just make it in the morning. No point doing it now if I'll be asleep.
Slowly working on directions and walking sprites. :kaoback:
mA1ETTy.jpg

Forum statistics

Threads
118,685
Messages
1,117,866
Members
155,806
Latest member
luciann
Top