Having a state increase a variable when applied?

Rekkid

Villager
Member
Joined
Jan 3, 2014
Messages
8
Reaction score
0
First Language
English
Primarily Uses
Basically what I want to do is have variable X increase whenever State Y is applied and decrease when State Y is removed. I have tried using Yanfly's state core plugin but it doesn't seem to work, maybe because it doesn't happen in combat. Is there any other way to achieve this effect?
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
782
Reaction score
422
First Language
Poland
Primarily Uses
RMMV
You need a plugin Yanfly's Buff States Core.
Install it and in your custom state's field type:
Code:
<Custom Apply Effect>
$gameVariables.setValue(id, $gameVariables.value(id) + 1);
</Custom Apply Effect>

<Custom Remove Effect>
$gameVariables.setValue(id, $gameVariables.value(id) - 1);
</Custom Remove Effect>
Edit: in place of ID type a number representing your variable you wish to alter
 

Rekkid

Villager
Member
Joined
Jan 3, 2014
Messages
8
Reaction score
0
First Language
English
Primarily Uses
You need a plugin Yanfly's Buff States Core.
Install it and in your custom state's field type:
Code:
<Custom Apply Effect>
$gameVariables.setValue(id, $gameVariables.value(id) + 1);
</Custom Apply Effect>

<Custom Remove Effect>
$gameVariables.setValue(id, $gameVariables.value(id) - 1);
</Custom Remove Effect>
Edit: in place of ID type a number representing your variable you wish to alter
I have tried this already and it did not work.

This is what I have written in the state's note box:
<Custom Apply Effect>
$gameVariables.setValue(4, $gameVariables.value(4) + 5);
$gameVariables.setValue(5, $gameVariables.value(5) + 10);
</Custom Apply Effect>

<Custom Remove Effect>
$gameVariables.setValue(4, $gameVariables.value(4) - 5);
$gameVariables.setValue(5, $gameVariables.value(5) - 10);
</Custom Remove Effect>

I don't think Yanfly's plugin will work here either because my game doesn't actually enter combat or maybe theres an incompatibility with another plugin.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,947
First Language
English
Primarily Uses
RMMV
I have tried this already and it did not work.

This is what I have written in the state's note box:
<Custom Apply Effect>
$gameVariables.setValue(4, $gameVariables.value(4) + 5);
$gameVariables.setValue(5, $gameVariables.value(5) + 10);
</Custom Apply Effect>

<Custom Remove Effect>
$gameVariables.setValue(4, $gameVariables.value(4) - 5);
$gameVariables.setValue(5, $gameVariables.value(5) - 10);
</Custom Remove Effect>

I don't think Yanfly's plugin will work here either because my game doesn't actually enter combat or maybe theres an incompatibility with another plugin.
Custom Apply Effect will still trigger if the state is applied outside of combat.

Your effects work fine on my end so if they're not working for you it must be a compatibility issue with another plugin. I can't imagine what would interfere with this though.
 

Rekkid

Villager
Member
Joined
Jan 3, 2014
Messages
8
Reaction score
0
First Language
English
Primarily Uses
I guess I'll need to troubleshoot to find out which plugins are making it not work properly. Thank you for confirming.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,947
First Language
English
Primarily Uses
RMMV
What plugins are you using?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Staring at all the RPG Maker versions I have and realizing that my project has been a long time coming. But, I finally feel like I have the knowledge and experience to make it into something good.
We're almost done with the jam game! :D
I get scam calls all the time so today I gave them a piece of my mind. They hung up on me. Sweet revenge.
There’s a beehive in my wall

Forum statistics

Threads
104,319
Messages
1,005,526
Members
135,841
Latest member
Rixxus
Top