Yanfly "Skill Learn System" Question

Hey guys,

I know nothing in javascript, and I have a little question about how to achieve simple functions with the <Learn Cost Eval> function included in Yanfly's new plugin:

<Learn Cost Eval>

code

code

</Learn Cost Eval>

For those who know JavaScript, you can have custom actions be performed

after learning the skill through the learn skill menu.

​

So, basically, what I would like to do is make a specific class forget a specific skill after learning another skill.

Also, I would like to trigger a switch to on after learning the skill.

Thanks!
I too would like to know how to do this! I'm going to ask around if I can figure it out, I'll return here and post the answer,

Figured it out myself 😀

Tested and worked, woot, woot!

Code:
<Learn Cost Eval>$gameActors.actor(actorid).learnSkill(n);$gameActors.actor(actorud).forgetSkill(;</Learn Cost Eval>
I too would like to know how to do this! I'm going to ask around if I can figure it out, I'll return here and post the answer,

Figured it out myself 😀

Tested and worked, woot, woot!

<Learn Cost Eval>$gameActors.actor(actorid).learnSkill(n);$gameActors.actor(actorud).forgetSkill(;</Learn Cost Eval>
That worked, but it also leaves the old skill in the "Learn Skill" menu, meaning you can learn it again, and then you're back to having both skills. I think we need just one more line of code that removes learned skills from the "Learn Skill" menu.
Good find Fernyfer 🙂

Well, to avoid the problem of having the old skill remain in the skill list, we could open a switch at the start of the game that allows the basic skill to be learned, and once you learn the advance skill, you close that switch. With the proper notetag, that would prevent that skill from being shown in the list at all. So all we have to do is add another line to the code to flip off the switch.

That shouldn't be too complicated. I'll give it a look tonight!
That worked, but it also leaves the old skill in the "Learn Skill" menu, meaning you can learn it again, and then you're back to having both skills. I think we need just one more line of code that removes learned skills from the "Learn Skill" menu.
You could try something like this:

<Learn Show Eval>if($gameActors.actor(actorid).isLearnedSkill(n)) {value = false;} else {value = true;}</Learn Show Eval>That has to be in the basic skill you want to "forget".
You could try something like this:

<Learn Show Eval>if($gameActors.actor(actorid).isLearnedSkill(n) {value = false;} else {value = true;}</Learn Show Eval>That has to be in the basic skill you want to "forget".
Hmm, I tried that, but it caused a syntax error when I tried opening the Skills menu.
Hmm, I tried that, but it caused a syntax error when I tried opening the Skills menu.
Oh, sorry. I've forgotten one parenthesis after isLearnedSkill(n).
I too would like to know how to do this! I'm going to ask around if I can figure it out, I'll return here and post the answer,

Figured it out myself 😀

Tested and worked, woot, woot!

<Learn Cost Eval>$gameActors.actor(actorid).learnSkill(n);$gameActors.actor(actorud).forgetSkill(;</Learn Cost Eval>
This works very well so long as the skill in question requires a previous skill to work.

Just use the Learn Require Skill notetag to require the player to have the previous skill learned to make sure the screen isn't loaded with useless skills.
Here's an example of how I did it:

Spoiler
This is the "default" level 1 skill: SNIPE

<Learn Require Switch: 32><Learn Custom Text>Default Skill.</Learn Custom Text><Learn Cost Eval>$gameSwitches.setValue(34, true);$gameSwitches.setValue(33, true);</Learn Cost Eval><Learn Cost: 200 JP>This one is the upgraded version of SNIPE option #1:

<Learn Require Switch: 33><Learn Cost: 150 JP><Learn Custom Text>Increase debuff duration byup to 2-3 turns.</Learn Custom Text><Learn Cost Eval>$gameSwitches.setValue(32, false);$gameSwitches.setValue(34, false);$gameActors.actor(1).learnSkill(20);$gameActors.actor(1).forgetSkill(19);</Learn Cost Eval>This one is the upgraded version of SNIPE option #2:

<Learn Require Switch: 34><Learn Cost: 150 JP><Learn Custom Text>Increases TP gained from5 to 10 when using thisability.</Learn Custom Text><Learn Cost Eval>$gameSwitches.setValue(32, false);$gameSwitches.setValue(33, false);$gameActors.actor(1).learnSkill(21);$gameActors.actor(1).forgetSkill(19);</Learn Cost Eval>
At the beginning of the game, I just make sure to turn on the switches for each of my learned skills (not the upgraded versions, just the default ones). Once the "default" skill is learned, the upgraded versions appear via turning on the switches for them. Once one of the upgraded versions of the skill is learned, it turns off all the appropriate switches and teaches the appropriate skill to the right user, this way only the most recently learned version of that skill shows up in the menu in the end.
Awesome Fernyfer! I'll try this tonight! Thanks 🙂
thanks Fernyfer775 ! your a god! 😛

also thanks for the help Maxlionheart !
Since I figured this is a pretty big thing, new changes have been made to the Skill Core which you can see here to accomodate this in a more streamlined manner.

http://forums.rpgmakerweb.com/index.php?/topic/48860-yep-yanfly-engine-plugins-newest-skill-learn-system-plugin-count-28/?p=503204
Awesome Yan! Thanks 🙂
I found a problem.If your skills setting for one actor can use this method.However if your skill setting for more than one actor(Such as magic skill that many want to learn)you will meet problem that when one has learned others will meet the max level skill.
Is it possible to make the Skill you can learn to "disable" but already visibile in the list?


I wanna show the player which skill he can learn with later levels already and what level he needs to be able to learn the skill.


The script itself is working splendid and I love it. I just try to figure out myself a bit too (not knowledge with JS xD) how to edit it.


Thanks in advance if anyone can help.  😀
Is it possible to make the Skill you can learn to "disable" but already visibile in the list?


I wanna show the player which skill he can learn with later levels already and what level he needs to be able to learn the skill.


The script itself is working splendid and I love it. I just try to figure out myself a bit too (not knowledge with JS xD) how to edit it.


Thanks in advance if anyone can help.  😀



You mean something like this?


a2f7d94b6d.jpg



To display the skill you'll need


<Learn Show Eval>
value = true;
</Learn Show Eval>


But this alone would allow the character to learn that skill at any level regardless of requirements.


For a level requirement you have to use something like this, too:


<Learn Require Eval>
if (this._actor.level < 10) { value = false; }
</Learn Require Eval>


Now, the skill can't be learned as long as the actor isn't at least level 10.


For the "Requires Level" text, you can use this tag:

Code:
<Learn Custom Text>
Requires Level 10
</Learn Custom Text>
Thank you so much for the fast help!. Yes. It works and like I wanted.


I only needed the Learn Require Eval code. thanks a lot  😀 😀
Hi, I didn't want to start a new thread since I had a question regarding this plugin. Just not too sure of the terminology I should be using if I want a skill to be learn-able only if skill x is learned and skill y has NOT been learned. Thanks



  <Learn Require Eval>
   value = true;
   value = false;
  </Learn Require Eval>
Hi, I didn't want to start a new thread since I had a question regarding this plugin. Just not too sure of the terminology I should be using if I want a skill to be learn-able only if skill x is learned and skill y has NOT been learned. Thanks



  <Learn Require Eval>
   value = true;
   value = false;
  </Learn Require Eval>



Then try this:

Code:
<Learn Require Eval>
  if(this._actor.isLearnedSkill(X) && !this._actor.isLearnedSkill(Y)) { 
  	value = true; 
  } else {
  	value = false;
  }
</Learn Require Eval
Then try this:



<Learn Require Eval>
if(this._actor.isLearnedSkill(X) && !this._actor.isLearnedSkill(Y)) {
value = true;
} else {
value = false;
}
</Learn Require Eval

Thank you so much! Such an elegant piece of code too lol.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-skill-learn-system-question.50546/