Hi! I’m making a resource-based item system where each object has different attribute tags. Kind of like Love Nikki dress up queen, where each clothing item has different attributes tags (simple, elegant, lively, cute, etc), and the player is scored according to what attribute tags the clothing they’re wearing has.
For example, if a level is looking for ‘lively’ and ‘cute’ clothing, only clothing with the lively or cute tags will be taken into account during scoring. (This is just the gist of it, the real system in love Nikki is a lot more complex, but a system like the one above should be enough for my needs).
The question is how would I go about implementing that? Ideally, it should also be visible in the inspector where I can select the attribute tags the item has.
I don’t think it can be an enum, as each item usually has multiple tags and not just one. I thought about using bitflags and @export_flags, but that has a limit of 32 values, and I have more than 32 attribute tags in total. I also thought about creating every single attribute tags as a resource, exporting an array of resources in the item script and then dragging and dropping whatever attribute tag resource i need into the array, but that seems a little clunky.
Any help with ideas on how to implement this would be appreciated! Thank you!
Something like what normalized said above should work well enough for starters:
class_name ClothingItem extends Resource
@export var tags: Array[ClothingTag.Type]
class ClothingTag extends RefCounted:
enum Type {
CUTE,
TRENDY,
OUTDATED,
}
@export var type: Type
This will allow you to see the tags in the inspector and manually select them:
Although you’d probably want to implement some checks to make sure you don’t accidentally add the same tag twice, no tags at all, or whatever other faulty state you can imagine.
Sure. Many ways to achieve the same result. In this case I was simply thinking the Type enum should be in the ClothingTag class to allow for a ClothingItem.Type enum as well (shirt, hat, skirt, shoes, etc.).