ID:168797
 
Ok! When you have no ammo and no clips left, you can unequip it and equip and you will have full ammo. Now I know why this happens. When you equip a gun it checks what gun you want to equip and sees what ammo and clips to have in it, when you unequip it it goes to nothin. Ex. - .9mm 0/0 - equip it and - 5/35 - use all ammo and clips -0/0 but!! unequip and equip...5/35!!! how can i make it thatit knows how much ammo and clips i used, like use half of the .9mm, start to use the AK47, come back and still have half the .9mm...not full ammo....i hope thas not confusing...
Yoderic wrote:
Ok! When you have no ammo and no clips left, you can unequip it and equip and you will have full ammo. Now I know why this happens. When you equip a gun it checks what gun you want to equip and sees what ammo and clips to have in it, when you unequip it it goes to nothin. Ex. - .9mm 0/0 - equip it and - 5/35 - use all ammo and clips -0/0 but!! unequip and equip...5/35!!! how can i make it thatit knows how much ammo and clips i used, like use half of the .9mm, start to use the AK47, come back and still have half the .9mm...not full ammo....i hope thas not confusing...

If I get what you're saying, you could just give the guns each a "remaining_bullets" or something var, to keep track of how many bullets are available for the gun type. Decrement it each time you fire off a shot.

Hiead
In response to Hiead
Hiead wrote:
Yoderic wrote:
Ok! When you have no ammo and no clips left, you can unequip it and equip and you will have full ammo. Now I know why this happens. When you equip a gun it checks what gun you want to equip and sees what ammo and clips to have in it, when you unequip it it goes to nothin. Ex. - .9mm 0/0 - equip it and - 5/35 - use all ammo and clips -0/0 but!! unequip and equip...5/35!!! how can i make it thatit knows how much ammo and clips i used, like use half of the .9mm, start to use the AK47, come back and still have half the .9mm...not full ammo....i hope thas not confusing...

If I get what you're saying, you could just give the guns each a "remaining_bullets" or something var, to keep track of how many bullets are available for the gun type. Decrement it each time you fire off a shot.

Hiead

If not that, show us some relevant code.
-Sin()
Man, you already posted this. Go look at the other post. [link]
In response to Polaruis
Well, the way i do it is have 3 variables, the clip in its full amount, how many bullets are in current clip, and the total amount of ammo..
Yea... you might want to recheck your varibles.
Yoderic wrote:
Ok! When you have no ammo and no clips left, you can unequip it and equip and you will have full ammo. Now I know why this happens. When you equip a gun it checks what gun you want to equip and sees what ammo and clips to have in it, when you unequip it it goes to nothin. Ex. - .9mm 0/0 - equip it and - 5/35 - use all ammo and clips -0/0 but!! unequip and equip...5/35!!! how can i make it thatit knows how much ammo and clips i used, like use half of the .9mm, start to use the AK47, come back and still have half the .9mm...not full ammo....i hope thas not confusing...

this is my first attempt at helping someone, i will most likely fail, but here goes

obj/var
clip=0
ammo=0
mob/var
equipped=list()
obj/proc/guncheck()
if(src.ammo==0)
if(src.clip>0)
src.ammo+=35
src.clip-=1
usr<<"[src.clip] left"
else
usr<<"You dont have any clips left"
else
usr<<"You dont need to reload"

else
usr<<"You have no clips left!"
obj/gun1
clips=5//put as many clips as you want here, and have
// items that will let you add clips to it, such as extra //clips =P
ammo=35//same thing here
verb/Shoot()
if(src.equipped==1)
if(src.ammo>0)
src.ammo-=1//do you firing thing here. i would
//write you
//one, but i think you have one already (my guess)
usr<<"[src.ammo] left"
else
usr<<"Better reload!"
verb/Reload()
guncheck()
verb/equip()
if(src in usr.contents)
usr.equipped+=src
usr.contents-=src
else
set hidden=1
verb/remove()
if(src in usr.equipped)
usr.contents+=src
usr.equipped-=src
else
set hidden=1
mob/Stat(mob/M)
if(statpanel("inventory"))
stat("inventory --")
if(src) stat(src.contents)
if(statpanel("equipped"))
stat("equipped --")
if(Src) stat(src.equipped)

TOTALLY UNTESTED
please, i beg you! dont copy and paste, just learn and write
yer own
In response to Echtolion
No put usr in proc.
Do not use ==o or ==1 for boolean vars. (!var) for 0, or (var) for 1.
Don't use +=1 if you're going to add 1 to something such as a variable, instead use ++.
-Sin()
In response to Sinoflife
heh, i always forget that :P,i know i'd goof up some, but it was good for a first try i s'pose :o)