got a problem again.
following problem: i coded a inventory, if i pick the shield from the inventory an klick on mouse middle, the shield should fall down on the floor. this works, but if the shield already lies on the floor an i press mouse middle, a new one gets created!
function pick_shield()
{
my.enable_click = on;
if (mouse_map != pointer_pcx) {return;} // don't pick the item if the mouse pointer isn't the cursor
if (vec_dist (player.x, my.x) > 100) {return;} // if the player is far away ignore it
player.shield = 1; // the player has got the shield
show_pointer = 1; // show the mouse pointer
mouse_map = shield_pcx;
if (mouse_map == shield_pcx)
{
on_mouse_middle= delete_shield; // wegwerfen des schildes bei rechter maustaste ///////////////
}
}
//// WIRF DEN SCHILD WEG//////////
action delete_shield()
{
mouse_map=pointer_pcx;
my = ent_create(shield_mdl,player.x,NULL);
show_pointer=0;
player.shield =0;
while (player == null) {wait (1);}
my.enable_click = on;
my.event = shield_init;
}