I'm developing a 2D Zelda game with LibGDX in Java using TileD maps. I am now adding NPCs to the engine and I'm thinking about how to make them so it's going to be easy for me to add/edit their custom dialog/behaviour conditions/interaction/etc in the future,
I don't really know how I should implement it all but I have an idea. I do not want to make subclasses for each NPC or each type of NPCs or whatever. I want to only have one NPC class. My current idea is to write a basic script for each NPC (in Groovy for example) and save it as a file in my resources, and then, to execute this script in Java in the corresponding NPC's "core" game loop code.
I'm not sure about how it's going to work, what should be aware of, or if there are any better solutions... So I'm asking some advice about how should I proceed to implement this. I don't know yet how limited the NPCs will be later but I want to guarantee maximum control over them, still being able to have them all unique if necessary.