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
688
Reaction score
380
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,602
Reaction score
1,933
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,602
Reaction score
1,933
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

Ok i got the model New and I will develop a little more, I think my SV is not beautiful yet.
"I, Giorno Giovanna, have a dream". In all seriousness, spatial BGM feature is now complete for my audio plugin.
Stream will be live shortly with some game development followed by the return of the Interactive Text Adventure after a short hiatus! Feel free to drop by!
Lately, I've taken to smashing random nouns/verbs together as insults. It's sort of amusing how many people don't really know how to respond to that. You bottle shaker!
Would be nice to pick color code that is not exclusively for message event

Forum statistics

Threads
103,243
Messages
998,317
Members
134,734
Latest member
Avaross
Top