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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Set a variable from a group of actor arrays

Hello, so, i have spawned 30 meteors, with random locations, rotations and scales, and what i want to do, is to shoot more bullets to those meteors that are bigger. What i have done this far, is to create a variable on the Meteor Blueprint, (called health) and i want to change this variable based on the scale of the meteor. So, on the meteor actor blueprint, i've drag out from the Event tick -> get all actors of class, and then for each loop, get, and get actor scale 3D, and if they are big enought, a branch that sets the variable health to a bigger number. But is not working, Any help? Thanks

Product Version: UE 4.15
more ▼

asked Apr 07 '17 at 10:21 AM in Blueprint Scripting

avatar image

1 3 5

avatar image Jason.J Apr 07 '17 at 02:50 PM

Why not do the scale to health logic inside the constructor of the meteor class (or in the BeginPlay event) itself instead of trying analyze them outside (by looping through all actors of the class) of the object?

and why would you set the heath during tick? This will be evaluated every single frame pass.

From what you've described, if all spawned meteors are looping through all spawned meteors every tick and setting health.... This seems as a very inefficient and ineffective approach.

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

1 answer: sort voted first

As Jason.J said, this would be best done in the construction script. Here's a quick example:

alt text

Each time a meteor spawns, it will set its own health based on its scale.

_4.png (86.9 kB)
more ▼

answered Apr 08 '17 at 03:37 AM

avatar image

1.5k 65 132 103

(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