Reading exposed aribles in actors on line trace?

how do i use a line trace to read a actor’s varible which is set to exposed on spawn
[there will be multiple instances of said actor]

(this is for my weapons system)

The trace should return the actor, cast it to whatever class it is and read it’s variables… need more help ?

1 Like

there will be multiple classes of actors, and i really don’t want to scan for each type, just make sure they’re something. maybe i should make a simple parent bp or something?

You could have them with the same interface and only check for that rather than multiple casts. If they do, have that function executed to send bsck sends the data you need.

1 Like

well,it doesn’t really matter what the actor is, it just could read the weapon name and check from a data table.
is there a way to do this procedurally. [ex: i give a text input and it uses a switch on to find the weapons properties?]

i don’t really know what i’m doing

really,since there will be multiple guns and multiple users, i need to get that particular gun and despawn it, then spawn and attatch it’s mesh onto the player that picked it up

iteratively… yes.

If you do not want to set up an interface, you could read the actor’s tag and feed it to the DT. Why you’d want to do this this way - no clue.

i don’t really know what i’m doing

If you don’t know what is going on, I surely do not need to. :wink: So there’s the solution. Quite a hack.


But perhaps your data is just a cast away:


Or set up the interface.

1 Like

bool isStressed { true };

while ( isStressed ) {
breathe();
}

Infinite Loop much?

Until it crashes.

or untill the program is put on sleep mode

well i don’t have a bp set up really, so it can be made however it needs to be. on the player side, a single varible controlls all the properties, so all i need to do is decide how to set that data

what’s a interface and how do i set this up?

I will be your Googling specialist today…

https://forums.unrealengine.com/search?q=@everynone%20interface

And half a thousand results on YT…

1 Like

remind me to get a googling specialist lol

… if you stop responding we know what happened.
Lack of breathing during sleep ought to do it.

The interface is literally the best way for what you are asking.

The intent is to obtain a value from the actor.
The interface can do that - and a lot more.

If like you said you have no idea what you are doing.
Open the Learn tab from the website and take the Game oriented courses.
They cover pretty much the basics like interfaces, soft references, etc.

It’s not the best content out there, but it is free and readily accessible…

1 Like