I would do it the same way, copy the item to a location, and destroy the original.
In case you don't hve something for it, this ugly script is my random location generator:
// (5/14/2011) - FB
//// returns a random location fDistance from lTarget
location FB_GetRandomLocation (location lTarget, float fDistance)
{
int nTemp = FloatToInt (fDistance * 20.0);
int nRandomX = (Random (nTemp) + 1) - (nTemp / 2);
int nRandomY = (Random (nTemp) + 1) - (nTemp / 2);
float ModX = IntToFloat (nRandomX) / 10.0;
float ModY = IntToFloat (nRandomY) / 10.0;
vector vPos = GetPositionFromLocation (lTarget);
float fPosX = vPos.x;
float fPosY = vPos.y;
float fPosZ = vPos.z;
vPos = Vector (fPosX + ModX, fPosY + ModY, fPosZ);
lTarget = Location (GetAreaFromLocation (lTarget), vPos, 0.0);
return lTarget;
}
Likely there are more efficient ones about on the vault or this site, but it's worked well so far for me.
Modifié par Failed.Bard, 10 juin 2011 - 04:14 .