My programming knowledge is somewhat amateur, so I apologize if what I'm trying to do doesn't make sense.
Essentially, I'm trying to make a spawn system by lottery, whereby a specific variable is given a random value as soon as the character enters a room and Events with Battle Processing are called based on the specific value of the variable. Relevant events will then turn on a self switch or "spawn", and then will turn on a different self switch when "defeated". I have all of this working.
What I then want to happen is generate a new random value for said variable, and turn off all of the relevant self switches. I've accomplished this by making separate scripts for each individual encounter Event using $gameSelfSwitches, and I'm aware that I can do this as a single line by using 'forEach' and manually entering each event Id (e.g. [1, 2, 3].forEach(eventId => $gameSelfSwitches.setValue([mapID, eventId, 'A'], false)).
What' I'm wondering is this: rather than having to determine each event ID and typing out that entire script for each room exit, is there a way to generate a list of Event IDs based on the event name? For example if each encounter event were named evtEncounter, generating event IDs 1, 2, 3 for use in a forEach function?
Essentially, I'm trying to make a spawn system by lottery, whereby a specific variable is given a random value as soon as the character enters a room and Events with Battle Processing are called based on the specific value of the variable. Relevant events will then turn on a self switch or "spawn", and then will turn on a different self switch when "defeated". I have all of this working.
What I then want to happen is generate a new random value for said variable, and turn off all of the relevant self switches. I've accomplished this by making separate scripts for each individual encounter Event using $gameSelfSwitches, and I'm aware that I can do this as a single line by using 'forEach' and manually entering each event Id (e.g. [1, 2, 3].forEach(eventId => $gameSelfSwitches.setValue([mapID, eventId, 'A'], false)).
What' I'm wondering is this: rather than having to determine each event ID and typing out that entire script for each room exit, is there a way to generate a list of Event IDs based on the event name? For example if each encounter event were named evtEncounter, generating event IDs 1, 2, 3 for use in a forEach function?