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 :

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)

Thank You to anyone willing to help.

Use the node Get player controller as object to your Cast node, should work :slight_smile: !

Why don’t you try it and see if it works ?

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

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!!!

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 :

-Update topic-

I forgot a link :

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.

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?

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 : InventorySystemTutorial_SS_02 posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

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 :

Function ‘Get Item Info at Index’ :

Function ‘Get Amount at Index’ :

Function ‘Search Free Stack’ :

Function ‘Search Empty Slot’ :

Function ‘Is Slot Empty ?’ :

Last Function ‘Add Item (Internal)’ :

Now for the BP_Pickup_Actor :

Event Graph :

Refresh post

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.

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 ?

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).

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 !!!