MV [SOLVED] Custom Skill Requirement Code Help (YEP Skill Core)

So im making a Skill that I want to only be usable if the Party has at least 1 of any of the Items it requires but I dont know what to put in between here for the Skill Notetag

<Custom Requirement>
Insert Code Here
Insert Code Here
</Custom Requirement>

Like, say I want the Skill to require either a Potion, Super Potion, or Ultra Potion and if the Party has any one of these, it becomes usable.

I dont want it to need ALL of them like how YEP's Item Cost plugin does it, just that the Party has any one of these items for it to be usable (And if YEP's Item Cost plugin has a better way to do this then I dont how to do it exactly so that might also be something I'd need help with too if so)
Something like this:

JavaScript:
$gameParty.hasItem(ID) || $gameParty.hasItem(ID) || $gameParty.hasItem(ID);

ID = ID of the item
Something like this:

JavaScript:
$gameParty.hasItem(ID) || $gameParty.hasItem(ID) || $gameParty.hasItem(ID);

ID = ID of the item


Like this...?
I did replace the ID with the Item IDs I wanted but it didnt work, I think the way I typed out the code was wrong but idk how to type it out correctly?

<Custom Requirement>
if ($gameParty.hasItem(ID) || $gameParty.hasItem(ID) || $gameParty.hasItem(ID) ; )
{
value = true;
} else {
value = false;
}
</Custom Requirement>
Like this...?
I did replace the ID with the Item IDs I wanted but it didnt work, I think the way I typed out the code was wrong but idk how to type it out correctly?
Try this:

<Custom Requirement>
if ($gameParty.hasItem(ID) || $gameParty.hasItem(ID) || $gameParty.hasItem(ID));
{
value = true;
} else {
value = false;
}
</Custom Requirement>
I'm not a scripter, but I've done my fair share of little codes like this in the past... Try that and see how it works.

I know that the symbol || means OR in this context. So it should be saying "if party has this item or this item or this item then true and so on.

I'm sorry... I messed up. This is the way to do it. Sorry I forgot something in my original code:
<Custom Requirement>
if ($gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]));
{
value = true;
} else {
value = false;
}
</Custom Requirement>
Sorry, I forgot that you have to use $dataItems[ID] snippet in order for the system to know that your taking about an Item and not a Weapon or Armor [Those are all designated as Items by the program so you have to be specific]

Let me know if this works better.
Try this:


I'm not a scripter, but I've done my fair share of little codes like this in the past... Try that and see how it works.

I know that the symbol || means OR in this context. So it should be saying "if party has this item or this item or this item then true and so on.

I'm sorry... I messed up. This is the way to do it. Sorry I forgot something in my original code:

Sorry, I forgot that you have to use $dataItems[ID] snippet in order for the system to know that your taking about an Item and not a Weapon or Armor [Those are all designated as Items by the program so you have to be specific]

Let me know if this works better.
This didnt seem to work for me sadly... but I think I figured out a few issues now.



I was using the wrong Notetags for the code first off, but I also discovered that this code here works how I wanted it too!

Code:
<Custom Show Eval>
 if ($gameParty.hasItem($dataItems[17])) {
    visible = true;
  } else {
    visible = false;
  }
  </Custom Show Eval>

Now all I need to know how to do is make the "if else" conditional branch code keep going to check for each item, then if NONE of the designated items it checks for can be found in the Party's Inventory, it'll hide the skill like how it does in the code above
This didnt seem to work for me sadly... but I think I figured out a few issues now.



I was using the wrong Notetags for the code first off, but I also discovered that this code here works how I wanted it too!

Code:
<Custom Show Eval>
 if ($gameParty.hasItem($dataItems[17])) {
    visible = true;
  } else {
    visible = false;
  }
  </Custom Show Eval>

Now all I need to know how to do is make the "if else" conditional branch code keep going to check for each item, then if NONE of the designated items it checks for can be found in the Party's Inventory, it'll hide the skill like how it does in the code above
Did you try this:

JavaScript:
<Custom Show Eval>
 if ($gameParty.hasItem($dataItems[17]) || $gameParty.hasItem($dataItems[18]) || $gameParty.hasItem($dataItems[19])) {
    visible = true;
  } else {
    visible = false;
  }
  </Custom Show Eval>
Or something like that? I think the semi-colon at the top [after the "if" statement] was causing problems...
Now all I need to know how to do is make the "if else" conditional branch code keep going to check for each item, then if NONE of the designated items it checks for can be found in the Party's Inventory, it'll hide the skill like how it does in the code above
Semicolons indicate the end of a command - putting one inside a conditional will terminate it. Also, most of the code you have there is superfluous. All you need is:
Code:
visible = ($gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]));

A way to write it more efficiently using JavaScript's array methods:
Code:
visible = [14, 27, 31, 59].some(item => $gameParty.hasItem($dataItems[item]));
where the numbers between the brackets are all the item IDs you're checking for.
Did you try this:

JavaScript:
<Custom Show Eval>
 if ($gameParty.hasItem($dataItems[17]) || $gameParty.hasItem($dataItems[18]) || $gameParty.hasItem($dataItems[19])) {
    visible = true;
  } else {
    visible = false;
  }
  </Custom Show Eval>
Or something like that? I think the semi-colon at the top [after the "if" statement] was causing problems...
This worked yeah! Thank you!

Semicolons indicate the end of a command - putting one inside a conditional will terminate it. Also, most of the code you have there is superfluous. All you need is:
Code:
visible = ($gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]) || $gameParty.hasItem($dataItems[ID]));

A way to write it more efficiently using JavaScript's array methods:
Code:
visible = [14, 27, 31, 59].some(item => $gameParty.hasItem($dataItems[item]));
where the numbers between the brackets are all the item IDs you're checking for.
Ah alright! I'll try this too then!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-custom-skill-requirement-code-help-yep-skill-core.180996/