Replicated Skin Transition [TutTut]

I wanted to make a skin that would fade into an alternative to now have it blink into the change, thought I’d post the sample project i created so others might learn the replication aspect.

We first want to create the material as a single Material using two material functions.

Base Material Function:

Tagged Material Function:

Final Material Using the Two Functions Driven by a Parameter:

Next we will create a Blue Print Interface to add to our character to make it easier to call a function
Note we have added a single function with nothing special besides ‘CallInteract’

No we will open the character blue print, go to default classes and add this interface to it.

Now we need to string up some variable and add our logic.

  1. We are also going to on BeginPlay Create our material instance and set it to our base material and promote to var to create reference to it for later called SkinInstance
  2. We will need a Bool using an On_Rep Function, this will come in later to drive an event when this value changes.

Now Lets Create the MultiCast event that will eventually be called by server to notify clients to run the logic to change the skin alpha. This is then applied to the value of the SkinInstance

  1. We drive the Skin Instance to update the Alpha with a Timeline
  2. Note the timeline is a simple 0-1 on a curve.

Now we create the way the multicast will be called - as a Multicast must be called by Server we will create a simple Run on Server Event SV_ is how i prefix them

Now Lets place the SV Called event in the On_Rep this way the branch will forward or reversed based on the Bool whenever this value tagged is changed

Now we want to call the MC event on begin play to ensure the value is checked for anyone joining game in progress it will update

Now we are Ready to implement that interface we will simply toggle it to test

Now lets Create a Line Trace that will call the Interface on the Pawn that it contacts with.

First we want to call a SV server side line trace and logic so the server does the checking and calls the value.
So we only need the button to call a server event that will then if hitting a pawn, call its interface.
The previously implemented interface will change the value and the on rep will end up calling a multicast to tell everyone to update the character skin fade

And when we trace to the character we get the skin change…68da0a640f.gif

Sometimes the world is funny - I have to create a more or less similar effect: In my GTA2-Remake (see link in my signature) each car is randomizing its color upon spawning to get a more interesting look. But of course these color changes should be synchronized to all players. I was just starting to wonder how to achieve that and… voila… there is your tutorial :smiley: That definitely spares me time for trying around a lot!

Thanks a lot, highly appreciated :wink: