Announcement

Collapse
No announcement yet.

Need help with "Set members in struct". Cant get it to work.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help with "Set members in struct". Cant get it to work.

    Im trying to make a weapon upgrade. Each unique item is a struct called itemdetails. All the details from the item is in this struct. Now I want to change the struct for the item that is getting upgraded. So I made this little code for the button clicked event. Everything works yay! It gets changed and everything looks good. buuuut,

    Click image for larger version

Name:	231607a00acb1b7a6b8bc08deb2dfe2d.png
Views:	62
Size:	73.9 KB
ID:	1721981

    Its resetting everytime I close and open my widget. So its working but when I close the widget and open it again its getting back to what it was before I press the button (before its getting upgraded). Any clues? Anything would help! Thankyou for taking your time. Is this a bug?

    #2
    Removing and recreating a widget will flush any changes you've made, so you should put the struct in some kind of blueprint (weapon/character). Also setting the struct after using set members is redundant.
    Character Customizer

    Comment


      #3
      You do not need to set ItemDetails after using Set Members, as it takes a reference, and already changes the variable. If you recreate the widget each time you open it, the value will be reset to whatever you set it to when you create the widget. Look into setting the external value that you are feeding into ItemDetails, rather than ItemDetails itself.
      Marketplace Assets

      Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
      Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
      Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

      Comment


        #4
        Ah I see, I feel pretty stupid now. Well, thankyou both for answearing. So I think I have to change the variables inside each upgradable item? I just thought setting it up in the widget would be easier. Or any other ideas?

        Comment


          #5
          Originally posted by Redwoke View Post
          Ah I see, I feel pretty stupid now. Well, thankyou both for answearing. So I think I have to change the variables inside each upgradable item? I just thought setting it up in the widget would be easier. Or any other ideas?
          The ItemDetails struct is a copy, so any changes made to it will not be made to the original. If your upgradeable item is an object, you could just change the value in the object, and then instead of having a copy of the values in your widget, just access the object's values directly when you need them.
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            Originally posted by Jamendxman3 View Post

            The ItemDetails struct is a copy, so any changes made to it will not be made to the original. If your upgradeable item is an object, you could just change the value in the object, and then instead of having a copy of the values in your widget, just access the object's values directly when you need them.
            I see, thankyou for the answear. So what if i create a interface event in the masteritem. And call it from the upgrading widget. Is it possible to do it like this? Im getting class defaults from the item that is selected in my smithing widget. Then im printing the name as a string and this works. So should I change the structure (details) from here?

            This is inside the MasterItem.

            (Details are the name of the "S_Itemdetails" in master item. ItemDetails are the name of the "S_Itemdetails" in the upgrading widget. S_Itemdetails is the name of my structure.

            Click image for larger version  Name:	958db76dc95bf7420d8605e1aee758d5.png Views:	0 Size:	63.0 KB ID:	1722284

            sorry if there is bad english.
            Last edited by Redwoke; 02-17-2020, 11:30 AM.

            Comment

            Working...
            X