Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Skill Learning System with Stat Requirements

hey all 0/

so im relatively new to MV and javascript so i can't figure out how to make yanflys learn skill system require a stat to learn the skill. I know it needs a note in the actual skill itself since i tested level requirement and previously learned skill requirements as well. It's only when i want it to check a parameter that it gives me an error. I was either getting actor not defined or parameter not set errors when i checked by pressing F8.

it says to use:

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

I basically want to know how to make it so that at least X of stat Y is needed ie STR >=50 is required to learn Twin Slash

Thanks for any help 0/

Edit: I figured out i can do it with

<Learn Require Eval>

if (this._actor.atk < 50) { value = false; }

</Learn Require Eval>


but now this issue is using that AND having them know a certain spell at the same time ie 50 atk and the fire spell to learn flame slash


<Learn Require Eval>

value = user.isLearnedSkill(ID#)

</Learn Require Eval>

this works for just having the spell be a custom requirement but i cant figure it out to have both a spell requirement and a stat requirement without getting an error XD
 
Last edited:

Clownia

Villager
Xy$
0.00
I'm not into javascript and not enough into rpmmv to know if this is possible, but you could try using operators like && (if both conditions are required), or || (if one of them has to be true).

Like

<Learn Require Eval>

if (this._actor.atk ≥ 50 && user.isLearnedSkill(ID#))

</Learn Require Eval>

or something like that.

But I haven't tried this, I'm just guessing (and not sure if the formatting is correct)
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
@Clownia is correct and the operator && should work for you because it simply is running through an eval() for javascript so anything Javascript should work for you fine. You could also technically do this


Code:
<Learn Require Eval>

if (this._actor.atk ≥ 50) {
// Replace ID# with the id of skill
  if (user.isLearnedSkill(ID#) {
    return true
  }
}
</Learn Require Eval>
 
that still gives me an "invalid or unexpected token" even after i made a whole new skill with only had this note on it and changed the ID# to (9) which refers to another skill.
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Can you send a screenshot of the console log? I'm not sure if it will show me what I need but it may help. The above examples should definitely work as unexpected token means it's not recognizing a specific character in the code and the above examples are all legal tokens.

I'm also not familiar with how Yanfly does his notetag lunatic code so I could be missing something important but I'll try to help with what I know.
 
<Learn Require Eval>
value = true;
value = false;
</Learn Require Eval>
For those who wish to use their own custom requirements using code. This must return value as true in order for the skill to appear to be learnable. Avoid using comments that may potentially block out further code.

Above is the lunatic notes for the skill learn system

Below is what im using for a combination of level 20 requirement and at 50 attack requirement

<Learn Require Eval>

if (this._actor.level < 20) { value = false; }

if (this._actor.atk < 50) { value = false; }

</Learn Require Eval>

posted the error on game screen and when i press F8


https://imgur.com/a/e7n7Vce

https://imgur.com/MhBf4W5
 
Top