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
589
Reaction score
314
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,379
Reaction score
1,557
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,379
Reaction score
1,557
First Language
English
Primarily Uses
RMMV
What plugins are you using?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I'm sure this question's been asked before, but I can't find an answer: is there any way to run the Steam version of RPGMaker *without* being logged into Steam? It's a frustrating extra step sometimes.
Been seeing bright flashes in the sky for a while, and thought it was my eyes playing tricks on me. Nope! Lightning. Now it's raining heavily. Seeing lightning, but not hearing thunder, is weird.
Small Update for myself:
>Two Dungeon maps are done, Dungeon 3 is in progress. Dungeon 4 needs work.
>4 characters set up out of a possible 6 but those come later.
>Hub area needs work.
>Game completion..., 20-25% maybe?
Does anyone else find writing dialogue hard?
You guys want more tutorials? Well not only are we doing new video tutorials with Driftwood, we've also brought in two contributing authors for the blog to get a new tutorial every week! First one here from @Avery
https://blog.rpgmakerweb.com/tutorials/tutorial-mapping-interior/

Next week we'll get something from @hiddenone

Forum statistics

Threads
100,712
Messages
978,633
Members
132,325
Latest member
ighjku
Top