action Ammo_Pickup_Action()
{
VECTOR create_pos; //vector for storing starting position
vec_set(create_pos.x,my.x); //save initial position
while(condition for being alive)
{
//code to execute while alive (like spinning, moving, detecting when it has been picked up,etc)
//condition check for while loop to end when the object should be destroyed
wait(1);
}
ent_remove(me); //destroy when its condition to exsist is not met
wait(-10); //to wait 10 seconds after it has been destroyed for example
ent_create("ammo.mdl",create_pos,Ammo_Pickup_Action); //create it again re-using the local vector's stored position 10 seconds after it has been removed
}
There you go, I added two lines at the begining of the function to create a local vector and set it to store the entitie's position on creation.
Also modified the new entity creation line at the end to use that local vector.
Assuming you are using simple scripts, I removed the need for a global entity pointer. If you are placing in wed, all you need to do is place the object and apply this action, nothing more required (besides filling in the while condition with what you want the entity to do and something to stop the while loop when it should be destroyed).