Download

PrimalItem_Base Refrence

Hi,

PrimalItem_Base Reference

So, this works in the Player Controller.

344f7893306d56c1554df815ffd478f23b3a6be6.png

It displays our server rules, when you hit the tick key; which is okay. However, I want to have this widget display the server rules when you use an item in inventory.
So I created a child of PrimalItem_Base, it has an “Event Blueprint Used”, cool.

I tested this event with a print, and it fires when I click my note in the inventory, and then click use; so I’m trying to make this work like a book in inventory, that displays the rules when you use it.

But, I can’t call “Add to Viewport” from it (the PrimalItem_Base), as it tells me the function does not exist; scoping?

I am somewhat new to UE4 and trying to grasp the scoping and referencing, I’m struggling.

Well, since the above works, I thought if I could use an event dispatcher on the Primalitem_Base child I created, and have it fire on the Player Controller this world work.

PROBLEM: I can not to seem to make the PrimalItem_Base child that I created communicate with any other blueprint. I selected the PrimalItem_Base class to create a child from, because it has the event I need (Event Blueprint Used – which fires when you click the “Use” button in the ARK inventory menu, with the item selected).

I have read over the UE4 documentation on Blue Print Communication, but it seems the problem is that from the Player Controller, I cannot get a reference to this item. The item is a child of PrimalItem_Base, like I said, and I put it into the default inventory, of the PrimalInventory1 component of the Pawn.

So, I can click on the “ServerRules” item in game, click the use button and have it say, print test; so it works.

What I cannot do is have it display a widget, or dispatch an event to do this for me in another blueprint, because I cannot get a reference to it. Casting works between some blueprints, but what would I cast to the PrimalItem_Base child that I created?

Help.

I believe you aren’t referencing the controller of the player who has pressed the button from your above example, because the script is firing in an item blueprint and not a player controller blueprint.

From your Owning Player blue node, drag and search for Get Owner Controller… so your white script chain should go Key ` → Get Owner Controller → Create ServerRules_C Widget → Add to Viewport. You’ll also need to link the Get Owner Controller and Create widget blue nodes together.

mvaleno, sorry for the ultra-noob question, but ultra-noob here… what’s the name of that first node you have there where you’re capturing a key press? I’ve seen it in a few screenshots but have been unable to find out its name when searching around the node listings in my blueprints.

It is an event: Event Blueprint Used, it is available from blueprints you child from the PrimalItem_Base blueprint. Basically, I just keep looking until I found it. So, if you base an item on it, then place it in inventory, when you select it, then press “USE ITEM” button on the main ARK Inventory screen, it will fire that event.

So, you can make a item “do something” when you click the “USE ITEM” button. Problem is that I am having a really hard time getting a reference to the Player that owns the item…

Hey Jason,

Thanks for responding… I tried as you suggested:
Widget1.png

As you can see it wants a World Context Object, I don’t know how to get it one.

Haven’t seen that error before… maybe trying dragging off the orange pin in “Event Blueprint Used”, toggling context-sensitive on and off … .and see if you can reference a valid object.

I am getting the exact same error as above when trying to create a widget from blueprint used. Did you find a solution?

when in the graph, right-click in and open area, make sure “context sensitive” is selected, type “self” there should be an option to get the self reference.
create a variable that is PrimalItem.
set that variable as the self object.
you can now use a Get of that PrimalItem then drag off and access the OwnerInventory from there you can then get the owner class, and hopefully create your widget.

Check out the SCUBA_Shirt_with_Tank class as a reference

PS sorry for the step by step at the top, it obviously looks like you know how to access items, but that was for anyone else that may stumble upon this thread.