nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
131 stars 92 forks source link

Conversation functions #26

Closed zunath closed 6 years ago

zunath commented 6 years ago

In the old version of NWNX_Events, we had access to the following functions: https://github.com/NWNX/nwnx2-linux/blob/master/plugins/events/nwn/nwnx_events.nss

I need to have these brought back - perhaps into a Conversations plugin instead of events.

It wasn't immediately apparent to me where to begin based on the header file so I may need some direction with this one before I start.

mtijanic commented 6 years ago

Yes, a separate plugin please. I was going to get to this eventually, but if you've the time, dive right in!

I also want to include a way to embed nwscript snippets directly in the convo text, so you don't need as many scripts.

zunath commented 6 years ago

I'm finishing up a few other things so I won't be starting it for a while. But if it's still hanging out here in a few days I can try to dig into it. I'm sure I'll have questions!

Liareth commented 6 years ago

Remember, if you want to expose the conversation functions as events, you can use the cross plugin messaging bus (Messaging.hpp) to broadcast the event. StickyCombatModes used to do it for SetCombatMode, like so:

messaging->BroadcastMessage("NWNX_EVENT_PUSH_EVENT_DATA", { "MODE", std::to_string(newMode + 1) } );
messaging->BroadcastMessage("NWNX_EVENT_SIGNAL_EVENT", { "NWNX_ON_MODE_ON", ObjectIDToString(thisPtr->m_idSelf) });

This is really powerful, because it allows you to broadcast events from any plugin. NWScript users can even make their own events and broadcast event data, too.

wobbinhood commented 6 years ago

If you could also add the following two methods, which were part of the old nwnx_funcs, but I'm fairly certain they don't exist in the new nwnx, I'd appreciate it! Not sure if they would actually fit in a nwnx_conversation plugin and not in nwnx_creature. I leave that up to you guys to decide.

The prototypes: string GetConversation(object oCreature); & void SetConversation(object oCreature, string sConv);

mtijanic commented 6 years ago

The getter exists in nwnx_object.nss:

// Returns the dialog resref of the object.
string NWNX_Object_GetDialogResref(object obj);

Setter is missing, we'll add it.

mtijanic commented 6 years ago

bugscrub: This is all done and can be closed.