Zelda-like kind of inventory gestion.

Hello guys.

I’m a complete beginner, so I looked a lot of tutorial around youtube or the unreal website.

There’s really a lot of things to learn… However, the topics are often the same (and it’s normal you might say.)
I go then realize that the type of game I’m interested in is probably a little apart. The FPS gender is over-represented and, after all… We’re on Unreal engine ! So it’s normal.

That’s why I am asking again for your help.

I found many topics dealing with inventory management, creation of weapons, ect …
But nothing for a game that look alike pickups of zelda or Binding of Isaac kind of games.

Let me explain.

It’s an inventory, but not really.
I have an idea that it was designed as follows:

Basically you have bombs, keys ect … We will say Item X and Item Y.

Well, I assume that : I** have to tell to the blueprint :

MyCharacter : I have Item X and Item Y.
BP : Ok. How many ?
MyCharacter : 0.
BP : So you have, but you can’t use it.

And, so, when I pick up one, MyCharacter can use it. (Once.) And you understand the logic. You pick up two, you can use it two time, ect…**

For weapons, it’s something else.

In Binding of Isaac for example, we go on a weapon and “crush” the previous or adds effects to the ones you already have. We are far from the rotation that can be seen in an FPS, it retains its weapons and you can change it. There, you do really only one, so there is no management. And no ammunition or reloading.

So I have a weapon in the blueprint of my character. The standard shot.
I wonder if it is conceivable to create separate blueprints, which if I go over my character, will replace the one my character already have. (For example, he has the weapon 1. He walks on a weapon 2. So the weapon 2 becomes his weapon and 1 disappears.)

I wonder if my reasoning is correct or if I need to see it in a different way?

Because once I have the system after it is no longer a problem. I would that changed the properties of each weapon, but the operation will be the same. I walk on it, it ramplace, boom, new weapon, ect …

But it is especially for pickups that I wonder if we can do that:

I have the object: Yes / No.
If yes, how many ? 1 ? You can use it once. 2 ? Twice ect…
If no: 0, so not usable.

Or if it has to go through further management?

Thank you in advance, I try to be as clear as possible. I apologize in advance for any errors in grammar, spelling …

Many thanks.

(Ps : I just want to know if my reasoning is correct.)

It’s funny to think that , as a player , we assume certain things.

Let me explain.

I managed ( What an exploit) to add a delay on weapons when I keep pressed the firing button .
As a player , we therefore assume that this delay will apply everywhere.
But no. It would be too simple. If I spam my fire button , the delay will not be taken into account and I have to program something more.

And it’s actually the whole problem of the design. Our player experience makes one say: Yeah, it’ll be easy and it goes with it ect …
But the software , as powerful as it is, can not execute anything as we do not say it.

I advance step by step and I always look for a way to replace a weapon with another, simply by walking on it.

Just walk, pick it up, delete the old one and… That’s it.

Sorry if I’m asking a lot, but I progress in general much by talking to people rather than by myself and it’s very hard for me to write correctly in English.

So I just ask for a little help where I can.

Thanks by advance.

So the problem is still that you want to have an inventory of items that are already IN your invetory (like keys in Isaac)?

This is simple. You only need to have a int array. And you will only use this int array for all the items.

Lets say you have Keys, Bombs and Money. They are displayed at the top left corner. Lets also say you have your UMG setup
to display an icon for each as well as 3 text fields that will show the number. And lets say you will want to display an “X” if
you have 0 items of one kind. (Or you want the icon to disappear, same logic).

Now would need the int array to have a size of 3. That means [0], [1] and [2]. If you pickup a key, you add 1 to IntArray [0] and so on.

In the UMG, you just get [0], [1] and [2] of the int array and plug that into your text fields.

Now you can make a check. If the entry of, for example, [1] is 0, then set the text field to “X” instead of the number.

