need help with making the attack selection list blueprint

Yes. The array type can be Enemy type, or just Actor type. Essentially, we spawn some enemies and tell the widget’s widget to populate a vertical box with an array of actors we’re giving it via a custom event.

do i connect event construct with the custom event?

No.

is this right? also in the second image of post 19 how did you make that ADD? and the new var is it made in the level blueprint?

Get array → Add

More about arrays:

it is the select_opponent_button

1 Like

is the new var made in the level blueprint or do i get it from the widget in the level blueprint somehow?

Wherever you spawn the actors. Looks like you were doing it in the LB, indeed.

here i’m only missing only the new var array, what is it supposed to be in this case in the level blueprint and how do i get it to complete the blueprint?

Create a new variable → turn into an array, follow the documentation link I posted if in doubt.

image

so i made an new var that is enemy array but something is weird, while 1 button appears with one enemy, with 2 enemies i get 3 buttons and with 3 enemies i get 6 buttons.
Is it the fact that new var is an array the issue and if not what’s the issue?
btw i know my blueprint looks like a mesh, sorry about that and thanks for the help so far

1 Like

Did you Add every enemy you spawn to the array?

If so, how?

with 2 enemies i get 3 buttons and with 3 enemies i get 6 buttons.

Something is duplicated. You’d need to show the script.

so here i did this , sorry if it isn’t too readable basically it’s spawn actor → add → branch(either 1 or 2) 1]-> spawn actor → add → spawn actor → add
2] → spawn actor → add → spawn actor → add



wait, is it because new var 1 is an array so that every time the ENTIRE array is fed to the widget?

just checked and it was the case so i removed the add enemies form the first and second spawnActor and added this in the false branch of the third spawnActor so it worked thanks a ton

btw i added a back button widget to the select opponent widget like so

but i’m stuck on binding the event calling from the back button widget to the battle_status_widget because at the cast to back_button_widget i can’t figure out what to put at the object node( the reference to self doesn’t work) like this, any idea what to use at object or if the cast to back_button_widget was wrong?

1 Like

You’re adding it as the very last element to the scroll box, right?


Get that widget → get the scroll box → get last child => cast => bind:

Naturally, this can only be done after the button has been dynamically created, be mindful of that. There are other way of doing this, too.


Another note that should simplify your time with dispatchers:

There is no need to do any of the above. If there are dispatchers in widgets that you’ve manually added in the Designer, their events are immediately available in the parent:

Often referred to as autobind. You’ve used it many times without realising it - with buttons, for example:

You never needed to manually bind those, right? Same thing.

the object node connection worked but it didn’t do what it should ( it did nothing ), also i can see the attack_button autobind but not any back_button autobind

That’s normal - this only works for instances that already exist, the back button is dynamic.

As mentioned above. For this to work, you need to bind after you’ve created the button.

  • spawn the enemies
  • spawn the enemy widgets
  • spawn the back button
  • bind the back button

In this order.

yeah so i first spawn the battle_status_widget and then the enemies and then i add them to them select_opponent_widget where the back_button is added as a child to it so any way around that?