So I have tried @kevL_s script now but it doesn’t quite work and I really don’t know why. It’s odd.
It seems to want to work if that makes any sense.
So, let me try and explain the situation further.
The lock box I have is locked. On the OnLeftClick I have a script now that looks like this:
// gp_talk_object.nss
/*
This script allows you to speak to an object.
Set a conversation, set Usable to True, and attach this script to the OnUsed event.
*/
// FAB 2/7
// ChazM 2/17/05
// BMA-OEI 9/17/05 file description
void OpenTheBox (object oPC, object oPlaceable)
{
AssignCommand(oPC, DoPlaceableObjectAction(oPlaceable, PLACEABLE_ACTION_USE));
}
void main()
{
object oLockbox = GetObjectByTag("lockboxl");
object oPC = GetFirstPC();
if(!GetLocalInt(OBJECT_SELF,"DoOnceOnly"))
{
SetLocalInt(OBJECT_SELF,"DoOnceOnly",1);
ActionStartConversation(oPC);
}
else
{
DelayCommand(0.1f, OpenTheBox(oPC, oLockbox));
}
}
This makes the dialog run. Then at the last node of the conversation (I do this particular conversation in NWN1 style (maybe that has something to do with it not quite working?)) I have the script here:
void OpenTheBox (object oPC, object oPlaceable)
{
AssignCommand(oPC, DoPlaceableObjectAction(oPlaceable, PLACEABLE_ACTION_USE));
}
void main()
{
object oLockbox = GetObjectByTag("lockboxl");
object oPC = GetFirstPC();
SetLocked(oLockbox,FALSE);
DelayCommand(0.1f, OpenTheBox(oPC, oLockbox));
}
What I see happens ingame, is that the PCs action queue shows the symbol “Use”, but then nothing happens. I have no idea why.
I guess I’ll do some more testing, otherwise I might try Lance’s script.
EDIT: Alright, I tried some things and did some baking and now suddenly it works. Really weird. Don’t know what was the issue before.