In ShooterGame how can I access the current ammo amount?

I am trying to access how much ammo the player in carrying thru the blueprint but I cannot figure out what to create to do this.
I searched for a var called either ammo or clip.
I have found neither and then of course this has to be specific to the weapon / player.
Things I am trying to accomplish are.
If the weapon is dropped it should still have the same ammo in it if picked up.
But the additional ammo is it attached to the player or the weapon? I do not need to change this either way but I am not sure what results to expect.
How can I access a var from the weapon blueprint to affect the carrying player? i would like to do this in the weapons blueprint as with having many weapons it would be painful to put have to setup something simple if each weapon already has a default val stored in it.

thanks

Dear Emile,

In ShooterWeapon.h, the base class for all the weapons :

/** get current ammo amount (total) */
00160: int32 GetCurrentAmmo() const;
00161:
00162: /** get current ammo amount (clip) */
00163: int32 GetCurrentAmmoInClip() const;
00164:
00165: /** get clip size */
00166: int32 GetAmmoPerClip() const;
00167:
00168: /** get max ammo amount */
00169: int32 GetMaxAmmo() const;

You can just add

UFUNCTION(BlueprintPure, BlueprintCallable)

to these and you should be good to go

:slight_smile:

:slight_smile:

Rama

the function you put up threw up errors as lack of category I used this instead and it compiled fine.

00159: /** get current ammo amount (total) */
00160: UFUNCTION(BlueprintCallable, Category=Weapon)
00161: int32 GetCurrentAmmo() const;

Thanks for the help Rama

if your issue is resolved please mark the check by my answer so others know it is solved :slight_smile:

yea sorry about the category part, forgot that :slight_smile:

RAma