Widget variables in multiplayer
Hi There! I'm trying to do this: there is a multiplayer game, the user can choose one character from a list of 3 (i.e. mouse, cat, dog) in the lobby( when an user chooses one of them the others can't choose the same), so inside the player controller there is a variable( texture 2d type called Picture) and when the match starts the player controller assigns a specific and different "picture" to the owning player ( a picture of a cheese if it is a mouse, of a bone if it is the dog, of a ball of wool if it is the cat); well, for now no troubles, but for the next step i can't found a way, in the level there is an actor (a door) with a trigger volume, in the door's blueprint, when one character overlaps it, the doorBP gets the instigator controller and casts to the player controller and calls a custom event; in player controller the event enables input and when inputAction Leftmouse is pressed the character opens the door and set his Picture variable on another variable (called Marked) when inputAction RightMouse is pressed it creates a widget where the texture 2d of the variable Marked will be bind on an Image and add to viewport: the result will be that when the dog is in the trigger box he can press leftmouse to open the door and if he does it he marks it ( Marked variable will contain his Bone picture) if then the dog press the rightmouse he sees his Bone picture in the widget...and after if the cat enter in the trigger box and if the cat press rightmouse the cat( and only him) will be able to see the Bone pictures trought the widget's image binding by Marked variable... but i think or better i'm sure that player controller isn't the right and only place to do all these things...that' is the reason why i tried to do that using Player State, Game State etc in different ways but without succes...and now i'm very fused and confused and i need your help!!! How can i get the Marked variable from player controller and bind it in widget's image?
asked Aug 16 '18 at 11:03 PM in Blueprint Scripting
Ok, I understand now. What you can do is when you first create the widget in the playercontroller, save it as a variable so that when you press right click later you can set the marked variable from the widget reference. Then in the widget, you bind the image to your variable. Hope this is right!
Save as var
Bind image in widget to marked
answered Aug 17 '18 at 02:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here