Sorry about the error in the original script - hadn't finished my coffee yet. Anyway, what I missed were the calls for SetCommandable to disable the ambient system while the Beggar was getting loot. Thanks for catching that, Proleric. Anyway here is a fully functional version of the script to cut into your module's UnAcquire event. I used the HotU event - x2_mod_def_unaqu.nss - as a base, so the variables conform to that.
Whenever a PC drops an item the Beggar moves to it, stoops and picks it up, then moves off. I reduced the time the animation plays to 2.0 seconds because 4 second seemed too long. I have also dropped multiple items and the action queue for the Beggar stacked - he went to the first item and picked it up, then the second item and picked that up, and so on.
//insert the following code into x2_mod_def_unaqu.nss
void doPickupItem(object oItem)
{
ActionMoveToLocation(GetLocation(oItem));
ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 2.0);
ActionPickUpItem(oItem);
ActionDoCommand(SetCommandable(TRUE));
SetCommandable(FALSE);
}
void main ()
{
//existing code
// * Looting Beggar Custom Code
if (!GetIsObjectValid(oOwner)) //confirm item was dropped - might be better way to do this
{
object oBeggar = GetNearestObjectByTag("LOOT_BEGGAR", oPC);
if (GetIsObjectValid(oBeggar))
{
AssignCommand(oBeggar, ClearAllActions());
AssignCommand(oBeggar, doPickupItem(oItem));
}
}
}
For picking up items just laying around in the area, you need to do a similar script as this in the Beggar's OnPerception or OnHeartbeat event. I would recommend OnPerception if you can get that working right.