Joined
Jan 9, 2023
Messages
31
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi all! I'm trying to create something of a utility menu in my game. I have two options for finding out if I had learned a skill: by its ID # or by typing it out. I got the ID part working great, but the eval for finding a skill by a string typed out is where I need help. Any reply to help would be appreciated!
 

ScorchedGround

Blizzards most disappointed fan (They keep going)
Regular
Joined
Apr 12, 2020
Messages
826
Reaction score
1,300
First Language
German
Primarily Uses
RMMV
Would this work for you?

JavaScript:
Y.isLearnedSkill(Y.skills().find(x => x.name == 'Strike').id)

Note:
Replace both of the Y with the object (i.e. the character) you are checking (see example below)
Replace 'Strike' with the name of the skill in question, keep in mind that the ' ' are important to keep

So it could look like this for example:

JavaScript:
$gameParty.members()[0].isLearnedSkill($gameParty.members()[0].skills().find(x => x.name == 'Ice Beam').id)

or in a Yanfly eval for example:

JavaScript:
user.isLearnedSkill(user.skills().find(x => x.name == 'Devastate').id)
 

Aerosys

Regular
Regular
Joined
Apr 23, 2019
Messages
1,045
Reaction score
1,107
First Language
German
Primarily Uses
RMMZ
For a certain actor:

Code:
if (actor.skills().find(skill => skill.name == 'Your Skill Name')) {
  // true
} else {
  // false
}

For the entire Party:

Code:
if ($gameParty.members().find(actor => actor.skills().find(skill => skill.name == 'Your Skill Name'))) {
...
 
Joined
Jan 9, 2023
Messages
31
Reaction score
5
First Language
English
Primarily Uses
RMMV
Thank you all so much for the replies. I'll give these a test and let yall know how it goes. :)

EDIT: What I'm actually trying to go for is yes, find a string by its name, but with name input processing to where I type it, it saves it in a variable and looks for the string inside that variable.

i.e.: $gameParty.leader().isLearnedSkill($gameParty.leader().skills().find(x => x.name == $gameVariables.value(1)).id)

I'm going to test this though first to see if it works.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,701
Reaction score
11,284
First Language
English
Primarily Uses
RMMV
What I'm actually trying to go for is yes, find a string by its name, but with name input processing
Okay, so you call an event with Name Input Processing, then replace the portion of Aerosys' code that says "Your Skill Name" with that actor's name.

So if you do Name Input Processing -> Actor 69 is the dummy actor you're storing it in, you'd replace "Your Skill Name" with $gameActors.actor(69).name()
 
Joined
Jan 9, 2023
Messages
31
Reaction score
5
First Language
English
Primarily Uses
RMMV
It worked! Thank you all so very, very much!
 

Aerosys

Regular
Regular
Joined
Apr 23, 2019
Messages
1,045
Reaction score
1,107
First Language
German
Primarily Uses
RMMZ
$gameParty.leader().isLearnedSkill($gameParty.leader().skills().find(x => x.name == $gameVariables.value(1)).id)

Of course, I don't want to contradict you, but are you sure this is always working? When you don't have a skill with the desired name, "find" will return "undefined", and then crash because you are trying to read "id" from undefined, which is not allowed.
 

Latest Threads

Latest Profile Posts

Damn, sometimes you're just grooving and then the sleep deprivation just KICKS in.
linkedin - Instagram 1 - Instagram 2 [OFF] - Tumblr texts [IN PORTUGUES]
"Understanding others is the greatest life lesson we can learn."
Tfw I was too slow to post in the latest AI art thread :'(

I had a doozy lined up, too
Updated my game's development post with the first video of it in action!


'Milestone Get!' :p

Forum statistics

Threads
136,810
Messages
1,270,286
Members
180,567
Latest member
CaptainAwf
Top