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"

Can't get 'Set Actor Active' or 'Hidden in game' to work

Hello all,

I have two levels connected. Depending on how the first level is completed, an array of booleans is filled in in a certain way. In my second level, I want the array of booleans to determine which actors are active. I have checked that my first level is working correctly and the array is filled properly (most likely - i print a 'hello' message for every item that should be active in level 2 and this is working correctly). The problem is that no matter what I do with 'set active' and 'set actor hidden in game', the actors I want hidden will not be hidden. Blueprint below:

alt text

Basically I store my 'boxarray' in the gameinstance, retrieve the value of the boxarray according to the index of the actor i want hidden/displayed, then set whether it is hidden or not. But it is always visible by default, even though the boxarray contains both 'true' and 'false' values.

Product Version: UE 4.18
Tags:
screenshot-14.png (296.6 kB)
more ▼

asked Mar 17 '18 at 03:33 PM in Using UE4

avatar image

Dorthonion1
3 2 4

avatar image ThompsonN13 Mar 17 '18 at 11:05 PM

what actors are you trying to set to hidden? currently the only actor your setting to hidden is the cockblock one. in every way i look at this script it just doesnt seem quite right, either not correct or not optimal.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Just noticed the name of the actor LOL (it's a private project), the actor I am trying to hide is the mesh component, which is a child of the actor blueprint.

Any help would be nice, HOWEVER I have figured out I can just teleport the actor out of sight, which is as good as deactivating it. But this problem is bugging me.

more ▼

answered Mar 18 '18 at 12:46 AM

avatar image

Dorthonion1
3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

the way i would go about setting the actors to hidden would be through using an array of actors and use a for each loop. now theres several ways to do this but the two that come to mind first would be to make a array in the level blueprint by getting references to the actors or make a actor that stores data and does the script. in both cases you will need to have a variable in the game instance to tell the scripts which array you want to use. this variable will be coupled with a select node to actually select the list. you will also need to use a for each loop.

making an array from actor references in the level blueprint is probably the most straight forward and simple as you just need to select the actors in the level then go to the event graph right click and look for the get reference to actors. then get a make array node and use a for each loop and a set actor hidden in game node. its easy to understand how it works but its not reusable in different levels and its somewhat of a pain to add actors to.

alt text

the next method is a little more complex to implement but it is much more modular and reusable. basically you want to create a actor that will hold all of the information (array lists) and script that you want to execute. you will want to create an array of the type actor, name it and make it editable, repeat this step to create however many lists that you want. then when you drop this actor into a level you can just select it and populate the values of the arrays in the details panel via a dropdown list. its much easier to add and remove actors on the fly. also with it being a blueprint actor you can do the same thing in each level and just change what actors are in the array.

alt text

aside from the way of populating the arrays both scripts will basically be the same. i probably didnt explain it very well but if you look at the pictures it shouldnt be too hard to get. the aim with what i proposed was to get a list of which actors need to be hidden with a reference to each, then use a loop to hide each one. personally i like method two since its simple and reusable. you also may need to tweak the implementation to suit your needs.

capture2.png (238.0 kB)
capture.png (199.6 kB)
more ▼

answered Mar 18 '18 at 02:00 AM

avatar image

ThompsonN13
10.1k 33 9 23

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Thanks very much I will bear it in mind for future.

more ▼

answered Mar 18 '18 at 05:18 PM

avatar image

Dorthonion1
3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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