How to possess another actor
I have a button, which is an actor with an "event interact" I followed the answer here:
But I can't get the reference to the other actor. The actor is just a duplicate of the main actor which is used for the FPS first person character. This idea as far as i understand, it gets the player array , casts it to a controller and then posesses the pawn which is the other actor? My goal is that when i interact with the button actor, that it switches to another actor.
asked Apr 04 '19 at 10:12 AM in Blueprint Scripting
The anwser the person there gave you use level blueprint which is not really recommended and reason why you can get reference.
You need actor reference by other means, if you spawn actor dynamically, spawn node returns reference to actor, keep it and use it to posses, if you have actor already on the level make actor register yourself to actor of that blueprint you showing, all server side.
The answer from other question also ignores a lot simpler possibility of using material parameters:
You give your character a player ID, for example make variable, make it expose on instance, place actor on level and set the variable in property editor after you select the actor. Now in blueprint in construction script you would set material parameter to change the color. Use whatever you use to determent which player actor is. Remember this need to be client side and in client you dont have access to otherp layers player controlers and game mode, use either player state or set it preemptively via construction script.
answered Apr 04 '19 at 11:28 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here