MZ Some, but not all characters can use an Item.

Hi, I am trying to make a situation where some characters, but not all of them can use some items.

I have been using this script for VisuStella Items and Equips Core from this board.

<JS Item Enable>
enabled = user._classId === <id of class that can use item>
</JS Item Enable>

and it worked like a charm, until I tried to allow the Item to work for multiple classes. Like a magic scroll that A Mage, a Witch, and an thief can use, but not the Fighter, Priest, or Hunter. Any help would be great.

​

​

In that case, compare the class ID with an array. Let's say Mage, Witch and Thief are class IDs 5, 7 and 8 respectively:

<JS Item Enable>
enabled = [5, 7, 8].contains(user._classId)
</JS Item Enable>

Original thread: https://forums.rpgmakerweb.com/threads/some-but-not-all-characters-can-use-an-item.137494/