Help: Structures

Hi

I have made a strut out of 5 INTs. Now can I use that Strut in different BPs, or do I need a different Strut for each BP.

Capture.JPG

Capture.JPG

Regards

You can use the struct in any blueprint, but it won’t retain it’s values across blueprints, it’s only the structure itself. I’m not sure why you would want to do that though, as there isn’t much reason to use a struct for 5 ints since an array does the job. What are you actually doing with that struct?

Hi

Thanks again

What I am looking at is:

  1. 5 produce (for testing)
  2. 5 (x2) widgets, 5 for buying and 5 for selling.
  3. I want to work out how many want to buy and sell.
  4. Work out which one wants to buy and sell
  5. Produce a 3D widget that will show that produce to the player.

I can make the 3D Widget without an issue, it is just working out, what is up for sale, or what needs to be bought.

This would run of variables, such as;

The store is full or we need stock extra quickly.

This would then relay down to price and availability.

Regards

I might of worked it out “In my head”

From a Each loop / Array Index, could I put a Bool to say yes or no.

Thus at the end, Bool 1 could be yes or Bool 2 could be no?

You can create a variable of your struct type in any BP. To communicate it between different BP you can pass it as a regular parameter (float, int, reference).
If you want to have a single instance of your struct that can be reference by other objects. Add it as a variable to game mode blueprint for example and let the other BP’s access it directly or using get/set functions.