Conditional Branch for MP Regen is dysfunctional. Please help!

Status
Not open for further replies.

Cuddlebuns

Veteran
Veteran
Joined
May 5, 2019
Messages
35
Reaction score
4
First Language
English
Primarily Uses
RMVXA
I have this common event running as a parallel process.

Screenshot (105).png

The common event is a very simple, three-step process:

Step 1: Define the variable "Joy" as the player's MP.
Step 2: If "Joy" is greater than 0, heal the player's MP by 1 every 120 frames; otherwise move on to Step 3.
Step 3: If "Joy" is equal to 0, damage the player's HP by 1 every 60 frames.

The conditional branch in Step 2 seemingly ignores the variable it is meant to check and heals the player's MP every 120 frames regardless of whether "Joy" is equal to 0. At absolutely no point in this common event does it say to keep healing MP even when "Joy" is equal to zero. This is the first and only common event I currently have in this project, and already it has become painstakingly inviting of my singular derision.

I am so infuriated with this, I am just about ready to explode in a fiery fit of rage and break everything around me. I need help!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You may have other MP regeneration items, which will kick in every so many steps. However, to test your event, add a text box in each of the conditions, which say:

This is the first case: \V[2]

For the else, have the test box say:

This is the 2nd case: \V[2].

This will tell it to output the value of the variable, and you will know which loop is being run.

Also you should really name the actor, as it is saying [].mp, so you might be getting garbage input. And you also have an extra set variable command in the last loop which is redundant, and would mess up error checking too.

One last thing: Check all scripts. Some use variable 2 for the coding. If that happens you will get unpredictable results. You may need to change to variable 22, as 1 - 20 get used by many scripts if you don't remember to configure them first.
 

Cuddlebuns

Veteran
Veteran
Joined
May 5, 2019
Messages
35
Reaction score
4
First Language
English
Primarily Uses
RMVXA
I have no items, armours, weapons, or parameters which cause MP regeneration. I conducted two tests. In both tests, the actor's name was aptly changed to "Yellow Dot".

The first test was done with the variable identification number unchanged.
Screenshot (106).png

The result of the first test indicated the first case was triggering every 120 frames, with "Joy" equal to the player's MP. Aside from the text, there was no change.

The second test was done with the variable identification number changed to 22.
Screenshot (107).png

The result of the second test indicated the first case was triggering every 120 frames, but "Joy" was shown to be 0 regardless of the player's MP.

Edit: I just noticed that I made an error in the second test. I forgot to change the variables within the text. Upon fixing this, the result of the second test is the same as the result of the first test.
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I don't think your event's logic is solid. You are continually setting Joy to MP, then if Joy is greater than 0, you increase MP. Therefore, if Joy is ever greater than 0, it will continue to grow to infinity unless you specifically do something to set it all the way back to zero.

A good way to debug this is to set a "test" variable equal to the Joy, and directly set another "test" variable equal to the player's MP, and then print them both out in a message box (example: "Joy is \V[28] and Player's MP is \V[29] ") after every instance where you change either MP or the original Joy variable.

The one other thing that could be screwing you up is if you are referencing the wrong actor's MP. I see "[]'s MP" in your event and, without any other info, I become suspicious that you might be referencing an actor that doesn't exist or an actor you don't mean to.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Please name all your actors (and other database items), NEVER let them without a name like you did with your main actor.
Even if the player is to name that actor, it needs to have a default name.

After that, check your common event again if you selected the correct actor for the control variables.
Because if you have several unnamed actors, you'll never know whose MP you have read - that name is supposed to be inside the brackets.
 

Cuddlebuns

Veteran
Veteran
Joined
May 5, 2019
Messages
35
Reaction score
4
First Language
English
Primarily Uses
RMVXA
I only have one actor in this project, so there is absolutely zero chance that I am referencing a nonexistent or incorrect actor. Also, the MP healing targets the entire party anyway.

Edit: TheoAllen's suggestion solved the issue immediately. You are a hero!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Also if you use \V code, the [] in there is the # of the variable. So if you change the variable to 22, you need to change the call to \V[22] also. Something you'll want to keep track of for future debugging.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

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,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top