However, I have an issue - I mean, everything is working I just want to add an extra feature.
Every item have a default class Imgur: The magic of the Internet (On the right) and one of them is a bool CanBeUsed. Of course in the blueprint which contain information what will happen if the item will be used, there is a branch Imgur: The magic of the Internet and it’s checking what’s the default value - if it can or can not be used.
So I created a character and added a trigger sphere to it. I want to, somehow, change this variable depends on the character is overlapping or not the trigger sphere.
How can I achieve it?
Those information are stored in a Structure and I never used them, so it’s hard for me to work with those things.
Kind of strange you have CanUse bool in meta data of item and to define if player is in range, you would expect that meta data constant. Insted of making varable, make CanBeUsed function which on call will check distance between player and item and return true (or else you want extra other conditions), this is practice used in UE4 enigne it self, in character you can find function like CanJump, CanCrouch etc. If you have multiplayer then you need to send player refrence and make something like CanBeUsedBy.
As for issue at hand, i suspect you have wrong pointer, you should use also se set invidual varable node as what you doing will replace entire S_ItemInfo struct in your item
Could you give me some more examples? What I need is to use the item next to the character which have a trigger sphere on it, so I need to overlap to use the item - if I don’t overlap, I can not use it.
Is there any way to switch it from how it is right now, or it is completely impossible?
If I’ll make the function - in which blueprint should it be? And what should be the thing which gives the information about the place where you can use the item?
One more thing. I tried different type of switching it, I come up with something like this: Imgur: The magic of the Internet which look more understandable.
But the cast is always failing.
I dont know what is that NonDisclosureForm, so i don’t know check on debug (put breaknote on node) if you have right refrence, if that varbale is none it will fail.
And again i dont see point of condition check in you meta data struct, if you would work with othercoder he would most likely be confused by this design.
CanBeUsed should be on item ofcorse where else do you think it should be? Function and variables should included to class (Blueprint is a object class) that they related to, you asking Item if it can be used, so it should be in the item base class so every item will have implement it. If you don’t understand concept of class watch this:
Overlap check should be done in CanBeUsed function where all considtions to be used should be check, you can do this with this node:
The condition check should be done on Use of the item, this way you only do overlap check only when it’s needed. If Use is a only moment when you need to check this condition, you don’t need to make CanBeUsed and just do overlap check in Use function, whatever you make that work, it’s your design choose