Adding to a variable through script call

KeenWolf

Amateur Game Creator
Member
Joined
Mar 14, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Is it possible to add or subtract from a variable through script calling? I am using Yanfly's Buff and States Core plugin to try and count how many characters in a battle have the state isDead. I found the script call $gameVariables.setValue(var, value); but it only seems to set the vaariable to a specific number or another variable which if I use another variable then I end up in an infinite loop causing my game to freeze.


problem 2.png


Long story short is there a way to add to a variable through script call instead of just setting it?


Yanfly's Buff and States Core: http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,230
Reaction score
3,075
First Language
English
Logic: get original variable, add to it, then put it back in.

Code:
$gameVariables.setValue(11, $gameVariables.value(11) + 1);
 

KeenWolf

Amateur Game Creator
Member
Joined
Mar 14, 2014
Messages
18
Reaction score
0
First Language
English
Primarily Uses
Haha thank you didn't think of that. I only thought of the whole setValue thing.
 

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

Latest Threads

Latest Profile Posts

Benku wrote on Magnus0808's profile.
Hey man you helped me out a long time ago with a plugin i was wondering if you can help me out one more time since its literally the last thing i need help with if not is cool but id figured id ask you one more soild.
Stream will be live shortly with a guest stream! Tonight, a new guest joins~ Feel free to drop by!
Finally told my boss I need a day off. Tomorrow will be my first in 23 days.
Kind of a goofy question but has the pandemic inspired you in any way?

Forum statistics

Threads
95,421
Messages
929,037
Members
125,649
Latest member
Laser_Kirin
Top