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());
}