Somewhat basic conditional branch not working as intended

This is not all that complicated, so i figured i just made a small mistake that for some reason i couldn't find a solution for.

I just want a dialogue to appear once the player learns a certain skill. That's it. Here's the code.
1728160419245.png

1728160532588.png


I've tested the game and the message doesn't show up, even though the condition was met. What did i do wrong here?
Irrespective of whether your actor has learned the skill, you switch on Self-Switch A.

What you want to to is this:
- Use parallel process instead of autorun
- Your Eventing of Page 1 should look like this:

Code:
If actor learned skill xy
  Show Message
  Self-Switch A ON
End if

- Don't forget to choose another trigger than Autorun/Parallel Process for page2!
CODE]
If actor learned skill xy
Show Message
Self-Switch A ON
End if
[/CODE]

- Don't forget to choose another trigger than Autorun/Parallel Process for page2!
It's not working...
1728162938007.png

1728162955520.png


Perhaps it's the player touch trigger?
Your eventing is correct but is your event on the same map as the player? And, is your player actually on the map while they learn the skill or in battle? If that is happening battles, you want to learn about "Troop events".
Your eventing is correct but is your event on the same map as the player? And, is your player actually on the map while they learn the skill or in battle? If that is happening battles, you want to learn about "Troop events".
Yes, i've done as exactly as you have told me, and didn't work. However i looked up into troop events, tried executing the same code under it, didn't work again.
1728164810630.png
1728164797609.png
Can you insert an else with a message on the condition? Just to understand if the entire event is being ignored (map event)
Can you insert an else with a message on the condition? Just to understand if the entire event is being ignored (map event)
1728166910964.png

It's not being ignored!

EDIT: My bad, on this screenshot above it only shows because i didn't put a self switch. I messed around a bit to put a substitute for it and now the ELSE branch works, but the IF still doesn't do anything. Here is the code:
1728167507048.png

1728167523956.png

1728167545736.png
and you are certain that your actor actually learned the skill? i could be misremembering the base engine, but iirc its only when an actor levels up and gains the skill or is given the skill through events does it counts as being learned. giving it to them through a trait of any kind doesnt count
and you are certain that your actor actually learned the skill? i could be misremembering the base engine, but iirc its only when an actor levels up and gains the skill or is given the skill through events does it counts as being learned. giving it to them through a trait of any kind doesnt count
I don't know exactly what counts as "giving it to them through a trait", but to clarify, the actor only learned the skill by leveling up after beating enemies.
1728167783426.png

Here is proof that the skill was actually learned.
Here is proof that the skill was actually learned.
no, that is only proof that the skill is available and not that it is learned.

Skills can be made available through two different mechanics as told above - they can either be learned or they can be bestowed/equipped.

We need to see the event or the database page where the skill is set to be gained.


EDIT: and I strongly suggest that you place a wait(5) or so at the end of your parallel processes to reduce the lag they create.
Go ahead and force-learn a skill to test and place it above the conditional branch to make sure it is working properly - try the script versions (it will look something like this - change the actor id 1 and the skill id 5 to whatever you are using):
JavaScript:
◇Script : $gameActors.actor(1).learnSkill(5)
◇If : Script : $gameActors.actor(1).isLearnedSkill(5)
  ◇Text...
  ◇Self Switch: A is ON
  ◇
:End
I don't know exactly what counts as "giving it to them through a trait"
1728170145525.png
However i looked up into troop events, tried executing the same code under it, didn't work again.
and to correct another mistake:

the troop event condition "don't run" means "do not execute the code below ever", it comes from "to run a program" and has absolutely nothing to do with escaping.

so of course it never worked as you told it to never work, but that has nothing to do with the code you tried.
JavaScript:
◇Script : $gameActors.actor(1).learnSkill(5)
◇If : Script : $gameActors.actor(1).isLearnedSkill(5)
  ◇Text...
  ◇Self Switch: A is ON
  ◇
:End
I tried that and didn't work, but i've come up with another idea to solve my problem that i'm sure it'll work. nonetheless, thank you very much for trying to help! It always means a lot.

and to correct another mistake:

the troop event condition "don't run" means "do not execute the code below ever", it comes from "to run a program" and has absolutely nothing to do with escaping.
Oh. Oops.
so of course it never worked as you told it to never work, but that has nothing to do with the code you tried.
Sorry about that.

But anyways, the conditional branch i was trying to do only served as a way to measure wether the player was or wasn't strong enough to progress through the area, and instead of using a skill to determine that, i simply used an enemy. If the enemy is too strong, first learn the skilll, use it to beat the enemy and that's it.

Thank you for reaching out to help!
I tried that and didn't work, but i've come up with another idea to solve my problem that i'm sure it'll work. nonetheless, thank you very much for trying to help! It always means a lot.
I am curious now because here is how I set it up and it immediately worked right at start-up using a vanilla project (edit: I also changed the priority of the event to below characters in another test and the results were still fine):
Spoiler
s1.png

s2.png

s3.png

s4.png

s5.png

s6.png

Hopefully what you found worked for you. The functions I used are from the MZ corescripts (version 1.8.0) which is the most recently updated I have access to online and are the same functions found in MV (they should be the same in any MV/MZ version). This is the extent I am able to help since what I provided worked without issues on my end.

My recommendation is to start a new project and test again, making sure that your actors and skills are referenced properly and go from there (without any other active plugins).

Best of luck!

Original thread: https://forums.rpgmakerweb.com/threads/somewhat-basic-conditional-branch-not-working-as-intended.172394/