Download

Why I can't cast/reference between actors?

I know this is might be a dumb question that have a solution (in order to the cast to work, the object must be inherited something), but neither referencing seems to work, so here is my problem

In my previous thread I’ve said that I was having a issue that collisions/triggers wouldn’t make the referenced/casted actor to do something, like moving to a position, unless I marked the Editable part on, and select the instance on the level, the solution was using the Spawn Actor and then use it with the SetActorLocation, but that’s not the method I need.

Since I’m making a save game BP, I need to make the actors to load in the positions they were saved.

What I’m missing at this point? I don’t even know exactly what kind of node would be the original parent from a normal actor, I do know for players.

You can cast/ref between actors but you need to have a variable or similar that represents the other one. If you have no idea yet what will be referenced during the game, then you could simply make an Actor variable in the blueprint, and during the game you define this variable to contain the reference to the object you want to reference. So you define the variable only during gameplay, and from there on out you can cast it and do whatever else you want.

Heyo Hourences, are you saying some kind of a variable “inception”? Such as opening something like CrateBP, creating an variable referencing itself, then on the TriggerBox BP, reference or cast the CrateBP itself, but then get the CrateBP variable from inside?

Or something like a reference to TriggerBoxBP at the CrateBP, and a referente to CrateBP to TriggerBox BP?

Didn’t follow the crate example. But if you need BP1 to get access to BP2 or some other Instanced Actors etc…
Create a new variable ‘RemoteRef’ in BP1 of type Actor. When BP2 has access to BP1 it sets Self to RemoteRef.
Then BP1 can access BP2 at any time afterwards. But you can also try Get-Actors-Of-Class and other tricks etc.

Got confused on that

is BP1 the TriggerBox and BP2 the Crate or some sort of object that is going to move altered after I overlap through the TriggerBox?

Yes BP1 Triggerbox, BP2 the crate etc. But If you don’t have blueprints for all of these or its too much of a leap right now, then Get-All-Actors-Of-Class, might get you there easier. Also if there’s an Overlap event you should get a Crate Hit-Actor object too, which could be useful.

Would it be something like this?

b2442f2e73bf194a1c0a03a590ebe44507df6bc5.png

a0021d9483c539b0f5e6c0b051be6cbc7a58165e.png

Yep, that’s it… Its just one way to access variables / actors inside other actors / blueprints etc.
Now what’s the overall goal or gist of what you’re trying to do as the first post is pretty vague.

In the BP if Actorbox overlaps with a Triggerbox it will destroy whatever Remote Ref points to.
But what is RemoteRef, or what should it point to, as right now that’s not clear (set to none).

If you only need to destroy ActorBox then just Destroy it as Overlap event already gives you ref.

I want the triggerbox to destroy the Actorbox when the player overlaps it.

Hey @franktech, get all actors works fine, just found it too in the U4 documentation (google et all wasn’t helping untill i decided to search as between blueprints actors)

336bfac7c9fc48b9ed2ebda42cc5c3bdf6929446.jpeg

Weird, but also it also makes sense, getting by the array would get every instance on the level, but makes me wonder why not referencing would work.