Check for item type/category

PhilRay

Villager
Member
Joined
Dec 10, 2019
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
I've been searching around all morning, but I cannot find the answer to this question:

How do I check to see if an item is of a given Type/category in a script?

Note: I'm using Yanfly's Item Menu Categories.

Thank you!
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
515
Reaction score
331
First Language
Polish
Primarily Uses
RMMV
But what do you need this for? Can you explain?
 

PhilRay

Villager
Member
Joined
Dec 10, 2019
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
I'm developing a system where the player can give items to npcs to gain favor. NPCs have certain item types they like, wheth5er that's materials--- such as anything made of gold--- or item categories--- such as luxury items or junk items or hats or food items etc...

I have lots of items with crossover types and want to make a simple script for checking as opposed to many multiple conditional statements for each npc

I want to know how to get the category of an item to check against it.
 

PhilRay

Villager
Member
Joined
Dec 10, 2019
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thank you for sharing! This will actually prove useful, but I'm not sure if it can do what I need in this case, and here's why:

The player is meant to uncover what the NPC likes from clues in the dialogue (or trial and error). Therefore, they must be able to "gift" any item they posses. So they should be able to select from all their items. The plugin you've shared is more a way to ONLY let the player select from the correct items, if I've read it correctly.

What I need is a way to determine whether the item chosen fits given criteria, possibly as defined by Yanfly's categories. Or is there another way to give Items certain qualities/categories that I can reference?

I realize I could create a conditional tree checking for every single item that fits the criteria. The issue here is the criteria are meant to be randomly generated each playthrough. That is, the NPC is going to like a randomly selected criteria. So it would be much more efficient to let the player select an item, and simply check if it is an item from a category that is equivalent to the category of items the NPC has been set to like.

E.g. NPC likes "golden" category. PC gives ItemX. If ItemX category = "golden" SUCCESS!

Hopefully that makes sense... Maybe I'm approaching this wrong? Both plugins discussed have ways of assigning items certain categories, surely there must be a way to reference this information?
 

xDRAGOONx

Veteran
Veteran
Joined
Jan 22, 2019
Messages
53
Reaction score
32
First Language
English
Primarily Uses
RMMV
You wouldn't need to check for every single item if you set your types to something like "NPC1 Gold" and "NPC1 Silver" you'd only need to check for the item types that apply to that NPC. You'd have 1 type for every tier per NPC and items can have multiple categories.
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Gave my avatar an update, stay safe, people!
I'm currently available for hire for scripting (and perhaps other things).
Also, don't worry, the Advanced Minimap plugin is a work in progress.
Hallelujah! Work is getting stricter on humans in the store.
Day 3 of mapping... at least the whole game its just one location :3 (Still taking forever...)


Almost 5 am.. and I decide to put up a Youtube video instead of sleeping. It's strangely addicting! :kaoswt:

Forum statistics

Threads
95,621
Messages
930,492
Members
125,929
Latest member
RitBro
Top