Announcement

Collapse
No announcement yet.

Adding a Parameter to the Construction Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    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!

    Leave a comment:


  • replied
    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".

    Click image for larger version

Name:	ExposeOnSpawn.png
Views:	899
Size:	15.5 KB
ID:	1430318

    Leave a comment:


  • started a topic Adding a Parameter to the Construction Script

    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.

    Click image for larger version

Name:	FriendlyTag.jpg
Views:	943
Size:	24.3 KB
ID:	1430311

    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.

    Click image for larger version

Name:	TagLoop.jpg
Views:	912
Size:	62.4 KB
ID:	1430312

    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.

    Click image for larger version

Name:	SetParentTags.jpg
Views:	901
Size:	16.9 KB
ID:	1430313

    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.

    Click image for larger version

Name:	CallingSetParentTags.jpg
Views:	910
Size:	47.8 KB
ID:	1430314

    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?
Working...
X