Download

Struggling to access stats of item for use when chopping wood

Hello Everyone,

I have created a data table that holds several different values and tied it to a parent actor called BP_Item. I have two separate items (that serve as the children to BP_Item) at the moment that I am using called BP_Axe and BP_IronAxe. Depending on the key pressed, it will spawn the actor of the respective item and I have a print string to display out the statistics associated to that item. All of this is working successfully without an issue.

As part of an action (left clicking on a tree with an axe equipped), I have it playing an animation montage and applying damage to the tree. When hardcoding ‘damage to object’, this works without a problem. However, I want to use variables it to read the damage associated to the weapon I am equipping at the time. Whenever doing this, unfortunately, I am getting a failed casting at best or outright freezing on my game if I try a different method to try and access the item. I had thought about potentially promoting the actor directly to a variable, but I am worried that would then mean I need to deal with it being stored as “BP_Axe” vs “BP_IronAxe” rather than “BP_Item” with some other information to tell it which one to point to.

Attached is the method by which I was trying to call/cast the item. As well as what I am doing in the first place to create the item and attach it to my characters right hand.

Any thoughts on what I may be messing up on?

Thanks,
Scyclone

Noticed something on the screen shot above, I did correct the Set issue on the 2nd image, but it made no difference for the issue I was running into.

Finally figured it out, I removed out the parent actor (even tho the intellisense wouldn’t let it go to actor by default) and changed the variable to an actor. Then once connected up like that and casted to BP_Item it seemed to pull in the stats.