Casting problem

Can anyone help me out with a casting problem I’ve been having recently?

So I’ve been trying to make a balloon object that when destroyed would spawn a number of collectible items throughout the area.

In order to accomplish , I decided to use a modified version of my ‘Hidden Balloon’ setup, wherein I created a invisible box that when the player came into contact with it would spawn a balloon at the same location as the invisible box and delete the box.

The idea was that when the balloon was popped, it would send a command to various invisible ‘spawn point’ boxes throughout the area to spawn the desired item pickup at the spawn points’ location and delete the spawn point afterward. The problem though is that I can’t get the balloon to communicate with the spawn points as I cannot find the proper object for the casting node to connect to. I tried ‘Get Owner’ but it doesn’t work and none of the various other things I tried to hook to the casting node have worked either.

Does anyone have any ideas as to what I’m suppose to do here?

Balloon destruction blueprint:

‘Spawn Item’ function:

Item spawn point blueprint:

Moogle

You’re suffering from the misconception that 90% of new UE user have. I think there must be a convincing Youtube video somewhere, which incidentally, is totally wrong.

Casting is NOT used to communicate with other blueprints, casting is to change the class of an object, WHEN, the class you’re casting to inherits from the parent class.

If you have a reference to the object / actor that contains the function you want to run, you don’t need to cast.

To get a reference to an object, you either have to manually set it in the editor ( the object is aleady in the level ), or use something like GetAllActorsOfClass and figure out which one you want to talk to ( the actor is spawned in the leve ).

You also have a bit of a problem with your DestroyActor nodes. Once that node runs, the actor is, err…, destroyed. So it can’t run any nodes after that… :wink:

4 Likes

You need to plug in what object to cast to.

Yeah, it seems many people see casting as the magical “get me the object I want” node… I don’t know where that comes from.

I think there’s a number of people out there in youtube land who are responsible…

1 Like

I disagree. Once that node runs, the actor starts pending kill. It can take a few frames for the object to truly go away.

But, I do still recommend to put the DestroyActor node last – just because it looks better.

Yes, naturally, it can take a while, but going in that direction is nuts…

:rofl: :relaxed:

@HungryMoogle

The idea was that when the balloon was popped, it would send a command to various invisible ‘spawn point’ boxes throughout the area to spawn the desired item pickup at the spawn points’ location and delete the spawn point afterward. The problem though is that I can’t get the balloon to communicate with the spawn points as I cannot find the proper object for the casting node to connect to.

is actually a solid idea that does not require casting. Lets say the Spawn Point boxes are Triggers Boxes that come with the engine, you then could:

In case make little sense, do tell what the Spawn Points are in scenario.