Announcement

Collapse
No announcement yet.

Need help with a tutorial : TopDownCharacter VS Player Controller

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

    Need help with a tutorial : TopDownCharacter VS Player Controller

    Hello,

    I am following a tutorial made by UnrealGaimeDev, about building an inventory system. I am an artist playing with Unreal Engine on my free time, so programming is not my forte.

    I am stuck with this particular part of the tutorial :

    https://www.youtube.com/watch?v=_GDs...mzqo_Q&index=5

    At 4:06, The Inventory Syetem is cast to the TopDownBP, I want to know how to cast it to my player controller and getting it to work. I have tried it but it does not work. I have my suspicions as to why but I need help with that next step.

    Here is the tutorial so far, till the end of part 4 in working order. (UE Version 4:16)

    https://drive.google.com/open?id=1KX...cVl5BIPzSbM7Dp

    Thank You to anyone willing to help.

    #2
    Use the node Get player controller as object to your Cast node, should work !

    Comment


      #3
      Originally posted by LumberJackStudio View Post
      Use the node Get player controller as object to your Cast node, should work !
      Why don't you try it and see if it works ?

      Clearly, it's not that simple, is it ? Hence why I need help.

      Comment


        #4
        Sorry people for the answer in French

        - Un screen de ton propre BP serait pas mal.ou tu peux utiliser le site suivant pour montrer là où tu bloques: https://blueprintue.com/
        - A 4:06, j'ai pas vu de Cast et pas envie de me taper tout le tuto
        - Peu de personnes téléchargeront un tuto pour voir où tu bloques
        - Tu demandes de l'aide et tu envois bouler le gars précédent en lui disant de tester par lui même ses réponses qui en plus de mon point de vue répondent à ton problème.

        Screenshot!!!

        Comment


          #5
          luckily for me I'm fluent in French!

          My mistake, the google drive link are the tutorial project files, you will be downloading the project files.

          You're absolutely right, at 4:06 you don't see anything, but in the following 10 seconds you do.

          Thank You for the link, I will post a screenshot then. Here is the link to it :

          https://blueprintue.com/blueprint/0pnq_0t9/


          Comment


            #6
            -Update topic-

            I forgot a link :

            https://blueprintue.com/blueprint/wsh0xak0/

            The code works fine if it's cast to a character BP be it Third Person or Top Down or whatever you want it to be.
            Last edited by Allure et Charme; 04-10-2019, 03:47 AM.

            Comment


              #7
              After viewing the tutoral, it's at 7:00

              The "Other actor" is a Character and you "cast to a chartacter" not a controller...
              So you want to cast to the controller
              from the "other actor", try "Get controller" and then instead of casting to the caracter cast to your controller.
              Your inventory is owned by the character or the controller?

              Comment


                #8
                Thank You for taking the time for viewing the tutorial and sorry for getting my times wrong.

                I have tried choosing cast to controller instead of cast to character and it doesn't work. When walking close to the object I just collide with it instead of the object disappearing.

                This is the code included in the player controller : https://blueprintue.com/blueprint/wsh0xak0/

                If I drag of 'Owner' of the 'SpawnActor' and chose 'Player_Controller' it doesn't change anything, probably because the code is already in the player controller and I have selected the correct player controller in my game mode.

                Who owns the inventory ? That is a good question... I have no idea.

                Here are all the blueprints of the tutorial so far, except the player controller which is already above, there are 2 of them, the BP_Inventory and BP_PickUp_Actor :

                Let's start with the BP Inventory :

                Event Graph :

                https://blueprintue.com/blueprint/rnao1lze/

                Function 'Get Item Info at Index' :

                https://blueprintue.com/blueprint/ur5p0tvd/

                Function 'Get Amount at Index' :

                https://blueprintue.com/blueprint/fdalv95t/

                Function 'Search Free Stack' :

                https://blueprintue.com/blueprint/k096lvi7/

                Function 'Search Empty Slot' :

                https://blueprintue.com/blueprint/mdwyih7v/

                Function 'Is Slot Empty ?' :

                https://blueprintue.com/blueprint/pbdn7mt_/

                Last Function 'Add Item (Internal)' :

                https://blueprintue.com/blueprint/qul_rds2/



                Now for the BP_Pickup_Actor :

                Event Graph :

                https://blueprintue.com/blueprint/k58v_khz/



                Last edited by Allure et Charme; 04-13-2019, 02:32 AM.

                Comment


                  #9
                  Refresh post

                  Comment


                    #10
                    Looks like everything works fine except the final one.

                    Try to get player controller instead of cast a actor to player controler could be helpful.

                    Comment


                      #11
                      I'm afraid I don't understand what you have in mind, can you explain to me step by step the solution you have in mind please ?

                      Comment


                        #12
                        I haven't watched anything you posted. But based on the answer I can give you a bit of context.

                        One of the simple way I can think of to describe "cast to" would be the following: you get a reference to an object (in your case the blue pin "other actor") and you try to check if it's an object of the class you're casting to. If it is, you'll be able to manipulate it and any property it has.

                        So basically when you try to "cast to player controller" out of the "other actor" pin of a collision event (let's say overlap) you're basically saying "whatever collided with me, I try to know if it's a controller".

                        But Controllers have no physical presence whatsoever, they can't collide with anything. Your controller will never fire this event and therefore your cast will never be successful.

                        What you want to do is find the reference to the player controller where you coded your item logic. Where will you find such a reference? Well, this controller is logically possessing the character used to step on the item.

                        In this case it's pretty easy, you just have to grab the wire out of the "other actor" node in your collision event. Cast it into your class of PlayerCharacter then grab the pin out of the cast, get the controller out of your character and cast it into your class of PlayerController. The blue pin out of the cast will give you a reference to your PlayerController.

                        The logic of this is the following: an object collide with the item, is the object my player character? ok, yes, then I grab the Controller of this character and I try to see if it's my type of Controller. If it is, I can access and modify its properties.

                        Quote me if you want more details (it will give me a notify).
                        Last edited by Yun-Kun; 05-05-2019, 05:36 AM.
                        [Released] Multiplayer Combat Editor
                        A-RPG Sacred Swords
                        Youtube Tutorials

                        Comment


                          #13
                          Thank You for your reply. Thank you for your time and energy, this is more a long the lines of the answer I was expecting.

                          Yeah, I basically figured out everything you said I just didn't know how to implement it. It works ! Thank You so so so much !!! I feel like I have achieved a stepping stone into my learning of EU Thanks to you. I'm learning EU as a hobby and it's frustrating when our concerns are treated with the lightness of the first comment.

                          Thanks a bunch !!!!

                          Comment

                          Working...
                          X