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"

where should i store my money variable (so each player has their own)

okay so storing it on my hud widget doesnt work.

if i stored it on gamestate - everyone would share the money. I want everyone to have their own money..

so If i store it on the person's character that would mean they can easily hack the money with cheat engine or something ?

Product Version: UE 4.8
more ▼

asked Jul 06 '15 at 01:59 PM in Blueprint Scripting

avatar image

250 35 36 51

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

1 answer: sort voted first

Make your own playerstate and store it there. It is automatically replicated and linked to the controller :)

more ▼

answered Jul 06 '15 at 02:04 PM

avatar image

311 22 16 39

avatar image Dannyk90 Jul 06 '15 at 02:13 PM

thank you but when I come to bind the money, i can not find "player state" ... you know like before I can find "game state"

like my picture... i can find my playerstate but its not the same, what should go on the end there ? alt text

avatar image rXp Jul 06 '15 at 02:18 PM

Did you create your own blueprint or c++ class extending the Playerstate? If yes you can set it as the default playerstate in the PlayerController blueprint (default param). I am not in front of the computer so I am not 100% sure of the place. It is either in the PlayerController or in the Game Mode.

avatar image Dannyk90 Jul 06 '15 at 02:21 PM

yes i have set my custom playerstate to be used as the game's playerstate

avatar image rXp Jul 06 '15 at 02:22 PM

Good then get the PlayerController (like you do for the game state) and then from it get player state

avatar image Dannyk90 Jul 06 '15 at 02:33 PM

ah ofcourse, player controller attaches to player state it works :D thank u for confirming it to me :)

avatar image Dannyk90 Jul 06 '15 at 02:47 PM

okay problem, it is only changing on the server window, not the client, although it is set to replicate.

avatar image rXp Jul 06 '15 at 03:09 PM

If you modify it on the authority it should replicate correctly if you wet the variable to replicate.

avatar image Dannyk90 Jul 06 '15 at 04:29 PM


i tried this: alt text

It changes nothing, if I set it to Remote only, it will keep increasing my money really fast without stopping!

If it is Auth only it changes nothing either.

avatar image rXp Jul 06 '15 at 04:35 PM

You walk on the money, the client gets the collision event then you call an event on the server only. The server checks the collision, updates the money and callback the client.

Is it what you do?

avatar image Dannyk90 Jul 06 '15 at 04:37 PM

I did that now, but now both client and server's money goes up really fast without stopping ;o

oh lol i forgot to add kill actor but i put kill actor on now and its back to only the server going up normally :(

soldier: alt text

playerstate: alt text

avatar image rXp Jul 06 '15 at 04:40 PM

On the client you should not update the money. In the event that runs on the server you update the money for the correct controller not the controller 0. You need a way to get the correct one (transfert or id).

avatar image Dannyk90 Jul 06 '15 at 04:46 PM

im sorry i dont understand, do you have an example ?

avatar image rXp Jul 06 '15 at 04:59 PM

Sure, for example I have "ready" variable in my playerstate. First the client clicks on the ready button : alt text As you can see I am calling a controller event that will only be executed on the server and I give him my player ID.

Then the server will update the ready value as the client told him : alt text Here you see that with my player ID I get the correct player state. It is not necessary to do it this way because the event is already on a controller and when you call it you need to give the right controller. I am doing this for other reasons. You can also see that I callback the client.

To finish on the client side I tell my game to update the graphics now. You can also use a replicatedusing in C++ to have a function called when it is updated. alt text

In brief it goes : - Client X : That just happened to me - Server : Checked, Updated You can update the visuals now client X (or All clients with a multicast) - Client X : Update itself

avatar image Dannyk90 Jul 06 '15 at 05:15 PM

Could you tell me which pictures are from what.

Is it possible you could connect to my teamviewer :P ?

avatar image rXp Jul 06 '15 at 05:18 PM

Sure, give me your email and I will email you back. ^^

avatar image Dannyk90 Jul 06 '15 at 05:24 PM


or if you have steam or skype that will be nice!

avatar image Dannyk90 Jul 06 '15 at 06:02 PM

thank you :D

(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