Replicating animations to server and all clients

Hi, I’m currently playing around with multiplayer in UE4 but have run in to an issue and I’m not sure why it’s not working as it should.
So I’ve got a video showing the issue with the server on the left and the client on the right.

The first section of the video shows the server and the client equipping the weapon. You can see this from the weapon moving from the belt to the hand. So the left screen equips the weapon and it happens on both screens. The right screen equips the weapon and it happens on both screens.

The second section shows (at about 0.36) shows both the left and the right screens activating the weapon but it doesn’t show on the other screen.

https://www./watch?v=PKtuR1nWOik

Here is the blueprint for equipping the weapon:

Here is the blueprint for activating the weapon:

As you can see they are both the same. I have tired executing the LMousePress_Client event as “multicast” and “run on owning client”.
When it’s set as “run on owning client” it only shows on the screen that activated it.
When it’s set as “multicast” it shows both on the left server screen.

Why isn’t this working? Am I missing something obvious or going about this the wrong way?

Thanks

OK I found out that I have set it up correctly. The problem was a bool that I didn’t include in my previous post.
Here is the BP for activating the weapon with the Problem causing bool:

The bool is right as the end of the script. If I remove that bool the animation works as it should.
I think its because a branch checks to see if the “Blade Active” bool is true or false and if its false it sets it to true all in the same sequence.

The problem I’m faced with now is getting that bool set to true after the animations played.

Any one have any ideas?

Thanks

AnimNotifies are your friend, should be pretty easy, failing that as a placeholder you could put a timed delay node and just set it after that.

Yeah its an annoying issue with replicating variables especially bools, across the network sometimes they are set true and false in the same frame or packet being sent effectivly cancelling each other out so sometimes nothing will happen other times you might get some animations playing but not others. I had this problem with a combo system using a switch on int and bools where it should have played 3 different attack animations one after the other but on the server and owning client everything was fine on the other clients the animations.would just randomly jerk and switch around.

Like suggested above you just have to find workarounds like using anim notifies, delay nodes timers etc if its only switching between 2 animations you can use a flip flop, a do once or sometimes a sequence but its all just a case of trial and error .

Unless im wrong and other people have a fix or solution ?? i will be interested to watch this thread and see the responces

Is LS_Equipped bool set via server-multicast event? or is it being set on the client only? post a screenshot of where you’re setting that bool. You could try moving the LSEquipped branch or even both checks outside the MC event. Put it immediately after the Left Mouse Button pressed, before the LMouse Press Server event.

Hi guys, Thanks for getting back to me. Only just got in from work so I have had a chance to reply. The delay seams to have worked in this instance but I’m worried if ping or other factors could affect this? I’ve previously tried using Anim Notifies to to fire off traces at specific points in an animation but I couldn’t get my head around it so I ended up using delays in between traces.

Here is the rest of the Equip section.

So when F is pressed the weapon is equipped or unequipped via a FlipFlop.
FlipFlop “A” attaches the weapon to the to the right hand socket, Sets the LS_Equipped bool (which is replicated) to true and then changes the anim Blueprint to the appropriate one.
FlipFlop “B” checks to see Blade_Active bool (which is replicated), If true stops a sound and If false it skips stopping the sound. It then attaches the weapon to the belt and sets the LS_Equipped bool to false, Plays the blade deactivate animation, Then sets the Blade_Active bool to false and then changes the anim Blueprint to the appropriate one.

I’m just attempting to set the LS_Equiped branch to run right after the mouse click instead of using the delay.

This is my first try setting up a multiplayer game so I don’t fully understand it. Also I’ve just noticed Iv’e misspelled Equipped in my BP.

I’ll let you know how it goes but if I’m not going about this the correct way then let me knowww!

Thanks

So adding the branch right after the mouse click does not fix the issue. It looks like I’m stuck with using short delays. Unless someone would like to talk me through anim notifies?

Thanks!

AnimNotifies are really easy - basically just right click on the bar that appears above the timeline but below the animation preview window, and it will let you make a new one, give it a name, then you can go into your AnimBP and it will appear as an event. The event will fire when the animation hits the point on the bar where the AnimNotify notch is at.

ahhh so I can set the bool as true or false in the anim BP instead of the character BP and not have the delay?

Thanks

Also I’m guessing this is why I was unable to use anim notifies before. I was trying to find them in the character bp and not the anim bp.