#include "x0_i0_position"
void doPickupItem(object oItem)
{
ActionForceMoveToLocation(GetLocation(oItem));
ActionPickUpItem(oItem);
ActionDoCommand(SetCommandable(TRUE));
SetCommandable(FALSE);
}
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
object oActualPossessor = GetItemPossessor(oItem);
location lBegSpawn = GetRandomLocation(GetAreaFromLocation(GetLocation(oItem)), oItem, 10.0f);
if(!LineOfSightObject(oItem, GetNearestObjectToLocation(OBJECT_TYPE_PLACEABLE, lBegSpawn, Random(5))))
{
CreateObject(OBJECT_TYPE_CREATURE, "the_grey_man", lBegSpawn);
}
if (!GetIsObjectValid(oActualPossessor))
{
object oBeggar = GetNearestObjectByTag("the_grey_man", oPC);
if (GetIsObjectValid(oBeggar))
{
SetAILevel(oBeggar, AI_LEVEL_VERY_LOW);
AssignCommand(oBeggar, ClearAllActions());
DelayCommand(1.0, AssignCommand(oBeggar, doPickupItem(oItem))); // don't remove this delay
DelayCommand(18.0, SetAILevel(oBeggar, AI_LEVEL_DEFAULT));
return;
}
}
}
The beggar spawns but he doesn't go for the dropped item...
beggar does not actually spawn out of sight, but usually behind the PC or something similar.
oActualPossessor might not be working right, but i've been slapping this around with no better results.
any suggestions are appreciated 
Hi Morbane,
Good to see you give this a go ... here are some suggestions:-
1) The function Random can potentially return a zero, which is no good to the GetNearestObjectToLocation function. Change it to using a dice roll "d" function, like d4() or d6(), which always give a positive number.
2) The beggar object should be defined at creation to work with. i.e. Define it prior to its creation and then continue to use the defined object with the rest of the code.
3) I am not sure why you are checking for line of sight. This appears superfluous to requirements, so perhaps you can explain its inclusion for me.

4) The AI functions and SetCommandable may not be required here either, especially if the beggar does not do much else. i.e. The beggar can have a "reset" of their actions in their heartbeat script if need be.
Here is a quick bit of code that works for me .... see if it does what you need ... or alter as you require ... let me know how you get on and if you understand what I have done.
// BEGGAR SCRIPT
#include "x0_i0_position"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
object oActualPossessor = GetItemPossessor(oItem);
// MAKE SURE THE OBJECT HAS BEEN DROPPED TO THE FLOOR
if (oActualPossessor == OBJECT_INVALID)
{
location lBegSpawn = GetRandomLocation(GetAreaFromLocation(GetLocation(oItem)), oItem, 10.0f);
object oBeggar = CreateObject(OBJECT_TYPE_CREATURE, "the_grey_man", lBegSpawn);
AssignCommand(oBeggar, ClearAllActions());
AssignCommand(oBeggar, ActionForceMoveToObject(oItem, TRUE));
AssignCommand(oBeggar, ActionPickUpItem(oItem));
}
}
Don't forget that this is very basic code just to get you up and running. You would also need to consider what happens when the player drops another item in my above code, as another beggar would be spawned. There are two ways to deal with this .... make sure you add a bit of code that checks for the beggar's existence prior to spawn, or make sure only once instance can be created at a time. The former option is the correct way.
OK, Here is the sort of thing I mean (untested):-
// BEGGAR SCRIPT
#include "x0_i0_position"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
object oActualPossessor = GetItemPossessor(oItem);
// MAKE SURE THE OBJECT HAS BEEN DROPPED TO THE FLOOR
if (oActualPossessor == OBJECT_INVALID)
{
// I THERE A BEGGAR IN THE AREA ALREADY?
object oBeggar = GetNearestObjectByTag("the_grey_man", oItem);
// CREATE BEGGAR IF MISSING FROM THIS AREA
if(oBeggar == OBJECT_INVALID)
{
location lBegSpawn = GetRandomLocation(GetAreaFromLocation(GetLocation(oItem)), oItem, 10.0f);
oBeggar = CreateObject(OBJECT_TYPE_CREATURE, "the_grey_man", lBegSpawn);
}
// GET BEGGAR TO DO THEIR THING!
AssignCommand(oBeggar, ClearAllActions());
AssignCommand(oBeggar, ActionForceMoveToObject(oItem, TRUE));
AssignCommand(oBeggar, ActionPickUpItem(oItem));
}
}Of course, there are other things you need to consider:-
1) Does the player just want to drop this to the ground for a moment?
2) Will the beggar spawn in a location that cannot easily reach said item? (Although the function I use may help force the beggar to reach the location of the item here.)
3) What happens if the player drops another item after dropping the first?
I'll let you wrestle with some of those ... as I better have a go at doing some of my mod now.

Lance.