I need to put script NPC in my currect game project. The project itself was developed in C ++. I will use Luabind to bind lua and C ++.
I need to call an NPC function when a specific NPC or timer is activated in order to do something. I am currently stuck between two NPC script projects.
Using the npcname_action view to differentiate each NPC.It is kind of troublesome to give a name to every other NPC.I am still thinking how to implement this in my project.Example:
HotelBellboy12_Click() { .. } HotelBellboy12_TimerAction() { .. }
Using the function name.Each npc has its own lua file.I am thinking of loading a script into memory and, if necessary, loading into luaStateusing luaL_loadbufferExample:
luaState
luaL_loadbuffer
OnClick() { .. } OnTimerAction() { .. }
?
- , - # 2. , Lua, NPC; script, NPC.
NPC , Lua . NPC NPC , (, Merchant Commoner), NPC. , . NPC, OnClick(), .
, , .
.
, .
, npc - , NPC. - NPC, - . , . , , , , :
npc.bob.click = function () jump() end npc.alice.timer = function () cry() end
Source: https://habr.com/ru/post/1787920/More articles:MVC 3 AjaxHelper Ajax.ActionLink vs Ajax.RouteLink, Ajax.BeginForm vs AjaxBeginRouteForm - ajaxDoes Sybase ASE 12.5 support general table expressions? - common-table-expressionКак определить язык программирования для `` element - visual-studioLINQ to XML selects multiple elements? - linq-to-xmlHow to quickly compare variable length bit strings in C ++? - c ++Mobile phone emulator - mobileFacebook - sending to group page - javascriptInstalling Async CTP Problem - visual-studio-2010Objc: create an NSURL with a string that does not comply with RFC 2396 - formattingКоренные экземпляры EBS, похоже, не имеют хранилища экземпляров - amazon-ec2All Articles
` element - visual-studio