Status
Not open for further replies.

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,328
Reaction score
9,716
First Language
German
Primarily Uses
RMMV
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?
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,328
Reaction score
9,716
First Language
German
Primarily Uses
RMMV
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.
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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.
 
Last edited:

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,740
Reaction score
2,266
First Language
Dutch
Primarily Uses
RMMV
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.
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
I'm using yanflys self switch & variable plugin.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,583
Reaction score
2,927
First Language
English
Primarily Uses
RMMV
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.
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,583
Reaction score
2,927
First Language
English
Primarily Uses
RMMV
Okay, so were you able to use the code I gave you and did it work?
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
this is how i'm doing it at them moment but still quite alot more to add.

variable.png
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,583
Reaction score
2,927
First Language
English
Primarily Uses
RMMV
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.
 

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
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
 
Last edited:

Bryanh

Veteran
Veteran
Joined
Sep 16, 2020
Messages
36
Reaction score
11
First Language
english
Primarily Uses
RMMV
@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
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ

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.

 
Status
Not open for further replies.

Latest Profile Posts

:v I "unlearn" how to use the forum.
I've made and moved to a THIRD spreadsheet document to reorganize my thoughts and better plot out my RPG.

halp
Today, we got "The ancient Forest"

Map042.png


And here's a little ingame view:
Clipboard01.png

New Boss Attacks for Soul Hero Adventure:
1,Aim and shoot
2,Boulders falling frenzy
3,Throwing Fireballs
4,Chasing Magical Traps
5,Lasers attack of 360-degree

Forum statistics

Threads
123,291
Messages
1,155,537
Members
161,706
Latest member
Imxbor
Top