Conditional Branch to test if actor X has buff Y on?

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
797
First Language
French
What it says.
But since buffs can also be doubled (or even tripled etc with Yanfly's stuff), is it also possible to test for double buffs? Just wondering.
 

deykuzor

Korean Guy Screaming in Italian American
Member
Joined
Sep 7, 2017
Messages
23
Reaction score
5
First Language
English
Primarily Uses
RMMV
if(condition){
doThis;
}

condition is an eval of a variable or a returned function call. If true, the if statement executes code within the brackets. If false, it's skipped

doThis can be a command or a function.
 

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
797
First Language
French
Yes but what's the syntax to test a buff (or double buff) on a given actor?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,657
Reaction score
1,110
First Language
EN
Primarily Uses
RMMV
The buff level of a basic param is 0 for no (de)buff, -1 for 1 debuff, +2 for 2 buffs, etc. :kaophew:

This will return the current MHP buff level (MHP is param ID 0) of actor ID 1:
JavaScript:
$gameActors.actor(1).buff(0)
This will return the current ATK buff level (ATK is param ID 2) of the party leader (party index 0):
JavaScript:
$gameParty.members()[0].buff(2)
So you could use one of these references (adjust the numbers as needed) and test it against a suitable number. E.g. Conditional Branch > Script:
JavaScript:
$gameParty.members()[0].buff(6) > 0
I.e. "does the party leader have an AGI buff active?". :kaopride:

Basic param ID <-> param name reference:
0 MHP
1 MMP
2 ATK
3 DEF
4 MAT
5 MDF
6 AGI
7 LUK
[Edit: whoops, I had MAT and MDF swapped in the spoiler. Fixed!]
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

I keep forgetting how much I hate how VX-MV implements fences and autotile tables.
Big 10:40 composition of mine! I'll be using this for a big city in my current project! This track is huge, and took me one entire month of full time work to complete. If you want more info, like on the lyrics, check out this thread.
Balancing the Damage numbers in my Game's Battle System makes me feel like I'm some kind of a Math Genius @_@
Remember, you can enter up to THREE effects for a chance to win a copy of MZ! Only 11 submissions so far, the chances of winning is high! :D https://itch.io/jam/elfkisser

Forum statistics

Threads
99,393
Messages
964,808
Members
131,017
Latest member
mooglerampage
Top