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"

Problem with Items equipped, Enum

Hi guys and gals, I'm in need of your help once again. This time I made a short video illustrating the problem because it's difficult for me to explain when typing.


This is the UI_Equipment widget script to update the slots: alt text

Product Version: UE 4.15
more ▼

asked Jun 04 '17 at 04:38 PM in Blueprint Scripting

avatar image

19 2 5 8

avatar image Irakli Jun 04 '17 at 06:39 PM

can you please show the graphs for "set equipment slot" function/graph? I suspect problem may be there

avatar image PistolizedCannon Jun 04 '17 at 07:06 PM

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think I see the problem: You are doing a foreach loop on the equipment array. I am not sure what you keep in that array (items you already equipped would be my guess) but whatever you are doing it gets done on ALL the objects in that array.

My guess as to what is happening: it starts with rifle: because rifle is already equipped it puts it into the secondary slot with 99 amount. Then it puts the grenades into their respective slot.

In effect you are putting all equipped items into the UI ONE MORE TIME. If you want to go this way I would recommend clearing the UI first (remove all equipped items from UI and reset the variables) and your function will add them all again.

The right solution would be different though. Keep the reference to the newly added item, and pass only that item into this function. This way it will be run only 1 time and will add the item into a free slot, without going through all equipped items.

EDIT: Quick fix: instead of iterating over the equipment array, add an input to your createEquipment custom event and pass in an array containing only the one new item you are adding to the inventory. Subsequently do your foreach on this custom event parameter array instead of your existing whole inventory array)

more ▼

answered Jun 04 '17 at 07:40 PM

avatar image

458 15 6 25

avatar image PistolizedCannon Jun 04 '17 at 08:20 PM

I believe your solution is the way to go and I'm excited about it. I'll give it a try, I'll let you know the result.

avatar image Irakli Jun 04 '17 at 08:49 PM

good luck! please accept the answer if it helped

avatar image PistolizedCannon Jun 05 '17 at 07:53 AM

Hey man, I cannot thank you enough! Now it works.alt text

avatar image PistolizedCannon Jun 05 '17 at 08:01 AM

One more question, do you have any idea why my buttons are just white when it's empty? probably it's very easy, I'll try to figure it out myself

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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