x

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"

How to assign Character to Slot in UMG?

Hello Everyone,

I have created Menu where you can pick a slot and assign character to the slot. I have made working prototype but it was too complex and it seemed that this could be done much more elegant way. I will try to explain the way I went first time.

In LevelBP:

alt text

I spawn BP_character few times, and with foreach loop add random values to the "Info"struct *Info struct posses all the stats of the character, which is updating everytick in BP_character

In GameMode:

I make array from spawned characters (of course with delay to let them spawn) Also I store all the variables I will use, here in GM, also different functions and EventDispatcher, which eventually I would call from UMGs to Assign in another UMGs.

In HUD:

alt text

I nested few other WB's, such as container with other WB's as Slots, and Side Menu WB with spawned array of WB_Characters which are related to Spawned BP_characters

The Way I did:

Clicking "Slot"

1) It will set its index in GM's var as a selected Slot

2) Side menu pops-up on the right with array of WB_Characters (Which are representing spawned BP_characters) Via Event Dispatcher stored in GM. (Not sure

Clicking "WB_Character"

1) it sets its index in GM's var as a selected Character

2) Call in WB_Character an EventDispatcher, so in GM both Index vars of selected Slot and selected WB_char, connects to GM's function "Get Character Info" to get Info

3) Set Info struct to Info struct of selected slot.

alt text

This will assign Character to the slot. It works OK-ish, but it feels like so too complex for such simple operation. I has been a week I have tried different approaches, well, they work in my head and in pseudo code, but doesn't in real life.

My Goal:

Make BP_Character set its Info struct to GM's var, as the info in the BP is constantly chaning. And other WB access directly the Var in GM with Info struct rather than the BP_Char. as shown in the picture:

alt text

But for some reason I cant Achieve it. Have been trying for a week now.

Also, as an additional challange I want to make assigned WB_Character's button to be disabaled and if I assigned another characted to the same slot it will enable previosly set WB_character's button once more. As if now, after reassignment they are stay still disables, I tried to fix it, maybe it is an easy fix, but seems I am stuck.

alt text

Does anyone have any suggestions on how to resolve the problems I faced with?

Product Version: UE 4.15
Tags:
more ▼

asked Apr 04 '18 at 01:58 AM in Blueprint Scripting

avatar image

CGGreatto
1 1

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

0 answers: sort voted first
Be the first one to answer this question
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