Adding a Parameter to the Construction Script

I am making a twin stick shooter, and I have my Projectile BP class ignore any collision with my Player’s Character BP class by checking for a tag that only the Player has.

FriendlyTag.jpg

I wanted to make the behavior more versatile so any Actor BP class can us the Projectile class. I did this by having the code loop through an array called ParentTags that contains all the tags of the Parent Actor that shot the projectile.

In order to set the ParentTags variable, I created a Function called SetParentTags that passes in the Parent Actor’s tags and sets them to ParentTags.

SetParentTags.jpg

The problem with this method is that this function is always required to be called immediately after the Projectile is created in order for my the Projectile’s collision logic to work.

I would much rather set the ParentTags variable as soon as the Projectile is created. Is there a way to modify the Construction Script so it has a parameter that’s required to be passed into it?

I actually figured out my answer. All you need to do is go into the Details panel of ParentTags, and check the boxes for “Expose on Spawn” and “Instance Editable”.

ExposeOnSpawn.png

6 Likes

I know this is an old thread, @Lotzi11 but thank you for coming back and posting the answer. Doing things like this makes life so much easier for the rest of us, when we have the same problem. It certainly saved me a lot of time today. Cheers!

2 Likes