Hello! I’m making a turn based RPG in Roblox, something akin to Persona. I need a way to store specific data as things like numbers. For example, an item would have a couple of values:
-The weight of the item (in a number value)
-The coin value of the item (preferably in an int value, although roblox may handle ints differently)
-The type of the item (a weapon, a quest item, etc)
-Another configuration or class instance that holds type specific values (for example if it’s a weapon, the configuration would have the weapons damage, damage type, etc.)
-The model connected to the item (for configurations, this would be an ObjectValue, and the type-specific values would be in the model)
Currently, it’s set up like a configuration. Here’s an example:
but if I was to implement it like a moduleScript, it’d be something like this:
local Example = {}
Example.__index = Example
function Example.New(integerValue: number, stringValue: string)
local newExample = {}
newExample.integerValue = integerValue
newExample.stringValue = stringValue
setmetatable(newExample, Example)
return newExample
end
function Example:printString()
print(self.stringValue)
end
return Example
and thus after we’d have more stuff, potentially going with inheritance and such.
I went on the forum to ask if my configuration method was solid, or whether or not I’d need to change it to help for performance or any other issues. Currently it works fine, but I don’t want to run into any roadbloacks. Should I swap to modules and OOP completely or just stick with configurations, or just do a mix of the two? Currently I’m using configurations for items, skills (basically most things people can do in battle-attacks, heals, etc.), and thinking of using it for stats (think an attack stat, a defense stat, etc.)