#Lecture (38) - AuraEffectActor is not working for clients (Fixed)

1 messages · Page 1 of 1 (latest)

velvet fjord
#

Hey folks, I would like to confirm with someone that is in an advanced step in the course if the aura effect is also working for clients. I took a look into the code from github and just looking to the CPP files look like it wasn't fixed.

As far as I know, and I learned it in the multiplayer shooter course, overlaping should only happen in the server and for Aura, each potion has a overlap component configured directly in the BP.

My thougts about it is:

  • The overlap works on the client (confirmed by drawing debug lines and print messages)
  • Client calls "Apply effect"
  • Communication does not work for the following reasons (I may be wrong here):
    • Actor is not replicated
    • Or server is blocking the attribute to be updated since it came from the client -> server and not the opposite (I think this is the reason)

The solution, at least what I can think, is something like:

  • Only configure the overlap callback IF running as Authority()
  • Store a replicated variable in the character to store the last replicated actor
  • Do the action of consuming the potion in the server right away
  • Do the action of consuming the potion when it get's replicated in the client

Is this correct? Does it make sense? I would like to know if it get fixed in further steps or if it's something we need to fix now.

I went until half of the course few months ago and I don't remember it getting fixed

velvet fjord
#

Lecture (38) - AuraEffectActor is not working for clients (Fixed)

#

The problem was just a mistake in my side. The way I solved it was debugging everything single step. After some hours, I noticed that the attributeSet was not getting replicated, even when the effect was getting applied.

How I know when an effect is applied?

Well, you can use the following code from EffectAtor

FActiveGameplayEffectHandle ActiveGE = TargetASC->ApplyGameplayEffectSpectToSelf....
ActiveGE.WasSuccessfullyAppplied() 

It was always returning true and even tho, the health didn't get updated, so I added some debugs in the Rep Notifier and it was not getting called. After more hours, I noticed that my attribute was configured like this

UPROPERTY(Replicaded = OnRep_Health)
FAttrib... Health

Well, that's the bug. For rep notifiers works, you have to use the ReplicatedUsing = . When I changed, everything worked.