Announcement

Collapse
No announcement yet.

Replicating Input Action with Overlapping Client?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replicating Input Action with Overlapping Client?

    Hey All, I've been banging my head against a wall for a couple days now trying to figure this one out. Hope someone here can help.

    Intent:
    In a MP environment have a button that a client or server can use that performs an action on an actor in the environment.

    What I've done:
    I've tried dumbing it down to the simplest form.

    -created a replicated blueprint actor called buildingtest
    -created a button with an overlap event and a replicated variable that allows me to place the buildingtest and button in the level and target the button to the buildingtest
    -created an input mapping for UseButton "F"
    -In the button's event graph, enabled input off the overlap event
    -In the button's event graph, created a custom event that runs on server to destroy the buildingtest that the button points to
    -In the button's event graph, call the destroybuilding custom event when the UseButton input action is executed

    Result:
    Server can use the button and destroy the building. Server and Client both see the building get destroyed
    Client CAN NOT destroy the building
    If client is overlapping the button, Server CAN DESTROY BUILDING even though the server isn't overlapping.

    Click image for larger version

Name:	rep_button.PNG
Views:	1
Size:	198.2 KB
ID:	1185236

    General thoughts:
    If I run a generic "hello" log off the UseButton input action, the client can use the button and spam Hello. (However the server can also spam when the client is ovelapping)
    If I call the destroy building custom event after the enable input node, the client will destroy the building when they overlap the button
    It feels like I need to somehow define the overlapping player, (perhaps cast to the player character from the overlap and enable the input there?) but I've been unable to find any reference/tutorial that sheds any light on this.

    Any help would be greatly appreciated.

    #2
    I did something similar with lifts in house, with good results.
    On component begin overlap - drag "other actor", cast it to your created player controller and in player controller create function for destroying house

    Comment


      #3
      thanks for the reply.

      In your approach, how/where do you enable input? How do you designate which version of the BP actor to destroy? My hope is that I can have a single button BP and a single building BP. That way I can place multiple buttons and buildings and assign them in the level editor.

      Comment

      Working...
      X