I need to put scriptable NPC in my currect game project. The project itself is developed in C++ language. I will using Luabind to bind lua and c++.
I need to call NPC function when certain NPC clicked or timer to do something is activated. Currently I stuck between 2 NPC script design.
Using a kind of npcname_action to differentiate every NPC.
This is kind of troublesome to give name to every different NPC.
I'm still thinking how to implement this in my project.
Example:HotelBellboy12_Click() { .. } HotelBellboy12_TimerAction() { .. }
Using name of function.
Every npc have it own lua file.
I'm thinking to load script into memory and when needed will be loaded intoluaState
usingluaL_loadbuffer
Example:OnClick() { .. } OnTimerAction() { .. }
Which one is better and why?