Download

Destroy actor not working

I’m trying to set up when the player touches AND presses “F” key near a bot the bot gets destroyed. The destroy event does not seem to be working, not sure why.

Right now I don’t want any scripts on the level.

1fd5181ab2cac6c39d1716fdc2cdf8adf0bff9dd.jpeg

04f7b270b85ca5c51b1a89d3a2d09bad7743104f.jpeg

Thanks.

How are you getting the Reference to the Bot on the Player?

Your Bot Reference “Muncher Var” could be null.

Please post screenshots of how your getting the reference or make sure that your Reference is valid before calling a function on it.

I made a blue print from the thirdperson character. Then made a object reference variable to plug into destroy ture.

Do character object references not work for this ?

24a918802a63d01cc40502d3f36a9e2a89e4161f.jpeg

Thanks.

You have to set the variable to a specific instance of Munch Bot, are you doing that somewhere? Try printing the muncher var to see if it returns none. (use “Get Display Name” to make it a string if it doesn’t do it for you.)

Its not printing anything so it’s not set. How do I set it ?

You should read this: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintCommsUsage/index.html

But even if you set it I don’t think your blueprint is doing what you want. As it is, if F is pressed, and anything overlaps Player1, it will try to destroy whatever Muncher Var is set to. What you want to do is take the “other actor” output of the Begin Overlap event, check if it’s a muncher bot (cast to muncher bot), and if so, destroy it.

I got it! thank you