Dynamic switch & variable setting inside events.

Hi.

So, I've been making an all map battle system with parallel events through switches and variables and it's working exactly as I want it to but now I'm trying to improve it a bit so it's easier to apply it to more enemies.

Currently, every enemy uses 5 switches and 2 variables for different things and since I don't want to manually edit all the places to change the number of the switch and variable for every enemy I was wondering if there's any way to do something like this.

Example of what I want to do:

sA = 1
sB = 2
vA = 1

if switch[sA] == true
switch[sA] = false
variable[vA] += 1
switch[sB] = true
end

I'd like to set up the whole battle system like this so I just have to set up switch and variables numbers at the beginning of the event and not change it everywhere else as well. Is something like this possible without using scripts?
It's such a pain, right? to manually copy paste edit every event to give them personal switch and variable ID...
I can only assume, but I think I got what you're tryin to do.

Access the switch and variable via script call, then make use of each event unique ID. If I remember correctly, for RMXP it should be like this :
Code:
$game_switches[event_id] = true / false
$game_variables[event_id] = x

Then using your example, It should look like this (I don't have RMXP):
sA = event_id
sB = event_id +10 (you might want to change the value to your liking)
vA = event_id
upload_2019-9-5_17-57-17.png


event_id mean this event ID. So if you apply this script call on event 5, based on my example, you will be using switch 5, switch 15, and variable 5. Watch out for the event ID before applying tho. Take care not to pass their limit.

I'm not good at explaining stuff, but I hope you got it.
Thanks for the reply.

I don't think your solution would work since every map has its own event_id index numbers. What I mean is that there would be same numbered event_ids on two different maps which I think would mess things up in some cases (if two enemies on two different maps have same event id).

But you've given me some idea that I'd like to try when I get home.
... O__o
You wanted to treat events from outside the map to? In real time? Now I'm doubting your eventing...
What?

The enemies I put on the map won't respawn(when you leave map and come back) after they're defeated so if two enemies on different maps share same variables and switches (which some of them will do since they'll have same event id) that would mean that whichever enemy you defeat first the one on the other map won't spawn at all.
Let me just say that maps in the RPGMaker line are not dynamic. Kill an enemy NPC event, leave the map, return to the map... *POOF* There he is. Well... MOSTLY. While RMXP general switches and variable stay, the self switches may reset. What you want is something more.... Dynamic.

Years ago, Near Fantastica wrote the first Dynamic Maps system which was later tweaked by Wachunga to make it more compliant with other map scripts. There were still some things overlooked, so I did a bit more tweaking as you can see here:
https://www.save-point.org/thread-6869.html

You may find it easier to handle enemies by way of individual self switches with this in your project.
That's it dude!
It never occurred to me to use self-switches!
I would only need to change variables which is not much of a hassle since I would need to change it for each event in only two places.
I can't wait to get home and try it out!

Thanks a ton.
Might I also interest you in Self-Variables?
https://forum.chaos-project.com/index.php/topic,5357.0.html

Is it free to use in commercial games? Some of the scripts I wanted to use from their site said that they can't be used in commercial games. This script doesn't say anything tho.

EDIT:
I also noticed that using the script results in an error when loading old save files. I guess it requires you to start a new game to work properly.
If it's not mentioned in the post, then it's free for all uses. You'll have to point out what scripts claim it's not allowed for commercial use and I can give clarification.

Yes, the script is currently unable to work with save files. It needs to create and load the self variables data upon starting a new game.

Original thread: https://forums.rpgmakerweb.com/threads/dynamic-switch-variable-setting-inside-events.112954/