Download

Actor drop with inventory structure and mesh

why when I add an item actor class to the class does the actor spawn lose the item data input?

I am trying to drop an item with the items inventory structure information, but i can seem to figure out how to drop it using a specific actor?

why cant I override the item class without losing the item data pin input?

when i link the class to the item mesh variable it spawn the correct mesh but with default structure data, but when i disconnect the mesh and connect the item data it spawns with correct data but wrong mesh?

do I have to make a check before to see which actor class I want to drop and do a spawn based on teh branch check?

Seems like overkill if I have 100+ different items?

I could make a function for the checks but thats a lot of checks…

What class type is the Item Mesh variable? If you want to be able to set the Item Data at spawn, then the actor class you connect to the Spawn node would have to be of type Item Drop.

The class type I am using is an Actor Class. That is set in the inventory structure file. I added the structure file to each item inside a variable i named** Item Data**. “Item Drop” currently in the class for the spawn is the actor I was using temporarily just to spawn an object on the item drop.

Each drop will be a different item mesh based on the items drop down in their respective item actor file based on the inventory structure file.

I hope that makes sense lol i am new so i am limited to what the possibilties are still.

Alright, so what’s happening there is that Item Mesh variable is a class of type Actor. Since Actor is a base class provided with Unreal, it doesn’t have any Item Data variable in it. So when you try to use that (even if you have set its value to Stick) for spawning, the Spawn Actor node always treats it as an Actor. Hence the reason why you lose the Item Data input when you connect Item Mesh.

So instead of setting the spawn class as an actor type, set it to a class that has the Item Data variable, like say your Item Drop class. Now if you want to set different meshes for each Item type, you can add a new variable of type Static Mesh object to your Item struct. Here you can tell it what mesh to use. With this information, you can set this new mesh as the static mesh for the Item Drop in its construction script as shown below.

Thank you this is valuable information! I’m a little unsure on where I would implement that?
So if I understand correctly, I am setting the mesh to use on the “item class” where the “item data” resides? and I am setting it inside the actor itself?

So instead of using the item mesh variable I can still use the item class still and it will come with the items info attached?

Do I make a new inventory variable for each object mesh i would use? Like one for sword, one for shield one for a food item etc etc?

I think I got it working!!!

You really helped me!!! I knew I was close but you helped me get it sorted out with the right logic!!! <3<3

yay!!! thank you!!!

https://iili.io/JgOgRa.gif

I just saw the notifications now. But glad to hear that you already figured it out. :slight_smile: