Announcement

Collapse
No announcement yet.

Set Array Elem problem

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

    Set Array Elem problem

    Hi, I created a dynamic array in C++:

    Code:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Weapon Inventory")
    TArray<bool> WeaponInventory;
    and I replicated it using the DOREPLIFETIME macro. The problem is that if I try to set an array element from a Blueprint, I can set it only on the client, because on the server it doesn't work. Why?

    I did this on my blueprint:

    Unreal Engine 4 C++ Programmer

    My projects:
    Ultimate Arena FPS

    Our Discord Server:
    Ultimate Arena FPS Discord

    #2
    Could a good samaritan please help us out with this issue? Thanks!
    CEO - AceGamer Network
    Our multiplayer FPS game: http://store.steampowered.com/app/436260/

    Comment


      #3
      The only work around I found for this is using the Set Members In node, which allows you to modify a variable by reference. If you simply get the object out of the Array by index, then Set Members In. This will expose the variable of the Array Element, allowing you to update it.
      Last edited by PeterLNewton; 01-03-2015, 05:37 AM.

      Comment


        #4
        Thanks for the reply, but I can find only these nodes:



        What I have to do now?
        Unreal Engine 4 C++ Programmer

        My projects:
        Ultimate Arena FPS

        Our Discord Server:
        Ultimate Arena FPS Discord

        Comment


          #5
          Originally posted by Scienziatogm View Post
          Thanks for the reply, but I can find only these nodes:



          What I have to do now?
          Make it a Structure instead of using Bools, its an extra conversion. But that will allow you to use Set Members In.

          Comment


            #6
            Originally posted by SilentX` View Post
            Make it a Structure instead of using Bools, its an extra conversion. But that will allow you to use Set Members In.
            I did what you said, but there is the same problem: the variable changes on the client, but not on the server. Here there is the blueprint:

            Unreal Engine 4 C++ Programmer

            My projects:
            Ultimate Arena FPS

            Our Discord Server:
            Ultimate Arena FPS Discord

            Comment


              #7
              Originally posted by Scienziatogm View Post
              I did what you said, but there is the same problem: the variable changes on the client, but not on the server. Here there is the blueprint:

              Oh I've overlooked the initial problem, my apologies! The variable is set to replicate? (Looks to be)
              Last edited by PeterLNewton; 01-03-2015, 06:53 PM.

              Comment


                #8
                Originally posted by SilentX` View Post
                Oh I've overlooked the initial problem, my apologies! The variable is set to replicate?
                Thanks for the reply. How can I set an UPROPERTY Reliable? I knew that it was possible only for UFUNCTIONS.
                Unreal Engine 4 C++ Programmer

                My projects:
                Ultimate Arena FPS

                Our Discord Server:
                Ultimate Arena FPS Discord

                Comment


                  #9
                  Originally posted by Scienziatogm View Post
                  Thanks for the reply. How can I set an UPROPERTY Reliable? I knew that it was possible only for UFUNCTIONS.
                  That's what I meant, setting it to Replicate but I seen you're already doing it.

                  Edit

                  Try RepNotify instead!
                  Last edited by PeterLNewton; 01-03-2015, 06:57 PM.

                  Comment


                    #10
                    The array or the struct is replicated, but the replication doesn't work. Is this a bug?
                    Unreal Engine 4 C++ Programmer

                    My projects:
                    Ultimate Arena FPS

                    Our Discord Server:
                    Ultimate Arena FPS Discord

                    Comment


                      #11
                      Originally posted by Scienziatogm View Post
                      The array or the struct is replicated, but the replication doesn't work. Is this a bug?
                      Have you already tried RepNotify?

                      Also, if you wanted to notice the changes immediately. It would be better to use a replicated reliable function.
                      Last edited by PeterLNewton; 01-03-2015, 07:01 PM.

                      Comment


                        #12
                        I did this:



                        But when I go on the pickup, this is the variable value:

                        Unreal Engine 4 C++ Programmer

                        My projects:
                        Ultimate Arena FPS

                        Our Discord Server:
                        Ultimate Arena FPS Discord

                        Comment


                          #13
                          Can anyone help us? Thanks.
                          Unreal Engine 4 C++ Programmer

                          My projects:
                          Ultimate Arena FPS

                          Our Discord Server:
                          Ultimate Arena FPS Discord

                          Comment


                            #14
                            We probably need a developer to help us out with this. It seems kind of complex for the average user.
                            This is very important for us to keep up the workflow and get the inventory system working properly.
                            CEO - AceGamer Network
                            Our multiplayer FPS game: http://store.steampowered.com/app/436260/

                            Comment


                              #15
                              Hey, im having the same issue and could use help too. Thx

                              Comment

                              Working...
                              X