x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Spawn Child Actor Component with Bool

Greetings!

I am making a cabinet with health pickups inside that can be used once the player open it.

To facilitate the production, I want my cabinet to have editable bool to set if the cabinet has a pickup inside and if so, set the location of that item. I am using a child actor component for the pickable.

So far, I managed that part but I struggle to make the item spawn only if I set the bool to true. By default, the item will spawn at the root and I don't want that. Here's the construction script so far.

alt text

Any clues on how I could make it work?

Thank you for your time!

Product Version: UE 4.21
Tags:
more ▼

asked Mar 15 '19 at 10:35 AM in Blueprint Scripting

avatar image

flynneastwood
24 5 5 8

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

I don't really understand this setup. In order to use the construction script as you have it, the health pickup has to already exist as a child actor component. The only thing the boolean is doing is "moving" where the health pick up is located. You should be using a "spawn actor from class" and "attach component" nodes if you want something to be "created" that didn't exist.

more ▼

answered Mar 17 '19 at 09:08 PM

avatar image

Nebula Games Inc
4k 24 9 14

avatar image flynneastwood 4 days ago

I did as you suggested in the Event graph and it's working good! Thank you Nebula!

(comments are locked)
10|2000 characters needed characters left

From the image you posted I don't see anything stopping the "health pickup" object from being spawned. Right now all that is happening is the object is being set to the "item location" location, if use item is true. You need to have different logic for spawning the health pickup or not.

more ▼

answered Mar 17 '19 at 05:33 AM

avatar image

Raventp
31 3 4 6

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question