I feel like this is simple enough and probably has been asked before, but my search on these forums shows up with nothing.
Anyway, I want a player to be able to click on a placeable object (signpost) and start a conversation with it, including player responses, like you would with any NPC. The goal is to make a “job board” with a few “notes” on it that player can look at and respond to.
I tried this the same way I do with NPC’s - I right clicked the object and clicked “Conversation” to create a new conversation file, wrote out the conversation, saved it. I checked the “Usable” option so it’s interactable by the player.
At this point, when the player clicks on the signpost, no conversation dialog happens. What am I doing wrong here?
My two attempts at a fix does not work:
The generic conversation script “nw_c2_default4” used on some NPC’s in the toolset did not work.
I tried using Lilac generator to generated this script to start the conversation file when the player clicks on the signpost, it is not successful:
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
*/
//Put this script OnClick or OnFailToOpen
void main()
{
object oPC = GetClickingObject();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("JobBoard");
AssignCommand(oTarget, ActionStartConversation(oPC, "job_board"));
}
That looks mostly reasonable. I assume you put in in the onclick slot. (I do it in the onused event and use GetLastUsedBy() but that shouldn’t matter).
You don’t need the oTarget stuff. just do
ActionStartConversation(oPC, "job_board");
That will have the object currently running the script (aka OBJECT_SELF aka the job board you clicked on) do that action. In this case start the job_board convo.
It’s possible that the tag is wrong? Or it’s not unique so you don’t get the one you clicked? Anyway, taking that part out should make sure it’s the right job board placeable.
Mmat and Maeglyn have it right. Further you don’t even need to write script for that. There’s already a standard resources (a few actually) that you can drop in the OnUsed event to trigger the convo – “nw_g0_convplac”. You can just use this ad inifinitum for all of your placeable convo needs.
Also, OnClick is probably not the most ideal way to start that convo with a placeable. It attempts to fire the convo before the PC is even close to the placeable, while the OnUsed event will make the PC walk to it.