Hi, I would like to keep track of a player`s interaction with NPCs for things such as timely (daily) quests.
So I thought of the player having an array keeping track of a tuple [(npc, time)].
Is there anyway to do something like this? I tried even a multidimensional array but got invalid expression.
For now, the simples solution I thought was mapping 2 same-sized arrays
Code:
npc_interactions[] = new /list(0)
npc_time_interactions[] = new /list(0)
But it could go south really fast.
I also accept solutions to keep track of these kind of data. My experience with these kind of situations would be to use a DB to track ids and such, but I don`t know how it would go on DM.
Warning though, try not to save NPCs with the player. Loading a player from a savefile would result in instantiating another copy of the NPC, which is probably not good. Better to go with an ID as some value type if you intend to save this list.
For more complex situations, you could just use a datum (a type with minimum inherited types) to represent your interactions, and have a simple list of those (or a dictionary of IDs associated to them). If there's any procs specific to these interactions, they can go in this type too.
Maybe worth mentioning is that DM uses SQLite for its /database object, if you're interested in databases.