So working on a rpg style game where the character can loot, use and equip items, I have come to a point where I am not sure how to proceed.
Up till now, I simply have several data tables holding data for items, where one of those data columns is an array of a struct which holds a stat and a value. So each stat must be of at least that value.
While this may be the most common type of requirement to fulfill, I want there to be others too. For example:
Must wear a magic hat.
Must have x Talent.
Must have x effect running.
Must be 3 inches tall.
Must have a banana in the inventory.
May not have x equipped.
Of course, these kind of checks are not very compatible with a stat-value struct. So how should I go about making a system to make the requirements more diverse?
Would love to hear any thoughts especially if someone has experience with this.
So I made this concept:
So to make some examples:
Wear Item - must - ID
- checks all the equipment if they are of ID.
Wear Item - Must - Equipment slot (head)
- checks that the (head) slot has an item.
Effect Running - not - ID
-Checks the effects of the character, if it finds the ID, query fails.
Unlocked - Gameplay Tag (tag)
- (haven’t implemented anything like this yet, but would probably check for matching tags of some container. The tag would be added to the container when a trait/talent is chosen or something)
Rep or Level - >= - int or float
- the rep or level must be at least the int or float value.
I would probably use the function library to do the queries.
While I’m not seeing any immediate problems, I’d love to know if someone thinks this is a bad way to implement this kind of system before I start becoming too reliant on it and encountering trouble down the road.
Decided to update how the requirement system looks today, in case anyone finds it inspiring… or repugnant.
Still have the stat-val req because it’s just so common, but then an item can also have special requirements. No idea if it’s a good or bad idea to divide them up like that.
Example Item: Must have 3 stamina to equip and it increases stamina by 4, Restores 2 Nano on use but must have 3 stamina and at least 1 health to use it.