OnClick on Placeables

I have a question: When I place this script below on the OnClick on a placeable, it destroys itself but doesn’t create any item on the PC. However, if I use GetLastUsedBy function instead and put the script on OnUsed everything works. Why is that?

void PrepForDestruction(object oTarget)
{
	SetPlotFlag(oTarget,FALSE);
    SetImmortal(oTarget,FALSE);
    AssignCommand(oTarget,SetIsDestroyable(TRUE,FALSE,FALSE));
}

void DestroyItself()
{

DestroyObject(OBJECT_SELF);

}

void main()
{

//object oPC = GetLastUsedBy();
object oPC = GetClickingObject();

CreateItemOnObject("scales",oPC);

PrepForDestruction(OBJECT_SELF);
DelayCommand(1.0,DestroyItself());
}

Interesting…
GetClickingObject() appears to only return a valid object when used from a transition-type trigger.
GetPlaceableLastClickedBy(), works from a placeable, though.

3 Likes

Hmmm, really interesting, indeed. Didn’t know about the function GetPlaceableLastClickedBy.

Yea, that caught me out once too, even if it was on NwN and not NwN 2.

TR