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,481
Reaction score
633
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
37,932
Reaction score
10,516
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

Since cats love to walk across keyboards...what would an entire RPG where all the text was written by a cat walking across the keyboard look like? Prepare for the adventures of the hero aaaaaaaaasddfghyuyhju878uiop;'[p0ol,m
Had an idea for a new way to calculate damage and work it in a battle system but I had to restrain myself because it would be such a pain in the ass to balance and I just want something DONE not something COMPLEX
shes so skrunkly
62653655_cacf8KHvo9yU5dr.png
Godot's coding language somehow makes my head spin more than Unity's. (No, I'm not switching to Godot, I've just been seeing a few games in that engine.)
And now a new loading screen because the other one was too "old" :kaoswt:
1679419775847.png

Forum statistics

Threads
129,732
Messages
1,204,718
Members
170,820
Latest member
Halsland
Top