Spawn actor from class with no owner?

Hi all,

I’m making my loot system. What happens is, Enemy HP get to 0 → Spawn Loot, add exp etc. → Destroy enemy.

The problem I’m having is that when I use spawn actor from class it sets the player as the owner automatically and so it won’t let me interact with the spawned item, and the text that should float above the item on the floor, is actually floating attached to the player.

If I drag a copy of the item out from my content browser it has player set as none and everything works fine. But when I spawn it through the afore mentioned way it sets the player as PlayerCharacter (my player).

I’m assuming this is the problem so is there a better way to spawn with out the owner?

Thank you,

Rich

So I made up a quick spawn loot on death custom event as seen in the pic below…

When the SpawnLootOnDeath event is called I used the spawn actor from class node, and spawn an actor named treasure. I set the transform as the current actor who is spawning the treasure actor. The owner of the spawned treasure is left unset. Once the treasure actor is spawned using a set owner node, with nothing attached to the new owner pin, the owner of the treasure will be empty, or null, or nothing. Which I didn’t really have to do since when the treasure actor was spawned there wasn’t an owner set then.

As for the floating text, I’m not sure what you are doing there, but if the owner of the spawned loot you created is the player and you don’t want it to be, you could add a set owner node after spawning the loot actor and do as I did and leave it blank?

Anywho, Good Luck, hope I helped some, and not confused you.

~

Hi, thanks for the answer, sadly didn’t fix the problem. Even setting the new owner to nothing it sets the Player Character as the owner. Though going back and trying adding one to the level myself seems to do the same thing. So possibly its something I changed. I will have a play around and see what I can come up with.

The text is just a widget that should be placed above the item looking at the screen.

Thanks

After spawning iwagold, maybe check to see what does own it? Off of the return value do a get owner, then a print string from that to tell you who or what the owner is.

If it doesnt print anything then there isnt an owner, if it does then you will know for sure. Then you could change the owner to something else?

Just some suggestions, Im by no means an expert. Barely a novice with UE4 really.

~

Sorry for late reply, I can see what owns it, but I can’t remove the owner. Though I’m having mixed issues, I think it might not even matter and is possibly a collision problem.

I’ll come back to it later.

Thanks.

Hi ether, do this: when your enemy pawn goes to 0hp, the enemy pawn send a confirmation to the server that he has been destroyed by this (player) and that the server should spawn loot for him. when the server hear that, the server spawn the loot that the player that destroyed the enemy owns.easiest way to do this is to have a actor that is always in the game that recieves information and store information or just act as a middle hand. you could also try spawning the loot from the players owned pawn aswell, so when the player destroy the enemy pawn, the pawn uses a hitbox to read who destoyed him and then checks a bool for the player to spawn loot. i know its a very late answer and you may have solved it. but posted it here for others that have the same problem.