Learning skills with equipment

JessieAnn

Villager
Member
Joined
Aug 12, 2019
Messages
5
Reaction score
1
First Language
pt_BR
Primarily Uses
RMMV
So, I'm using Yanfly's Skill Learn System along with Equip Core and all the other requirements (obviously).
Now, my issue is, I want some skills to show up for the player to learn only when specific equipments are being worn by the character.

For example, skill #10 Fire will only show up in the skill learning menu when armor #10 Fire Gloves is being worn in the off-hand slot.
If I understand correctly, using the equipment slots from the Equip Core plugin would make said slots' indexes the same as was defined in the class note tag. So, if I have equip slot 1 for my weapon and equip slot 2 for my off-hand defined as such in the note tag, that would mean they are now indexes 1 and 2 respectively, instead of 0 and 1, right? Wrong? Anyway.
How do I check the name of the equipment in that specific slot and how do I turn that into a condition to show the skill in the skill learning menu?

Thanks in advance!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@JessieAnn As this isn't a javascript issue as such but a plugin one I have separated your post out into its own thread.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
try using
Code:
<Learn Require Eval>
value = (user.equips()[1].name === "Fire Gloves")
</Learn Require Eval>
Slot [1] is the second slot in the equip scene. Slot [0] would be your weapon (ordinarily, anyway).
 

JessieAnn

Villager
Member
Joined
Aug 12, 2019
Messages
5
Reaction score
1
First Language
pt_BR
Primarily Uses
RMMV
Thanks, @ramza, but unfortunately it doesn't work. I tried every variation of that code that I could think of.
Also, I noticed you gave me a code that sets the requirement for learning the skill as having the item equipped. I want it to not even show in the menu if the item isn't equipped, but that should be easy enough with the <Learn Show Eval>, I thought. Sadly, it didn't work either.

If I give the player the ability to just learn the skill (with the <Learn Skill: x> tag), it just shows up in the menu, regardless of the condition I've set.
If I don't allow the player to just learn it, it doesn't even show, also regardless of the condition being true or false.
When I set the requirement as having an specific item equipped it, once again allowed me to learn the skill whether I had the item equipped or not.
---+---+---
Actually, I was gonna end my post there, but as I was writting this, I started digging around and found a code that almost works.

<Learn Show Eval>
value = $gameActors.actor(1).isEquipped($dataArmors[21]);
</Learn Show Eval>

It does what I want it to do, that is, it hides the skill if actor #1 isn't equipping armor #21 (and it also works if I use the Require tag instead of Show: the skill will be shown on the list, but the player is unable to learn it). Problem is, it still doesn't show (or allow me to learn it) even after the armor is equipped.

Any ideas?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
Thanks, @ramza, but unfortunately it doesn't work. I tried every variation of that code that I could think of.
Also, I noticed you gave me a code that sets the requirement for learning the skill as having the item equipped. I want it to not even show in the menu if the item isn't equipped, but that should be easy enough with the <Learn Show Eval>, I thought. Sadly, it didn't work either.

If I give the player the ability to just learn the skill (with the <Learn Skill: x> tag), it just shows up in the menu, regardless of the condition I've set.
If I don't allow the player to just learn it, it doesn't even show, also regardless of the condition being true or false.
When I set the requirement as having an specific item equipped it, once again allowed me to learn the skill whether I had the item equipped or not.
---+---+---
Actually, I was gonna end my post there, but as I was writting this, I started digging around and found a code that almost works.

<Learn Show Eval>
value = $gameActors.actor(1).isEquipped($dataArmors[21]);
</Learn Show Eval>

It does what I want it to do, that is, it hides the skill if actor #1 isn't equipping armor #21 (and it also works if I use the Require tag instead of Show: the skill will be shown on the list, but the player is unable to learn it). Problem is, it still doesn't show (or allow me to learn it) even after the armor is equipped.

Any ideas?
I just tested in my own project, and I was able to make a skill that could not be learned unless the user was using a specific weapon.

I made the code a little less compact, but it still does the same thing as it did when I shared it with you. Replacing the learn eval with the show eval should have no effect on it.

Code:
<Learn Require Eval>
if (user.equips()[0] && user.equips()[0].name === "Iron Dagger"){
   value = true;
}else{
   value = false;
}
</Learn Require Eval>
Note that I had to add an extra check in case the equipslot has nothing in it, because that crashes the engine. Change the [0] to your glove slot, and the Iron Dagger to Fire Gloves and it should work fine.
 

JessieAnn

Villager
Member
Joined
Aug 12, 2019
Messages
5
Reaction score
1
First Language
pt_BR
Primarily Uses
RMMV
It works! This is awesome!
Thanks, young Beoulve!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,587
Latest member
Usagiis
Top