in my fps, i want there to be an ammo crate that (when picked up) is deleted and then regenerated after not existing for 10 seconds.
`Ammo Crate code A (ammo increase)
IF OBJECT EXIST(7)=1
IF weapon(CWeapon).ammo<weapon(CWeapon).maxammo AND INTERSECT OBJECT (7, Leg_x#, Leg_y#, Leg_z#, Play_x#,Play_y#, Play_z#)>0
INC weapon(CWeapon).ammo,(weapon(CWeapon).maxammo-weapon(CWeapon).ammo)
DELETE OBJECT 7
ammo_regen()
ENDIF
ENDIF
`ammo crate code B (clips increase)
if object exist(7)=1
If weapon(CWeapon).clips<weapon(CWeapon).maxclips and weapon(Cweapon).ammo>= weapon(Cweapon).maxammo
if INTERSECT OBJECT (7, Leg_x#, Leg_y#, Leg_z#, Play_x#,Play_y#, Play_z#)>0
INC weapon(Cweapon).clips,1
delete object 7
ammo_regen()
endif
endif
endif
function ammo_regen()
if object exist(7)=0
if timer()>=10000
MAKE OBJECT CUBE 7,10:COLOR OBJECT 7,RGB(000,255,000):POSITION OBJECT 7,100,Ground#,280
endif
endif
endfunction
If your ammo is less than your max ammo and you pick up an ammo crate, it fills your current ammo to the max. If your ammo is at your max ammo, and your clips is less than you max clips, then it will add 1 to your current clips. Either way, the ammo crate is supposed to be deleted and regenerated after 10 seconds. It seems that it is not deleting the ammo crate when I run over it, and it increases ammo and clips simultaneously as long as neither of them is at its max.