Bleuprint copy problem

Good morning everyone,

I encounter a problem with a Bleuptint which is linked to a Widget whose buttons allow the control of actions programmed in the Bleuprint. When I put an asset in the scene everything goes smoothly, if I put a copy of that asset it does not work.

What’s wrong with my construction?

Bleuprint

](filedata/fetch?id=1806782&d=1598881283)
Widget
](filedata/fetch?id=1806783&d=1598881330)

Thank you in advance for your answers

Is it because your widget does this:

this.JPG

and when you have two copies of the widget, it doesn’t now which one to get…

How to fix it ?

It’s not pretty. You have use event dispatchers.

](filedata/fetch?id=1806874&d=1598900757)

](filedata/fetch?id=1806875&d=1598900764)

You can pass parameter through them.

So it’s possible, but what you’re basically experiencing, is that it’s not expected.

I think part of the problem is that some of the logic that should stay in the blueprint is making it down to the widget. What exactly are you trying to do?

Sorry, ignore that - you said ( thinking… )

So, doesn’t it make more sense to have one widget that will talk to all of these blueprints? I mean, even if you got this working, the widgets would be on top of each other on the screen.

I would say, have one widget which gets a list of all the blueprints and you can choose which one to interact with. Or put the widget IN the blueprint. You can do it as a component, it’s a bit like those floating health bars you see on multiplayer…

@ ****ClockworkOcean ****: Thank you for taking your time to answer me. As a beginner, I have trouble understanding your reasoning.

What I want to do is use the pending bleuprint and multiply it so that my character can harvest fruit on several plants of the same species.

I’m with you…

Ok, so a number of ‘trees’ in the level. Each is a BP. Walk up to one and click it ( maybe ) and a widget appears saying ‘harvest fruit?’

Give each BP an ID. It’s just an integer which you can assign in the editor. When you walk up to a tree and click, it calls the BP, but leave a copy of it’s ID in the game instance. The widget can look in the game instance and know which BP has been clicked.

The game instance is one of these things you’ll hear about all the time, along with player controller, game mode, game state blah blah blah…

Basically the game instance is a BP setup by the system when your game starts running, it’s always there in the background and accessible from everywhere:

So do this:

  1. Make a game instance and put a variable in it, just an int called ID. ( compile, save )

  2. In your BP ( the tree ), you can say:

](filedata/fetch?id=1806928&d=1598908067)

  1. In the widget:

](filedata/fetch?id=1806929&d=1598908244)

It might look like a bit much, but it’s not really. Watch the vid, see how it goes…

Hello Clockwork Ocean, all
That’s where I’m at, I don’t think I’ve got the knots right, because it doesn’t work.
The Widget no longer appears on the screen.

Bleuprint

Widget

I’ve made a working version.

First off, apologies, ONE thing I forgot to tell you. You have to tell the project to use your game instance in the settings:

](filedata/fetch?id=1807259&d=1598988509)

So this is the blueprint:

](filedata/fetch?id=1807260&d=1598988817)

and the widget:

](filedata/fetch?id=1807261&d=1598988858)

I put two in the level ( excuse the appauling GIF, you can’t upload anything here ):

ezgif.com-optimize.gif

If you need more info, please quote me, otherwise I don’t get a notification…

Also, the cube has this:

In order to understand the functionality of your schema, I took the liberty of disassembling the part “instance”. Surprise its works also without. I probably missed a step! With the part “instance” all the cubes change color at the same time.

A solution?

A question: what is the “Cast To Pawn” for?
With or without, I also got the same result.

If they all change color at the same time, you probably have the widget code wrong :slight_smile:

Perhaps you see or hide the error… ?

](filedata/fetch?id=1807706&d=1599120055)

](filedata/fetch?id=1807707&d=1599120061)

When you put the cubes in the level, you have to set the ID differently for each one! :slight_smile:

( that’s how the GI can tell them apart… )

Thank you so much, for your patience and kindness shared your knowledge.
My problem is solved !
May God bless you.

Ha! Great:)

Hello Clockwork Ocean,

I come back to this subject because an error occurs when I add an “Event”, the actor is no longer indexed. I tried to place this “Event” in several different places and yet no conclusive result, although we took their place correctly.

Where can the problem come from?

Thank you in advance for your replies

BP fleur nbr visite.jpg

I think I understood where the problem came from, I incorporated the “Cast To Game instance” at the Widget level. Indexing is done normally.

You should be able to cast to GI at widget level. The code looks ok.

I still have one question …
How to save several actor indexer in an array?

Are you saying you want to do this for more than 2 actors? It will work with any number.

yes that’s it, for a multitude of actors