Announcement

Collapse
No announcement yet.

Action RPG Inventory System

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

    Yes, I override OnPostLogin, and I have the server do something similar to what Multiplayer Shootout does in that it gets the Player Start, spawns my Character there, and has the Player Controller Possess that new Character. Right after Possess, I call an init function on the owning client with the player controller as the target, which in turns starts the setup of the Inventory in the Player Controller.

    The HUD shows up correctly, but the error occurs with the PlayerInventory and I can't pick up items.

    As a note, I'm still in 4.10.

    Nevermind about the delay in the OnPostLogin, it didn't work.
    Last edited by ToxinGaming; 04-15-2016, 02:19 AM.

    Comment


      Originally posted by ToxinGaming View Post
      Yes, I override OnPostLogin, and I have the server do something similar to what Multiplayer Shootout does in that it gets the Player Start, spawns my Character there, and has the Player Controller Possess that new Character. Right after Possess, I call an init function on the owning client with the player controller as the target, which in turns starts the setup of the Inventory in the Player Controller.

      The HUD shows up correctly, but the error occurs with the PlayerInventory and I can't pick up items.

      As a note, I'm still in 4.10.

      Nevermind about the delay in the OnPostLogin, it didn't work.
      If you have a proper setup in your project then you shouldn't need a delay.

      Best to try and see what is causing the PlayerInventory Null Reference in your initialize, because if the player doesn't have an inventory it can't pickup items
      Try putting some print strings to see if your init function is finishing properly.
      \\VANGUARD INTERACTIVE

      Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
      Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
      Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

      Comment


        OK, I think I found the problem.

        For starters, I checked both the Inventory Manager Component and the Player Inventory Component on my Player Controller and they both were not NULL.

        Next, I decided to replicate the Player Inventory variable and initialize it with a server RPC instead of what you showed in your screenshot above.

        This removed the Accessed None errors on the server.

        However, I still can't pick up anything.

        I think this is because the server doesn't know where to look when doing the line trace. I was dealing with server/client line traces in another thread. Essentially, here, when you press E, you call the Server_OnActorUsed function, which is a server RPC which will then call OnActorUsed. OnActorUsed will then call GetUsableActor, which is where the line trace happens. So in the Get Usable Actor function it uses the Character Reference and uses that reference's Follow Camera and Camera Boom to create the two vectors needed for the line trace. However, Follow Camera and Camera Boom aren't replicated, so the server will have no idea where to start and end the line trace. In fact, I put a Print String right after the Is Valid check on the character reference on the Is Not Valid side and it printed a string on the server, meaning the character reference is NULL.

        So I think to fix this, I'm going to have to make sure that Character Reference and Equipment Character Reference are both replicated and initialized with RPCs similar to PlayerInventory. And then I'm going to need to fix the Server Line Trace to use the proper location and rotation of the cameras, which will require either setting up replicated camera variables or just passing in the start and end trace vectors through the RPC.

        Comment


          Awesome to see your progress OverRated_AU ! It's cool to see all that's possible with this system.

          You were right Pirate about using the UpdateStats function to add events on item equip, that worked wonders.

          I started working a bit on lootable enemy characters, and for some reason I realized I can't loot either Tandy or Muppet anymore. I seem to be able to loot everything else ( items, skeletons and pots), just not characters for some reason. Any idea where that might come from ?

          Edit : (I'm getting an error from the 'characterreference' node in the getusableactor, which probably is the source of the error ? )
          Last edited by exphrasis; 04-15-2016, 03:57 AM.

          Comment


            Originally posted by ToxinGaming View Post
            OK, I think I found the problem.

            For starters, I checked both the Inventory Manager Component and the Player Inventory Component on my Player Controller and they both were not NULL.

            Next, I decided to replicate the Player Inventory variable and initialize it with a server RPC instead of what you showed in your screenshot above.

            This removed the Accessed None errors on the server.

            However, I still can't pick up anything.

            I think this is because the server doesn't know where to look when doing the line trace. I was dealing with server/client line traces in another thread. Essentially, here, when you press E, you call the Server_OnActorUsed function, which is a server RPC which will then call OnActorUsed. OnActorUsed will then call GetUsableActor, which is where the line trace happens. So in the Get Usable Actor function it uses the Character Reference and uses that reference's Follow Camera and Camera Boom to create the two vectors needed for the line trace. However, Follow Camera and Camera Boom aren't replicated, so the server will have no idea where to start and end the line trace. In fact, I put a Print String right after the Is Valid check on the character reference on the Is Not Valid side and it printed a string on the server, meaning the character reference is NULL.

            So I think to fix this, I'm going to have to make sure that Character Reference and Equipment Character Reference are both replicated and initialized with RPCs similar to PlayerInventory. And then I'm going to need to fix the Server Line Trace to use the proper location and rotation of the cameras, which will require either setting up replicated camera variables or just passing in the start and end trace vectors through the RPC.

            In the Action RPG Inventory System demo player controller this is already setup to address those issues. I am not sure what is different in your project without being able to see it myself.
            You said everything works fine when you play in editor with dedicated server checked, so I'm not sure why you would need to make any code changes in your project to get things to work with your projects dedicated server.

            You shouldn't need to set the PlayerInventory to replicate because of how Unreal works. The client and the server will both run the initialization code.
            But since you have your own setup for initializing your player controller you need to make sure the server version is setting the PlayerInventory when it inits the InventoryManagerComponent.

            If you look at the Demo init function you can see what gets called by the server/client and what gets called by the client only in this screenshot.


            But none of this explains why it works normally, but not with your projects dedicated server.
            \\VANGUARD INTERACTIVE

            Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
            Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
            Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

            Comment


              Originally posted by exphrasis View Post
              Awesome to see your progress OverRated_AU ! It's cool to see all that's possible with this system.

              You were right Pirate about using the UpdateStats function to add events on item equip, that worked wonders.

              I started working a bit on lootable enemy characters, and for some reason I realized I can't loot either Tandy or Muppet anymore. I seem to be able to loot everything else ( items, skeletons and pots), just not characters for some reason. Any idea where that might come from ?

              Edit : (I'm getting an error from the 'characterreference' node in the getusableactor, which probably is the source of the error ? )
              Is this migrated into your own project? Muppet and Tandy are setup with the Interface to make them lootable and have the EquipmentInventoryComponent like a player has. Maybe during your migration the interface was unhooked?
              It's very similar setting up a character to be looted as any other actor like the loot containers. They just need an InventoryComponent and the Usable Actor Interface and Inventory Interface and the implementation of the interface functions.
              \\VANGUARD INTERACTIVE

              Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
              Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
              Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

              Comment


                Originally posted by Pirate View Post
                Is this migrated into your own project? Muppet and Tandy are setup with the Interface to make them lootable and have the EquipmentInventoryComponent like a player has. Maybe during your migration the interface was unhooked?
                It's very similar setting up a character to be looted as any other actor like the loot containers. They just need an InventoryComponent and the Usable Actor Interface and Inventory Interface and the implementation of the interface functions.

                Yes that is migrated into my own project Oh you're right I was just forgetting to actually add the 'inside' of the functions, they were there but just had the base and return node for some. That's super helpful for the lootable players.

                However I'm still having an issue with those NPCS...If I switch back to both inventoryplayer and the controller instead of mine, the NPCS work, but not with my character. My character can still open pots/ skeletons and pick up items though.

                Comment


                  In your Demo controller, you initialize via BeginPlay, which is called by both Server and Client.

                  I guess I can call the Initialize twice when the Client joins the server, once by Server and once by Client.

                  Yes, this worked. Just for a future reference for anyone who does implement the Gameplay Framework (using GameMode to control client spawning) and wants to make sure everything spawns correctly when loaded instead of using the BeginPlay with delay, the initialization needs to be called by both the server and the owning client right after Character possess in the OnPostLogin.
                  Last edited by ToxinGaming; 04-15-2016, 04:40 AM.

                  Comment


                    Originally posted by ToxinGaming View Post
                    In your Demo controller, you initialize via BeginPlay, which is called by both Server and Client.

                    I guess I can call the Initialize twice when the Client joins the server, once by Server and once by Client.

                    Yes, this worked. Just for a future reference for anyone who does implement the Gameplay Framework (using GameMode to control client spawning) and wants to make sure everything spawns correctly when loaded instead of using the BeginPlay with delay, the initialization needs to be called by both the server and the owning client right after Character possess in the OnPostLogin.
                    I am glad you got it worked out
                    \\VANGUARD INTERACTIVE

                    Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
                    Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
                    Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

                    Comment


                      Originally posted by exphrasis View Post
                      Yes that is migrated into my own project Oh you're right I was just forgetting to actually add the 'inside' of the functions, they were there but just had the base and return node for some. That's super helpful for the lootable players.

                      However I'm still having an issue with those NPCS...If I switch back to both inventoryplayer and the controller instead of mine, the NPCS work, but not with my character. My character can still open pots/ skeletons and pick up items though.
                      You need to update the OnActorUsed() functions inside Muppet and NPC (Since the Tandy example is a child of NPC) and change the Cast node Cast To Inventory Player Controller to cast to your own player controller.
                      That's why it works normally but not with your player controller.
                      \\VANGUARD INTERACTIVE

                      Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
                      Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
                      Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

                      Comment


                        Originally posted by ToxinGaming View Post
                        In your Demo controller, you initialize via BeginPlay, which is called by both Server and Client.

                        I guess I can call the Initialize twice when the Client joins the server, once by Server and once by Client.

                        Yes, this worked. Just for a future reference for anyone who does implement the Gameplay Framework (using GameMode to control client spawning) and wants to make sure everything spawns correctly when loaded instead of using the BeginPlay with delay, the initialization needs to be called by both the server and the owning client right after Character possess in the OnPostLogin.
                        Do you mean the Controller possess?

                        Comment


                          Originally posted by Pirate View Post
                          You need to update the OnActorUsed() functions inside Muppet and NPC (Since the Tandy example is a child of NPC) and change the Cast node Cast To Inventory Player Controller to cast to your own player controller.
                          That's why it works normally but not with your player controller.
                          I
                          Yup again that worked. And thanks to your explanations, I have a much better understanding of the system as a whole now Is there anything I need to do to have my starting loadout be in the actual equipement sheet also ? Right now if I try to loot someone else, I can loot them all good, and I do have my starting items as well on me, but I can't see them in the equipment slots if that makes sense. Like my helmet is visible on me, but I cannot see any of those items equipped when on the character equipement sheet ( when I press C basically there's nothing there) .
                          Last edited by exphrasis; 04-16-2016, 12:10 AM.

                          Comment


                            I would like to request some help with the Action RPG Inventory System. I have about 99% successful integration of your plugin into our game project, but I'm stuck on one bug that I cannot seem to track down. When an item is looted from Muppet (or other), the associated mesh item is removed from Muppet's body, added to the player's inventory, but the item image/slot is not removed from the container window. The icon will not go away but when all items are looted, the window closes like it's supposed to and cannot be opened again. Could you please assist me with this issue?

                            Comment


                              Originally posted by OverRated_AU View Post
                              Do you mean the Controller possess?
                              Yeah, the target Controller possesses the passed in Pawn in the custom GameMode event called during the OnPostLogin event which is also in the GameMode.

                              Click image for larger version

Name:	possessinit.PNG
Views:	1
Size:	93.5 KB
ID:	1104633

                              The first Custom Character Init is an event, (which is being called on the server since we are in my custom GameMode) in my custom Character blueprint that sets up certain variables and will eventually call the initialize event in my custom Player Controller that will set up the Inventory. The second is a RPC to the owning client which will eventually call the same init function on my Character blueprint. So first server, then client calling the same intialize.

                              Comment


                                Originally posted by exphrasis View Post
                                I
                                Yup again that worked. And thanks to your explanations, I have a much better understanding of the system as a whole now

                                Is there anything I need to do to have my starting loadout be in the actual equipement sheet also ? Right now if I try to loot someone else, I can loot them all good, and I do have my starting items as well on me, but I can't see them in the equipment slots if that makes sense. Like my helmet is visible on me, but I cannot see any of those items equipped when on the character equipement sheet ( when I press C basically there's nothing there) .
                                What version are you using? and if it's an older version have you applied all the updates? The Inventory UI refreshes to reflect your startup items already in the project. Perhaps something got unhooked when you migrated? Or you are initializing the Client Inventory UI before loading your Startup Items on the Server.

                                In your Initialization the Server Inits the Inventory/Loads the startup items into the Players Inventory(Remember all items are owned by the Server on the Server version of the InventoryComponent, the Client just gets it's UI updated to show what they have) then after that you would call on the Client InventoryManagerComponent->Client Load Inventory as this is where the UI gets initialized/built for the Client. If there are items in the Server Inventory when you initialize the Client UI it will call the Event Server Refresh Inventory Slots after it's finished creating the Client UI. This event will make sure that all items on the Server will sync to the Client UI.


                                Click image for larger version

Name:	reload_inventory_UI.png
Views:	1
Size:	463.1 KB
ID:	1104686


                                If you need to refresh the whole UI on the Client yourself you can always call the Event Server Refresh Inventory Slots as a simple way to sync the Client UI with the Server Inventory Items.
                                But since your issues is with startup items simply initializing the Client UI after loading the startup items will do it for you.
                                \\VANGUARD INTERACTIVE

                                Marketplace - Action RPG Inventory System | Multiplayer TopDown Kit | Advanced Social System
                                Multiplayer TopDown Kit Tutorials - Merging The Action RPG Inventory System | Removing the Fog of War
                                Action RPG Inventory Tutorials - Merging Into Your Project | Adding New Items | FPS Controls w/ UI Mode Toggle

                                Comment

                                Working...
                                X