Hey would it be possible to show a quick example on how to use the “Find Item in Inventory” node. Im trying to implement a feature where the player tries to access a locked door, it would attempt to kind the keycard in your inventory before allowing you to pass. Thanks!
Hi, first sorry for my English, i will try to help you, but i am not on my PC so Staggerlee could correct me and I hope he don’t mind.
When you create a new item, you can specify a, I believe is, “Pickup Class” for it. So when you interact with your door, you can use “Find Item In Inventory with class” function (or something like that). So the function will search your inventory to find if you have an item with that class.
I’m assuming if you have the item in your inventory already, you know how to make an item that can be picked up and added to your inventory. As mentioned by Alexarg use the Find Items in inventory by class. 's an example I use for something else but you can use the same idea. Just use the by class node instead of the one I’m using and in the bottom left where mine has itemdata, just choose the key card. If the player has one, then make a bool set to true and then the door opens if its true… etc.
Thank you very much thankstips, this put me on the right trail. Its working flawlessly now.
The second thing i’m trying to achive is when you drag an widget item over an actor in the world to change its appearance. This is working with “on break Hit Result Under Cursor”, but when i drag an item from the inventory, i can’t find a solution to start the interface blueprint which is starting the events of the actors. Is there a way to get an widgetblueprint items to interact with actors in the scene (drag&drop)? thx for any help c.
@charisti Hey there, there is no way to get Unreals Drag and drop to work in that use case without a bit of work. The drag and drop will not be able in interact with actors that way- however you could rig something onto JcUserInterface OnDrop().
Basically you could try adding a mouse point to world ray trace for an actor when you drop the UMG widget on the JcUserInterface, this might be a little tricky to set up but from there you could fire your interface on the actor, or if no actor was found drop the item in the world (jcInventory default behavior)
Let me know how it goes!
@Alexarg @thankstipcom
Thank you so much guys! Appreciate the swift responses
@staggerlee Thank you for your inventory, im learning very much from it. And thank you for the tracing suggestion.
Its starting to work, when i drop an inventory item it sends out a trace and if it hits an object the interaction works. But I’m not able to get the correct transformation vectors. I tried plenty of stuff. the line shoots always in the same direction. No idea how to get the correct mouse screen or world position or widgetitem position to end the ray. Any help is very appriciated! Thx c.
**@charisti ** did you see this forum post [SOLVED] Mouse location to world space - Blueprint Visual Scripting - Unreal Engine Forums ? i just searched then, looks like what you need.
@staggerlee thank you, yes i did see it and it works when i trigger it in the world!. BUT i simply cant find the mouse location when drag and dropping from UMG. Maybe there is a way to get the dragged item screen location when dropping…
Wondering if someone could help me out
Followed the tutorial for adding the inventory to a custom pawn class, however cannot see the inventory when opened:
PIE:Error: Error Accessed None ‘PlayerInventory’ from node Get Equiptment Item Data by Index in graph ‘OnMouseMove’ in blueprint JCPlayerEquiptSlot
PIE:Error: Error Accessed None ‘PlayerInventory’ from node Branch in graph ‘OnMouseMove’ in blueprint JCPlayerEquiptSlot
Using 4.8.3
Thanks
@TriviusAkakous Looks like the HUD has been set up before the JcPlayerInventory is established, have a look at my response , and see if that helps!
Just to let everyone know this process has changed dramatically in V 4.9 to make it a lot simpler.
There is a new UActorComponent that will handle most of the grunt work needed to get jcinventory working. Basically it just contains the RPC GRAPH as well as the Begin Play stuff. Still in testing as i don’t want to release any bugs!
All you will need to do is add the component and a Interface and it will work out of the box. More details coming when i make the new documentation (GASP!), but i decided this was necessary to get people involved right away and cut down on some FAQ stuff.
With 4.9 out whats your timing on the JC release?
C
@MrMrC going to upload it today, then im afraid it is out of my hands. i have not tested it on stable yet but had it working well in preview, so hopefully no hitches!
Thanks for your help Staggerlee! The 4.8 Spawn Fix was the answer. Soon realized I’d completely forgotten I was running a dedicated server, works fine on single player without the fix! I had tried the quick fix of using the delay node previously, but without success. That was due to this happening for me on 4.8.3 with copy/paste of the RPC Graph:
Had to manual enter in each interface event node.
Thought i’d point it out just in case someone else comes across the same problem.
Correct! You need to be careful with copy and pasting blueprints in general. Glad you got it working **TriviusAkakous **!
New tutorial showing changes to 4.9
So is a new implementation video for 4.9, written tutorial on the way!
The idea was to make the system more streamlined. Mostly it works just like it did before.
I will be going over all the old documentation and updating it, so stand by.
Hey thanks for the update and the tutorial.
The updates involves only how we setup the inventory on a new pawn or you are including new functionalities / bugs fixing? in other words, Do you recommend us to update our projects ?(which already could have the inventory working)
thanks
@Staggerlee - That looks great - very straight forward process
4.9 update
@Alexarg I would not recommend replacing JcInventory with this version if your project is well underway, existing jcinventory projects upgrades very easily to Unreal Engine 4.9 and this update is mostly examples and helpers (in fact there was no issue that i could think of, a few null pointers needed a IsValid gate and that was it).
if blueprint was easier to replace i would say go ahead- as this update does provide some nice additional features, but the nature of blueprint makes it a real pain. In the end its up to you, download it and have a look! You could always use the extra copy as a learning template.
Changelog for 4.9
- Added Third person pawn example
- Cleaned up first person code to make it easier to learn from
- Added custom depth rendering to itemscourtesy Tom Looman
- Spawn pawn bug fix
- Added in ‘Charges’ as seen
- Added in examples for giving a gun ammo in its chamber, then reload takes up one ‘Ammo’ item.
- Added a controller component for JCInventory that helps with some of the lifting, seen
- Removed JcInventoryHUD, put it in new object RPCComponent
- Removed the need to add the RPC Graph to your pawn, its all included in the RPCComponent.
- Added in ‘Get class defaults’ instead of needed to spawn the item to get its item data where possible.
- Added in new attribute ‘UniqueChargesName’ to name what the Charges of the ammo is called, for example- the 30 charges in a gun could be called ‘30 bullets’.
- Added UniqueName attibute ability to make items of the same class be customizable. Example the ‘Sword of sharpness + 1’ on a sword class
- Changed the way bags work to be a lot less convoluted and easyer to set up (no longer uses BAGbag name as a Tag, uses the UniqueName string value instead.)
If your curious, check it out in a new project. If your using source control you could always just try pasting the new JcInventory files over the old ones, but i wont be able to provide support for that and it will most likely cause issues. I wish blueprints where easier to update but there’s no unreal solution yet so in the meantime we must all suffer :eek:.
If anyone has any major issues updating there existing project to 4.9 please post it so we can help one another.
Now we just have to wait for the 1-2 week deployment process :). Jokes aside StaggerLee did they get you any ETA?