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
535
Reaction score
287
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,338
Reaction score
1,495
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,338
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
What plugins are you using?
 

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

Latest Threads

Latest Profile Posts

When you realize @Kupotepo is a champion among RM Web users, and it all makes sense now:
Worst nightmare this morning, tried to get 20 minutes of work done on my project before heading to work and got hit with a POWER SURGE. Restarted my computer and the project was CORRUPTED, luckily I made a back up a few days ago so I only lost 4 days of work but still
Ami
what the other name of Elixir?

many games are use that,i want name it different.
What does your project folder look like?
I was told that an iPhone can provide a personal internet hotspot...You learn something new everyday!

Forum statistics

Threads
100,458
Messages
976,178
Members
132,082
Latest member
nwr
Top