When this script is put onHeartbeat of an object that has an inventory it will search the area for dropped remains and transfer everything into its own inventory. It is set only for remains but can be adjusted to pick up items too. I made this script in order to clean my spawning room and city without having to mess with the NPC version that may get killed, be to slow, or just a plain hassle. You can also adjust the timeing. There may be a little lag because it is a hearbeat script but I have 56k and it hasn't bothered me yet. I have tested it and worked out all the bugs I know of. If you have any questions or tips on how to make it better email me at [email protected]
Posted by Shirei at 2007-09-22 20:19:29 Voted 10.00 on 09/22/07
Thanks for the script. I have been looking for something that you don't need to put on a module event (like OnUnAquire). I use it for a personal PW-type mod for fairly training characters. _________________________ Evil Overlord Rule #4: Shooting is *not* too good for my enemies.
Well,
I got some great feedback from users and thought I'd update this thing by posting a faster and making the appropiate changes to pick up items and everything dropped in the remains. I prefer to give players a chance to pick stuff up but it seems a lot of users want a more fast acting script so here ya go.
void TrashObject(object oTrash, string sResref, int iStack)
{
object oItem;
if(GetHasInventory(oTrash) == TRUE)
{
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
oItem = GetFirstItemInInventory(oTrash);
while(GetIsObjectValid(oItem))
{
iStack = GetItemStackSize(oItem);
sResref = GetResRef(oItem);
CreateItemOnObject(sResref,OBJECT_SELF,iStack);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oTrash);
}
}
else
{
iStack = GetItemStackSize(oTrash);
sResref = GetResRef(oTrash);
CreateItemOnObject(sResref,OBJECT_SELF,iStack);
DestroyObject(oTrash);
}
}
void main()
{
//int oGo = GetLocalInt(OBJECT_SELF,"go");
object oTrash = GetFirstObjectInArea();
string sResref;
int iStack;
//if(oGo == 5)
//{
SetLocalInt(OBJECT_SELF,"go",0);
while(GetIsObjectValid(oTrash))
{
if(GetObjectType(oTrash) == OBJECT_TYPE_PLACEABLE && GetTag(oTrash) == "BodyBag")
{
TrashObject(oTrash, sResref, iStack);
}
else
{
if(GetObjectType(oTrash) == OBJECT_TYPE_ITEM)
{
CopyObject(oTrash, GetLocation(oTrash), OBJECT_SELF);
DestroyObject(oTrash);//TrashObject(oTrash, sResref, iStack);
}
}
oTrash = GetNextObjectInArea();
}
}
//else
//{
//++oGo;
//SetLocalInt(OBJECT_SELF,"go",oGo);
//SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), FALSE);
//}
}
Thanks again for all the positive responses.
Happy New Years,
If you uncomment the lines under the while statement at this point it will work for items. Sorry for the lack of script comments.
else
{//Uncomment these lines to trash items too
//if(GetObjectType(oTrash) == OBJECT_TYPE_ITEM)
//TrashObject(oTrash, sResref, iStack);
}
Posted by s0ad. ( 24.174.xxx.xxx ) at 2004-05-27 13:17:00
Kelio, the description clearly states that it was not made for items, just for remains (i.e. the little bags creatures drop when they die.).
Posted by kelio ( 66.191.xxx.xxx ) at 2004-04-22 21:40:00
don't mine me but it will not work for me I used a chest for my trashcan and I put your script on it's heartbeat then i when into the mode to test and layed down and item then i left the area and when i got back the item was still where i left it
Posted by DARK VETEG A PRINCE ( ..xxx.xxx ) at 2003-08-15 17:47:00
Hey thanks I been looking for something like this to clean up areas.
You must be Logged In to post comments in this section.