How do i make a power up blueprint that increases the damage given by multiple projectiles

I am trying to make a power up actor that when my character picks up it

for a few seconds for multiple projectile actors, not just one. I’m still learning so sorry if this is a basic thing but for some reason I can’t get it done. I tried casting the classes to each other but it wont work for some reason.

I want my

(stupid name I know) actor to change the value of damage in

211410-5c4e846ae5f3cd7cb41d66066f980a50.png

.
How can I do it?

sorry this is my first time asking a question didn’t know it would look messed up like that

Hi MadLed,
How is handled the projectiles spawn from your player?

You spawn it when you use a “Fire” event?

if is this the case you can expose a powerup damage bool in your projectiles and handle it inside.

give me a sec i make an example to be clear :slight_smile:

Ok this settings can solve problem.

First start with your projectile, in the construction script you have to put this (ignore the block parent: construciton script, you need only the branch)

be sure to set the Bool Editable and Expose on Spawn.
[Do this for every bullet you have]

Second: Put this code inside your player

The function PowerUpBullet have a float input for the time and set the BulletPowered of the player true for a certain amount of time.

The InputActionFire is to test the project (i think you already have a function for this ehehe)

Third: this is the PowerUpZone

Is a simple Actor with a Box Collider and a Exposed float for PowerUpTime, when a player touch the trigger zone do a cast to that player and call the function to powerup the projectile with the PowerUp Time set in the editor (or inside the blueprint).
after this the powerup zone destroy itself.

I hope this is what you need :wink:
If you have other question feel free to ask!
Bye!

Thank you very much that solved my problem :slight_smile: BUT now i have a different problem.

since i have multiple bullets that means i’ve put them in a class array so the player can switch between them

that way the exposed variable won’t show up on the Spawn Actor From Class Node, so how do i do it?

or maybe there is a better way of switching between projectiles? i tried switching weapon actors but i had no luck in doing so.

thanks :slight_smile:

Hi!
You not see the exposed variable because the spawn actor can not see the projectlie class, is consider a generic spawn

I think this can be solved by use a Base Projectile class and every projectile is a blueprint child of this class.

I will test and show you an example give me a sec :slight_smile:

Ok it work,

First of all, choose one of the projectiles to make him the main class (or create a new one)

After that Right Click on that blueprint and select “Create Child Blueprint Class”

You must have this situation

211518-projectilestreeexample.png

After that inside the Base class put this on construction script

Is the same of old script but this time you have 2 new var: “PowerUpDamage” and “BaseDamage”

this vars allow you to customize the damage for each projectile.

Remember to put the bool editable and exposed on spawn.

Now inside your child blueprint you will see this inside construction script.

Don’t add any code in construction but modify the new vars inside the detail panel (highlited in the image)

After that inside the player make a class array of the projectile base class and put the sons inside it

In this case the spawn show the exposed bool and you can use it with every childs class.

From now you can create how much projectiles you want :wink:

P.S: Remember to put the Bullet logic inside the base class. The childs will inherit that code.

you can do it with other things to like weapon, items, etc…

I hope this will help! :slight_smile:

Thank you very much :slight_smile: that solves all of my problems for now :smiley: sorry for troubling you

no problem dude, make game (even this little things) is always fun :wink:
Best luck for your work :slight_smile: