Skills requiring shield usage

Zakarijah

I love making maps!
Veteran
Joined
Aug 18, 2019
Messages
121
Reaction score
16
First Language
English
Primarily Uses
RMMV
If I use this,

<Custom Requirement>
value = false;
for (i = ; i < user._equips.length; i++) {
if (user._equips._dataClass == 'armor' && user._equips._itemId == 1) value = true;
}
</Custom Requirement>


Does that make the skill ONLY usable when they have that singular item equipped?

For example, I'd like the character to only be able to use 'Shield Bash' when a shield is equipped.

But I'm unsure of how to code that in.

I thought I could do it using Yanfly's Skill core but i get confused on Notetags -_-
 

Bastrophian

The Pixel Heartist!
Veteran
Joined
Oct 26, 2013
Messages
3,830
Reaction score
2,070
First Language
English
Primarily Uses
Other
Well, I know this isint a coding related answer to your question, but personally I would just give the shield equipment an attribute in the database that adds the skill when equipped. When unequipped, I believe it should no longer be available. Is that like what you were going for?

EDIT: ...assuming that you are using the default turn based battle system.
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
444
Reaction score
208
First Language
English
Primarily Uses
RMMV
I would try this:

<Custom Requirement>
value = user.equips()[1].atypeId === "shield type ID"
</Custom Requirement>

This code assumes that the shield is equipped in the second equipment slot and that shields are considered an armor type in the Systems tab. If that's not the case, the code may need a bit of tweaking.
 

Zakarijah

I love making maps!
Veteran
Joined
Aug 18, 2019
Messages
121
Reaction score
16
First Language
English
Primarily Uses
RMMV
Well, I know this isint a coding related answer to your question, but personally I would just give the shield equipment an attribute in the database that adds the skill when equipped. When unequipped, I believe it should no longer be available. Is that like what you were going for?

EDIT: ...assuming that you are using the default turn based battle system.
So I had multiple characters using’ shield’ but I realized the White Mage character and black Mage character equips the small shield and the main hero can equip all shields.

I just gave the Main Hero only the Large Shields and they all add the skill now


I would try this:

<Custom Requirement>
value = user.equips()[1].atypeId === "shield type ID"
</Custom Requirement>

This code assumes that the shield is equipped in the second equipment slot and that shields are considered an armor type in the Systems tab. If that's not the case, the code may need a bit of tweaking.
I did try this but it doesn’t seem to want to work, so I just used the above method.
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
The way I'd do it, which is much simpler, is simply to give the shield equipment the Add Skill: Shield Bash feature in their features box. The only reason I can think of that this wouldn't fit your needs is if you want to require the player has already learned Shield Bash thru levels or skill-learn events first, in order for it to be available when shields are equip.

If you do need that, then I'd recommend using a Custom Show Eval rather than a Custom Requirement. And while your javascript lines look close, they are definitely not correct. You have a set operator without an expression on the right-hand side when you say i = ; this needs to be i = 0; and you never use i in the evaluation - my guess is that you need to say equips[0] rather than equips in both places you use it. This might or might not get you there; checking equips is always tough and I'm much more used to the way it's handled in Ace.

One more thing, @Zakarijah - please don't double post. If you need to quote multiple posts, there's a Multi-Quote function (click the "+ Quote" action on the posts, and then click the button that says Insert Quotes right below your post entry box). I've merged your posts together for you this time.
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
444
Reaction score
208
First Language
English
Primarily Uses
RMMV
I did try this but it doesn’t seem to want to work, so I just used the above method.
The code wouldn't be identical to what I typed. 'Shield Type ID' would have to be replaced by the ID of the Armor Type. So if the shield Armor Type is 2, the code would be:

<Custom Requirement>
value = user.equips()[1].atypeId === 2;
</Custom Requirement>
 

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

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top