I've been wanting to figure out a proper method to script NPC's for my game engine.
The NPC object class contains simple methods to draw, update, and move the character (Other methods for dialogue will be added on later). The problem is that, of course, they don't do anything. These characters need some sort of script. But I can't figure out anyway I can each assign these to each NPC.
By scripting, I mean something that would look like this. A file that I could assign each NPC so that they follow the script.
moveWest(3); // Move in the west direction for 3 tiles
followPlayer(); // Start following the player
speak("Hello there!") // Talk to the player
It won't look exactly like that, but that's something similar to what I want to accomplish here. I know there are some methods out there, but I need a proper method that I could use for my situation.
I don't know how useful this information is going to be, but I want to make it clear that my NPC's update function is updated based on frames. Basically, the function runs 60 times every second, the speed that my game engine is also running at.
If any other additional information is needed, let me know. I appreciate any help with this.
↧