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 ?

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

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 ?

http://i.imgur.com/05535EJ.png

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.

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

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

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

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

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

hi,

i tried this:

http://i.imgur.com/F5MZCTe.png

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.

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?

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).

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 :frowning:

soldier:

http://i.imgur.com/fbPjpSA.png

playerstate:

http://i.imgur.com/pzeyARs.png

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

Sure, for example I have “ready” variable in my playerstate.
First the client clicks on the ready button :

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 :

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.

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

Could you tell me which pictures are from what.

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

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

dannyk90@hotmail.co.uk

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

thank you :smiley: