How to change an actors float variable from the player

I want my game to have a lot of ways to increase the projectiles damage, the thing is the projectile is (as you can guess) a different actor i cant figure out a way to cast into it so does anyone else have an idea how to do it, i dont wanna have to create a projectile for every possible kind of upgrade combinations
Anything helps and thanks in advance

In your projectile class create a new float variable call it “damage”.

when you spawn the projectile inside the player or weapon class, promote it to a variable of the projectile class type. and then set the damage to whatever you want.

Then create a custom event lets call it “Set Projectile damage”. and now whenever you want to change the damage just call this custom event.

Pipe the data into the projectile as you spawn it, the above would work but exposing variables is simpler / neater and can be somewhat more efficient.

Consider:

  • which actor spawns the projectile?
  • what are the sources of increased damage (which actors / events are responsible for it)?
  • accumulate all the sources in a framework class every BP has access to anyway

There are also actor components - especially useful in more complex scenarios. You could dynamically add a bunch of comps to a spawned projectile - their logic would define the entire projectile behaviour.

thanks, will definitely try later

Sorry I missed up a bit.
The damage variable should be made inside the projectile BP.
and the just pull the pin from the projectile variable and type “GetDamage” and you will get it.

By mistake I mixed up the damage from current class and projectile damage. They should be different.

noted