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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Replicating/Updating variables in player state

Hi guys, I seem to have got into a bit of a predicament. I store main player stats in my player state (to prevent client hacking on my mp game). I have some stats working such as the players level, I have a debug function that runs on the server when I press "E" and this shows the payers in the server with their level and attack damage. Levels show up fine each player has their own, but the attack doesn't show up for the client it stays as "0" whereas it updates for the server player.

alt text

This is the talent tree widget that the client uses to select the talent attack increase. Top left shows the client printing the attack is "10"

alt text

Here I have used the debug function on the server (client is player ending in 564D) as you can see both are still 0

alt text

Here the server uses the talent widget and selects the attack talent point

alt text

This shows the debug and shows the server character with the attack increase

So obviously the clients variable isn't replicating and only setting it on the client itself.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 27 '16 at 06:53 PM in Blueprint Scripting

avatar image

Scottc91
139 18 19 26

avatar image Scottc91 Jan 27 '16 at 07:01 PM

alt text

This shows the blueprint when a talent point is selected and inputs 10 to the attack increase function

alt text

This is the attack increase function.

alt text

I use the attack variable in my character blueprint and add it to the weapon damage, which equals the total damage caused by you.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Solved it

alt text

As you can see levels are different and both the server and client have selected the attack talent and works fine :)

I basically added a custom event in the player state that runs on the server so the server knows to change the variable. After that it worked fine, I then realised the characters damage wasn't updating, so looking at my character damage blueprint, I casted get player state from self instead of player controller and it worked :)

more ▼

answered Jan 27 '16 at 08:49 PM

avatar image

Scottc91
139 18 19 26

avatar image Dodgin May 28 '16 at 04:56 AM

Yep, all "truth" must be executed on the server. Thanks for posting your detailed solution

(comments are locked)
10|2000 characters needed characters left
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