//Treasure trash Fairy
//Modified Heartbeat script based on the funky trash fairy script by
//Undead Waiter.
//Instead of collecting items dropped by players, this fairy loots the
//bodybags of dead monsters. A script developed as my module slowed
//severely when people left treasure they didn't want.
//As with the trash fairy, set character to plot and place this script in
//the on heartbeat event script of it. Set the creature to SLOW or V.SLOW
//to give players the time to decide whethere they want the treasure or
//not.
//Adjust perception as needed.
// Created 7.27.2002 by Undead Waiter
// Modified 16th April 2003 by Ogotu.
void main()
{
//Main variable declarations
int iResetValue = GetLocalInt(OBJECT_SELF, "ResetNumber");
//For Multiple faires that work together, change this for each fairy
//and save the H/B script as a different name.
//Note first will attract the fairy to the first object spawned
//object oBodyBagDestroy = GetObjectByTag("BodyBag",0);
object oBodyBagDestroy = GetObjectByTag("BodyBag",1);
//object oBodyBagDestroy = GetObjectByTag("BodyBag",2);
//object oBodyBagDestroy = GetObjectByTag("BodyBag",3);
//object oBodyBagDestroy = GetObjectByTag("BodyBag",4);
int iHasInventory = GetHasInventory(oBodyBagDestroy);
//Make sure no one has created an item called "BodyBag" by checking for an
//inventory
if (iHasInventory == TRUE)
{
if (oBodyBagDestroy != OBJECT_INVALID)
{
//I know, i'm just too lazy to do a loop.
ActionMoveToObject(oBodyBagDestroy,FALSE,100.0);
ActionTakeItem(GetFirstItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
ActionTakeItem(GetNextItemInInventory(oBodyBagDestroy),oBodyBagDestroy);
//Too lazy here too
ActionDoCommand(DestroyObject(GetFirstItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
ActionDoCommand(DestroyObject(GetNextItemInInventory(OBJECT_SELF)));
}
}
}
This is the one I found from ' http://nwvault.ign.c....Detail&id=1731 '
Looking at it now... I'm sure there is a much better way to do this then what this code is. But maybe it'll spark an idea.
// Modified Trash Fairy
// Place on HeartBeat of your trash fairy
// Kudos to the original Trash Fairy Authors
void DestroyIfNoOwner (object oItem)
{
object oHolder = GetItemPossessor(oItem);
if ((oHolder == OBJECT_INVALID) || (GetTag (oHolder) == "BodyBag"))
DestroyObject (oItem);
}
void main()
{
object oItem = GetNearestObject(OBJECT_TYPE_ITEM);
object oInventory;
if (oItem == OBJECT_INVALID)
oItem = GetNearestObjectByTag ("BodyBag");
if (oItem != OBJECT_INVALID)
{
ActionMoveToObject(oItem);
if (GetHasInventory (oItem))
{
oInventory = GetFirstItemInInventory (oItem);
while (oInventory != OBJECT_INVALID)
{
ActionDoCommand (DestroyIfNoOwner (oInventory));
oInventory = GetNextItemInInventory (oItem);
}
}
else
{
ActionDoCommand(DestroyIfNoOwner(oItem));
}
}
}
This is the second one I found from ' http://nwvault.ign.c....Detail&id=2203 '
This one looks a little better anyway. Still a HB script though. You could probably make a similar effect by making it work OnEnter though with a trigger, or as was suggested on the UnAcquire. Then there is the all famous Pseudo HB. I'm not sure what method would be best for you, and I'm not sure which is the best use of resources. Personally... I'd go with the UnAcquired script. That one fires less often, and only when there actually is something to pick up. Far as I know with scripting the usual answer is 'Less is More'.
Sometimes he tries to get the item, but another action cancels. The beggar is subject to move constantly time by time and this cancell the pickuping item. Do not have a function that can help us?
If your running the animations from the ambient system then they are probably firing off and interfering. I've had that problem before when scripting actions. Maybe once the script starts you can find a way to disable them until they're done picking up the garbage? Maybe removing the variable from the beggar, then giving it back after 30 seconds or so would work? I'm not THAT familiar with the ambient animations, so I'm unsure.