Defining and modifing global variables

[SIZE=10.5pt]In my game I'm using Yanfly Engine Ace - Passive States v1.02[/SIZE]

[SIZE=10.5pt]Link - [/SIZE]https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/passive-states/

[SIZE=10.5pt]For those who don't know it's a script that allows certain party members to have states applied to them permanently.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]What I want is for some of my heroes to be able to change the state that is applied to them.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]The way I thought about it is so:[/SIZE]

[SIZE=10.5pt]I have to define the state in the character's notebox, nowhere else, so I'll define the state as a global variable[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]Instead of <passive state: 28>[/SIZE]

[SIZE=10.5pt]I'll have <passive state: global.character1_state>[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]And then all I would have to do to change the state would be to modify that global variable. It should work, if it could be done.[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]My question: how do I do this? Where would I have to define that global variable and how would I modify it?[/SIZE]
Please give a link to the script you're using, preferably to yanfly's page and not the direct download.
Please give a link to the script you're using, preferably to yanfly's page and not the direct download.
https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/passive-states/
I found a solution.

A little studying of the ruby language and a lot of trial and error and it worked out! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/defining-and-modifing-global-variables.54586/