I have a float var setup in C++
What I want to do and have done so far is make the var available in Blueprint. And the value settable in the weapon blueprint configs. Everything so far is working but the math of taking the CurrentAmmo ( how much ammo is in the weapon currently in inventory) and the multiply it by the value set in the blueprint config.
in ShooterWeapon.h
UFUNCTION(BlueprintCallable, Category=Weapon)
float GetCurrentMYVAR() const;
UPROPERTY(Transient, Replicated)
float CurrentMYVAR;
FORCEINLINE float AShooterWeapon::GetCurrentMYVAR() const
{
return WeaponConfig.MYVAR;
}
in ShooterWeapon.cpp
void AShooterWeapon::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (WeaponConfig.InitialClips > 0)
{
CurrentAmmoInClip = WeaponConfig.AmmoPerClip;
CurrentAmmo = WeaponConfig.AmmoPerClip * WeaponConfig.InitialClips;
CurrentMYVAR = WeaponConfig.MYVAR * CurrentAmmo;
}
DetachMeshFromPawn();
}