Or if we have a -1, then don’t display the Icon at all, because maybe you setup the int array with -1 at the beginning in all 3 fields.
So that the player needs to find and pickup an item first before the icon is displayed.

Now if a key is used, just reduce [0] by 1.

Thats all. If you have more question, feel free to ask!

I’ll tell you how I setup my weapons in my game:

Weapon is an Actor Blueprint, with a “Shot Function”. All my different weapons are childclass of “Weapon” and I’m overriding the effect of the “Shot Function” on each of these weapons to make them do what I want them to do. To create a childclass, simply create a new blueprint of the type of your mainclass (here, to create all my weapons, I’d create a new blueprint of type “Weapon” for each of them).

On event begin play, I’m instantiating a Weapon of my choice (arbitrary choice) on my character. I store this weapon in a My Character variable named “PlayerWeapon”.

When I pick-up a weapon, I’m destroying “PlayerWeapon” and instantiating the newly looted weapon (that I also save as “PlayerWeapon” now that the previous one is removed).

When my player shots, I call “PlayerWeapon”-“Shot Function” and it automatically gives me the effect of my current equiped weapon’s shot function.

Wow guys.

Thanks for these answers, it’ll help me alot.

But here, I’m a little bit confused.

eXi :
Many thinks, it seems to be what I expected.

So, I’ll try to uderstand all these informations. In my Character Blueprnt (I assume it must be here) I create 3 integer Array with a default value of 0. (For the example : Bomb, Key and Money.) and I link them to a “Make Array” with a size of 3.

But, the most part of your answer is based on the UMG.

I begin to think that the task should be rather simple. Even if I don’t understand the most part of it… I just need to find how to manage the system of pick up.

With your solution, can we still use the item if the value is 0 ? Or it is impossible ? Or can it go into negativ number ?

(If I can abuse, can you show me a “type” or some “clue” of this kind of gestion of array ?)

Yun-Kun :

Many thanks to you too.

So… If you have your “Shot Function” in your Weapon blueprint, you don’t have to have this kind of function in your character blueprint ?
At the moment, in my Character Blueprint, I have the movements (QWSD for movements) and I can shot projectiles with Left, Right, Up and Down.
If I follow your setup, all my commands for shoting have to go to the Weapon blueprint ?

Did this blueprint is your basic weapon or just a Blueprint that “guid” all the Childs ?

Thanks by advance for you two.

That’s totaly up to you. You just need to check if the array is 0 at this position. If you say that you can only use the item if the number is > 0, then you
can’t use it as soon as it’s 0 and if you decrease the number in the Use function, then you also can’t hit negative numbers.

The Character listen to shot inputs and asks the weapon to shot.

So the CharacterBP has the event listeners, the WeaponBP has the shot function, the first one calls the second one.

If you wonder how to call your function from the character to the weapon, you have to create a reference of it through a variable (of the type “WeaponBP”) in your character BP.

Then you can get the variable “WeaponBP” and asks it to launch “Shot Function”.


Here it is.

I wanted to begin with the pick up. So, I have created a simple pick up (A “key”). When I pick it up, it disappear. Simple.

I have followed some tutorials, and I hav created an inventory, a basical UMG and a simple way to kill myself. (For checking if the health bar work !)

So, actually, I’m trying to connect them all. I have a little box in my UMG were my “KeyPickup” have to be. But I don’t know how to say to the blueprint : Here, it is the Key, so add 1 in the little box in the UMG.
And, when I use it, check my inventory and remove 1 from the little box.

And I have an array with 3 points. But… I have no idea how to deal with it…

Thanks you for all your tips.

(I’m focusing on the inventory before the weapons. I can’t do all these things at the same time.)

Considering where you are right now it seems to me that you have a lot to learn about blueprints (dont mean no offense :)).

I strongly advise you to follow some tutorials (such as this one).

Tutorials are way better to start learning how to do your stuff (they dig deeper into stuff, you can pause, you can rewatch, you can do your stuff while they’re doing their…).