Conditional branch to check actor level?

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I thought that there be an option in the conditional branch box to check if an actor is at or above a specific level, but I was wrong. Is there any special script way to do this, or some way around it?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Control Variables > Game Data will let you put an actor's level into a variable, which you can then use in the conditional branch.  Make sure you put them one after the other, as the variable needs to be set/reset immediately before you do the test.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I'm still a little confused on how that works...


So what I want to happen, is that there is a variable (I called it the "POISON" variable) that is checked at the end of a stage to determine 1 of 3 endings. It's easy to make dialogue choices result in added variables, but I want one point added onto the variable when a specific character reaches level 11.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
you make a new variable and name it "actorXY level", then use a control variable command with the option "game data" to load the level number of the actor into that variable. Game data is the line that defaults to "Map ID", but instead of map ID you can choose whatever game data you need to load.


Then you make a conditional branch checking if that variable is 11 or higher, if yes you add your point.
 
  • Like
Reactions: Bex

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I'm not sure if I'm doing this right...


So I've made a little test map. Don't mind the torn up teddybear, I just used it as a marker to know where to click. That event is a below character action button trigger, the contents just being "Change Level: [Annabelle], + 1" in attempts to test how this works.


The variable event I tried to follow you on was this:





(The second tab is just an empty default tab set to Self Switch A, and there's nothing in it.)


But when I try it out, the moment I open the game I get this:





That line at the bottom being some glitched version of the text box.


And when I click on the teddybear to level up, same thing happens:


 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Not sure about your Graphic Bug Picture but your conditional Branch is always true in your picture. Setup is somehow wrong.


Also Picture of the 2nd Eventpage would be good.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
If you compare a variable to itself it will always be true - you need to compare it to a value. Like "game variable XY > 11" to check if the level is 12 or greater for example


And please configure Yanfly's messaging system correctly - it glitched because you didn't configure it (by default, variable 22 is used to determine the size of the message window as soon as you activate that script - you need to reconfigure it to use variables that are not already used by your events, and then name those variables to prevent yourself from using them for something else.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
If you compare a variable to itself it will always be true - you need to compare it to a value. Like "game variable XY > 11" to check if the level is 12 or greater for example


And please configure Yanfly's messaging system correctly - it glitched because you didn't configure it (by default, variable 22 is used to determine the size of the message window as soon as you activate that script - you need to reconfigure it to use variables that are not already used by your events, and then name those variables to prevent yourself from using them for something else.


Waaaait I think I got it!


I know zero about scripting so I just named variable 22 "YANFLY MESSAGING" so I won't use it for anything else. And that seems to have fixed the problem. I also changed this:


 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
Yanfly's messaging script uses more than one variable...


If you're new to scripting, then work through the tutorial "how to use a script" (link in my signature), you'll have to know what you're doing when using scripts.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Yanfly's messaging script uses more than one variable...


If you're new to scripting, then work through the tutorial "how to use a script" (link in my signature), you'll have to know what you're doing when using scripts.


Uh... Are the variables used 21, 22, and 112? I just looked in the script and tried to search variable...
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top