x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Clients can't request to delete actor?

So I am trying to have an actor destroy when someone presses the interact key.

So on pressing interact, a trace for objects will be called. If the object can be destroyed, then it will call "DestroyHitActor". alt text

This should destroy the actor hit by the trace... alt text (Note that Actor to Destroy should be conneted to the destroy actor function.)

Problem is that the server will not allow the client to "Call DestroyHitActor".

Sorry if this is a dumb question, I'm pretty new at this.

Also, is it normal that when I have two players in a game, one is acting as a server? How can I make them both act as a client?

Product Version: UE 4.8
Tags:
more ▼

asked Sep 06 '15 at 05:56 PM in Blueprint Scripting

avatar image

NightHawk45
135 12 8 21

avatar image NightHawk45 Sep 06 '15 at 11:27 PM

Maybe I can make this easier to answer if I state what I want to happen.

When a client presses the interact key, a trace function will be called, and if the trace hits an actor in the "Pickup" group, then that actor will be destroyed.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Hey there!

What you're running into here is a client/server replication issue - you'll need to tell the server to delete the actor for you in a multiplayer game. I'd suggest reading these to get your feet wet: https://www.unrealengine.com/blog/crash-course-in-blueprints-replication https://docs.unrealengine.com/latest/INT/Gameplay/index.html (Scroll down to the sections on replication near the bottom)

As for the second part of your question, the default behavior for UE4 is to have one instance as a listen server and the rest as connected clients.You can override this by expanding the advanced play options (the small triangle near the play button) and ticking "Dedicated Server".

more ▼

answered Sep 06 '15 at 06:08 PM

avatar image

Jargon
808 39 30 67

avatar image NightHawk45 Sep 06 '15 at 06:53 PM

So I looked over that, and didn't really find anything that I didn't already know. I looked around a little more, and this is all I could find that maybe would fix the problem.

This is my level blueprint. alt text It didn't work...

When you say "you'll need to tell the server to delete the actor for you in a multiplayer game" what do you mean? Is that not what I am doing here? What I'm getting out of it is that the server is just refusing to delete the actor.

screenshot (6).png (131.3 kB)
avatar image Jargon Sep 06 '15 at 06:57 PM

Truth be told, I'm not very good with replication. I know where the issue is, but fixing it is a whole other can of worms.

Does the actor disappear on any of the clients, or does simply nothing at all happen? Additionally, could you try adding a breakpoint right before your DestroyActor to see if the execution ever reaches that node?

avatar image NightHawk45 Sep 06 '15 at 07:17 PM

When the client calls the function: I placed a print string node at the beginning of the function to see if it was ever being called on the server. It appears that the client is calling the function, but the server isn't doing anything.

The "CheckForPickup" function is being called, but nothing else happens. The actor isn't destroyed on the client or server.

When the server calls the function: The function works as expected.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I wonder if this might be a problem with the event delegate. I haven't completely grasped how replication works yet, but I know that the delegate will only fire on actors to which it is registered. You could add a Print node between the Event and the actual Destroy Actor call to see whether the event even reaches the client.

Add two more Print nodes after your cast (success/failed) to verify that the following two assumptions are actually correct:

  • Does Get Player Character return a valid First Person Character for both client and server? (maybe the client characters are created later)

  • Are the returned characters different? (maybe the first index is always the server's character)

more ▼

answered Sep 06 '15 at 09:16 PM

avatar image

erinacea
1.8k 69 28 113

avatar image NightHawk45 Sep 06 '15 at 10:25 PM

I put a print string node in at the beginning of the function and nothing happened. Its almost as if the server is completely ignoring the client.

I think I have the basics of replication down, but to my knowledge, this isn't a problem with replication. When the client calls the event, the event is neither occurring on the server or client.

I cant really answer your other two questions, because it doesn't appear that the event is ever being executed in the first place.

I really can't grasp what the issue could be here. I've tried everything I can possibly think of, but the client just refuses to ask the server to delete the actor.

When the server character calls the destroy event, everything works as planned.

avatar image erinacea Sep 07 '15 at 06:52 AM

I meant output the Get Player Character result in the BeginPlay event when you're registering the delegate. I suspect that your DestroyHitActor event only gets registered on the server and I'm trying to find out why.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I am having a similar issue with a door I have created. I have it so that the door can be opened and closed by the server, visually showing the door open and close to all clients connected, and the clients connected can walk through it, etc. But the server has to do all of the interaction. I can't seem to make it so that clients can trigger the door, send that information to the server and have the server replicate the data to all clients.

Where I am having a hard time is having my collision box read when the client is hitting the F key... It knows when the server does...

more ▼

answered Jan 27 '16 at 11:57 PM

avatar image

samohickey
1 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question