[Event creation] Learning a skill under X conditions

To continue on the character I talked about somewhere else, I am working on creating a skill that he does not learn... But he grants it to his allies.
So, I'm creating an event so that his allies can learn it : if character X is in the team, then Y characters learn Z skill.
That's what I did, but despite this, the skill (or at least, the placeholder moves I'm using for now, because I didn't create the move) isn't shown as learned for the characters - neither in overworld nor in battle.
1675796188259.png


Later, I will also encounter another issue. See, the move the allies learn are supposed to target this specific character. How can I make it so that he is the only target choice possible, and not any possible ally ?

As a reminder, I have SV's core engine, skills & states core, battle core, and the other free core plugins.
first, place at least a wait 10 into any such parallel.
however it wpuld be much better if you could call the code in the events that add or remove the actor from the party.

second, how do you test if the skill is learned? for both map and battle
The thing is that it's a main character. I don't need him to be in the party, because once recruited, he won't leave. I need the move to be learn only when he takes part to the battle - so, when he is among the 4 characters selected.
Then, well to test... I just check the skill list of the characters to see if they did learn the skill. Isn't that enough ? '^'
as for the first part - it doesn't work that way, because the check for "in party" includes the reserve members, and parallel processes are disabled during battlescreen.

as for the skill list: again, which skill list (there are two different ones) and how do you check that?

Because there is a difference between skill learned and skill added - both are usable to the actor.
As for the skill lists, I don't really see what you mean by "two different lists". I looked at the two types lists, yes (which, for me, are "Skills" and "Healing" just as I defined in the Types category from the database), and in both the battle and the non-battle menu. But it still makes no difference.

So, since the check "in party" is not what I am searching for, I tried using a variable. If member 1, 2, 3 or 4's ID = [my character's ID], activate the event.
I also made a change to the event : now, my characters learn the skill from level 1, but the event makes them forget it until the condition is met.
It only half worked.

In a battle test (the option from the Troops category), my characters still know the skill, no matter if my character is taking part to the fight or not.
But outside battle (so, directly from the testing game feature), my characters did forget the skill, but despite putting my character in the 1st, 2nd, 3rd or 4th position of the party afterwards, they still do not learn it again. If I try launching a battle from there, they still have no access to the skill.

In other words, it seems that the "if" (red) function and the "else if" (cyan) one can work (at least, my variable functions), but they fail to take turns...

1675849904592.png
In a battle test (the option from the Troops category),
The battletest in the database should only be used for balance testing if used at all, NEVER for functional tests.
The reason is that this option uses shortcuts to get to the battle without the complete game setup, and as a result several things and especially plugins do not work with it.

most functional results you get there are simply useless.
you need to launch a battleprocessing in the full game for any meaningfull test.

I don't really see what you mean
Obviously we are talking about different things here, so I'm asking again:

How do you test/see if a skill is learned?
Do you use a javascript function to test this? If yes, which function and on which data object?
Do you use the conditional branch option "is skill learned" to test if the actor has the skill?

Or how do you check that question in your game?


EDIT: and your control variable checks are useless in that sequence above, because you always overwrite the previous result without ever checking it.
you only check the ID of the fourth party member, never of the first to third party members
I don't know anything about JaveScript, so I have to litterally check the same way a player would do : using the game's menus and looking at my character's "Skills" section.
Also, I should mention that it's my first game on RPG Maker (or, to say, I ever programmed), and I've been using MZ for only roughly two weeks.
I tried using a variable. If member 1, 2, 3 or 4's ID = [my character's ID], activate the event.
and here you made a mistake.
you never checked if member 1 is ID, if member 2 is ID or if member 3 is ID.
You only check if member #4 is equal to the ID.

There is no "or" in your code at all. If you want to check four different actor IDs, then you need four different conditional branches. Since your screenshot has only one conditional branch, only the last control variable counts.
Corrected, but still the same statement as I made before : I can get them to forget (what I asked in "else if"), but not to remember.
1675877853420.png
but not to remember.
probably because you never skipped the wrong parts.
They do remember, but before you can use the skill your next commands will make them forget again.

What you need to learn is to check your code for specific cases.
What you now have is
If P1 = 10 then remember, else forget
if P2 = 10 then remember, else forget.

What will happen if P1 is really 10?
They will remember in the first if because P1 is correct, and immediatly after forget again because if P1 is ten then P2 cannot be 10 anymore.

You need to abort the checks after one case is true, either by jump to label or exit processing or a similar construct.
And which command to use depends on the entire event structure.
Okay so I have tried your solutions but, even if I'm not sure I succeeded at them, I noticed that there was a problem at the core of my event.

So, being a little heated up, I decided to go back to square one. I removed everything and decided to simplify things first to run some tests.

The only condition was for 10 to be in slot 1. No elseif, no forgetting. Just "If 10 = slot 1, then learn the skill". Everything else was deleted from the script.

And somehow, things turned out weirdly. Actors learn the move when 10 is already in slot one at the beggining of a new game only, and they don't learn the skill if he is not. The condition does not activate if I move the actor in or out of the slot.
If he was at slot 1 at the beggining, and I take him out, they won't forget the skill.
If he was not at slot 1, and I take him in, they won't learn the skill.
The character has to be in that slot at the beginning of a new game exclusively. Not before, not after, just at this moment. Otherwise, it won't work.

So, somehow, I have to find a way for the code to refresh, to run a check, whenever I switch my actors' position in the menu. Because if I don't, I don't think the event will run anyway.

EDIT : I should mention that I tried all of the three trigger types for the event. "None", "Automatic" and "Parallel" - neither of them changed anything, the event ran the same way.
instead of describing an event it is usually better to give a screenshot of it.
1675930884468.png
when and where do you call this common event?
Nowhere and no when. The effect seemed to apply on their own (even if just partially, since it just doesn't refresh). So the event isn't linked to anything else.
I sure would try to link it to something if I were to know what and how.

EDIT : I mean, I sure know how to link it to a skill, as an example, as it is supported by the base app. But using a skill is not the trigger I'm searching for. I guess I would require the use of a plugin, and that's where I'd be lost - there so much choice, and it needs JS.
if it is not called, then it will never be processed and never happen.

No, what you want can be done by eventing - but you're missing too many basics to handle that option.
And unfortunately I don't have enough time to step you through that, so I strongly suggest you search the forum for some tutorials on eventing and work through them first.
I can see that @Andar has been trying to help you, but it also seems like you might be trying to go a little too fast as a new user of MZ and programming. I know because I have done exactly this. When you don’t understand the basic, underlying features of MZ, it is difficult to understand the help that is being offered.

I know it is hard, but I strongly recommend that you take a step back and watch some basic tutorials as just recommended above.

There are tons of great tutorials that will explain all about events, variables, switches, self-switches, conditional branches, Common Events, triggers, etc.

Learning the basics thoroughly first is very important.

You are on the right track. Doing small tests to see if you are eventing correctly is very important. Try something simple using the Show Text command in the event to practice a series of Conditional Statements.

For instance, have a variable generate a random number from 1-6.

Then, try having 6 conditional branches that check to see if your variable is equal to 1, 2, 3, 4, 5, or 6.

In each conditional branch, use Show Text to display the value of the variable to make sure it is working.

Then you can build off that to make sure you understand how things are working.

If you can’t do that yet, you need to go back to the basic tutorials.

I know it can be frustrating and requires patience, but it will really help you in the long run.

I hope this helps a little.

Original thread: https://forums.rpgmakerweb.com/threads/event-creation-learning-a-skill-under-x-conditions.154776/