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"

Get variables from WorldGen in C++

tl;tr: How can i get varibles/arrays from the WorldGen/Blueprints in my BTService

I have a WorldGen that generates a world based on "blocks", like siedler of catan. All blocks are stored in the array "WorldInfo".

The WorldGenerator is made by my friend and he is not able to use C++. I want to write the AI in C++ and used the following guide: YOUTBE to start

Now im at the point where i am in the BTService and want to find the block where I'm on and want to iterate through the "WorldInfo" array to find the closest ressource block.

Product Version: UE 4.15
more ▼

asked Mar 23 '17 at 02:24 PM in C++ Programming

avatar image

1 1 3

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

1 answer: sort voted first

You need to use the reflection system to access Blueprint-defined variables from C++. I've posted an example (for a slightly more complex case) here.

more ▼

answered Mar 23 '17 at 11:55 PM

avatar image

Matthias Hölzl
411 13 6 19

avatar image Tiega Mar 24 '17 at 07:54 AM

wow thats a really a lot of code, i guess it will make more sense to define the Blueprint parent in C++ and then access it or do i miss something?

avatar image Matthias Hölzl Mar 24 '17 at 02:25 PM

No I don't think you're missing anything. Defining the parent in C++ and having Blueprints inherit from this class is what I do whenever it is possible. Although, to be fair, quite a bit of the code in the example deals with setting values, which is worse than just getting values out of Blueprints. But still, while the reflection system is great to have, code using it is a lot more verbose and more difficult to debug than the straightforward solution, so, to repeat myself, in my projects I always define the basic structure of types in C++ and then use Blueprints to customize them.

(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