Need help casting to an actor from the player

Im trying to change a floats value (the damage) of an actor from the player but i don’t know which component to attach to the “Object” Node


Anything helps and thanks in advance

You have to pass the cast fonction a unique reference to the objet you want to interact with.
Here, it seems you want to change a light parameter. But imagine you have 10 or 15 light in your game, how do this cast fonction know exactly which one to modify ?
You can get the reference by a line trace for exemple.

There is tons of exemple on the forum.

1 Like

oh sorry, no, im not changing a light parameter, thats just the name of the projectile that im trying to change the float value of but thanks for the info tho

Also is it okay for you to tell me how to do this specifically, thanks in advance

  • how do you know which Light Shot you’d like to interact with?
  • where is it?
  • what is it?
  • how are you interacting with it?
  • how does the player character know which (target) object you even mean?
  • are we looking at it?
  • are we touching it?
  • are we clicking on it?
  • perhaps there’s only one and it’s always selected/chosen?

Casting is never the problem. Obtaining a desired reference is - and this part is very circumstantial and can be done in a lot of ways. So what’s going on in this scenario?

Im trying to change a floats value (the damage) of an actor

There’s probably 100s of actors in your scene. You must tell the editor which object you want.

I think you should read more documentation / look for some more tuto because it’s basic fonctions here, you should understand how it works instead of having someone show you how to do it in this case, because you will have to use this a lot in any project

thanks, will do

thanks, noted