MV Multiple self Variables

What I'm trying to do is if a variable is certain number or above say like 4 to 8 then I will add 1 to the self variables on multiple events on that map

Can do it using the plugin command but would have to have quite a few plugin commands so just wondering if there was a way to do it to a batch of events, instead of doing them 1 by 1

using Yanflys Self switches & Variables

Thanks
theoretically yes, but your desciption is a bit short to understand what you really want.
and as a result there are a few place where you can go wrong with using the required scripts.

can you give a bit more info on how that event should work?
Basically I have a farming system that when you water it turns on a self switch then goes to the next event page, what I want to do is for it to check if a variable is a certain value to do it automatically say if its raining

Could do it with parallel process but that would probably cause a lot of lag

Hope that explains it better.
autonomous movement sequences are like minor parallel processes, and as such the lag would still be extreme if you have more than a few plots.
and basically you should not use either for this.

instead, the event that makes it rain (however that works) should use the commands to switch the self-switches. that way you don't have the extreme number of checks if the variable is set, but go directly to the cause.

the command to use is the same - it is the script command to turn other event self switches and as such has already been referenced dozens times here on the forum.
sorry, I don't have the link ready at the moment or I would give it to you.
Ah ok thanks I have search but couldn't find anything. Could probably do it by adding 1 to every self variable on that map if there's a script call for that?

Edit

using plugin command

SelfVariable Map x, Event y, Variable z to value + 100

is there a way to do it to multiple events like 1 to 20? i've tried


SelfVariable Map x, Event 1 to 20, Variable z to value + 100

but didn't work thanks.
Bump
depends what you plugin you use, and if your function
handles "to" or "-" or what in range.

if it doesn't has it, it doesn't work, but if you want a range,
you can set a variable or keys if it's the same and do it with
a scriptcall instead.

and set the id's in a array:

let mapID = 14;
let events = [1,2,3,4,5,6,7]

but I need the snippet I saved somewhere, that checks each eventID.
if it constant differently, and want a range, you need to add that function
in the plugin if you have/use one.
I'm using yanflys self switch & variable plugin.
SelfVariable Map x, Event 1 to 20, Variable z to value + 100

but didn't work thanks.
There's a lot wrong here.

First, you can't just change syntax for plugin commands. The syntax in the instructions is SelfVariable Map x, Event y, Variable z to value + 100 - You typing "1 to 20" is not a value for "y".

Second, you did not supply any values for x or z, so there's no way your command would be able to do anything.

In addition to the plugin commands, there are JavaScript functions provided in the instructions at the bottom. These can easily be used in a code loop to apply changes to all of the events on your map.

You still haven't shown how you're doing the rain, so I'm just guessing and throwing stuff at you, but this should work. On the event on that map that's causing the rain, you make a regular Conditional Branch for the variable that you've been mentioning. Then inside that, you can make a Script event command and enter:
Code:
for (var i=1; i<21; i++)
    this.setSelfSwitchValue(mapId, i, switchId, true);

Then you must correctly replace the values for mapId and switchId.
I changed the values, I was using that as an example.

The rain is done by a variable if it a certain number or above than it will rain using the built in weather.
Okay, so were you able to use the code I gave you and did it work?
Ah that's for a switch sorry I was ment to change my original post I got around that.

What I'm trying to do is if a varible is certain number or above say like 4 to 8 then I will add 1 to the self variables on multiple events on that map

Can do it using the plugin command but would have to have quite a few plugin commands so just wondering if there was a way to do it to a batch of events, instead of doing them 1 by 1

Thanks
this is how i'm doing it at them moment but still quite alot more to add.

variable.png
Ah that's for a switch sorry I was ment to change my original post I got around that.

What I'm trying to do is if a varible is certain number or above say like 4 to 8 then I will add 1 to the self variables on multiple events on that map
So why didn't you just look at Yanfly's instructions for the variable version of the function I used? It's only one word different.

The only difference is instead of you being able to just say a switch is true, you have to get the current value of the self variable. According to Yanfly's instructions, that call is this.getSelfVariableValue(mapId, eventId, varId)

Then the function to set the variable's value is this.setSelfVariableValue(mapId, eventId, varId, value)

So, using the code I posted for you before,
Code:
for (var i=1; i<21; i++)
    this.setSelfVariableValue(mapId, i, 20, 1+this.getSelfVariableValue(mapId, i, 20));

again, filling in the map ID where labeled. I pre-filled in the variable ID as 20 since it looks like that's what you're using for all of them.

If you need to do something similar for a different range of numbers, simply change the values in the first line.
I did look at the plugin help but still wasn't sure how to add 1 to all self variables, so thought I would ask, I will try your code when I get back on my computer.

I only ask when I've literally looked at the instructions done a internet search and trial and error.

I appreciate you taking the time to help me thankyou
@ATT_Turan it worked thankyou so much after your explanation it made more sense and helped me with another event a credit to the community

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/multiple-self-variables.147655/