How to transfer the value of the variable from the server to the client?

Discussions about Coding and Scripting
Buggie
Godlike
Posts: 1921
Joined: Sat Mar 21, 2020 5:32 am

Re: How to transfer the value of the variable from the server to the client?

Post by Buggie »

ShaiHulud wrote: Wed Apr 28, 2021 8:44 pm I can't remember what this "problem" is, but I vaguely remember finding details about it somewhere at the time - probably in the Unreal Wiki
https://github.com/OldUnreal/UnrealTour ... issues/301
f7r wrote: Wed Apr 28, 2021 12:10 pm So... There is a mutator. It has config variables. It will spawn class (spawnnotify). I want to pass into client (and server maybe too) instance class the values of these variables. To use these values in the workflow of class spawn (if it posssible at all). How to do it right way?
- Make mutator replicable.
- Make two subset of fields. One for config, second for replication.
Possible better use structures for this, and only two fields.
- Write replicate rules for make replication of desired set of fields.
If data not changed at all you fine with bNetTemporary = True.
If not, you need open channel and bNetTemporary can not be used.

You need learn a lot of things, because it is not an simple question and many things depends from what you want.

If you ask simple question you can get answer, but nobody write full code for solve your problem.
User avatar
f7r
Experienced
Posts: 104
Joined: Mon Oct 19, 2020 6:53 pm

Re: How to transfer the value of the variable from the server to the client?

Post by f7r »

Buggie wrote: Wed Apr 28, 2021 6:04 am About where you can call your code on client:
Possible you need PostNetBeginPlay event.
On server it will be called during spawn with defaults but on client, possible, with replicated values. Need check it.
:tu:
Thank you again! Your truth, in PostNetBeginPlay() values already replicated. This is exactly what I need. Only here there is no call on the server at all. Only on client. And this works for me. And I already see how it can be processed using a Role condition in the case of need.
Again, according to your aiming, I spent some time on beyondunreal studying the insides of UT engine. And now I understand much more relatively before. Although, of course, many things are not yet available to my understanding.
I can still say that the UEd (2.0) is damn hell! How can I find out everything that includes a specific package? Is there any search in the tree class?
And, it seems, here is a bug. If you set config variables in the Ueditor and set defaults, and then remove config clause, then the defaults value of those variables still remains. It is strange, but it is. In my case, these values simply have nowhere to take. Variables of the scope of the class are not set anywhere and already have values other than initial (instead of false true, for example).
Buggie
Godlike
Posts: 1921
Joined: Sat Mar 21, 2020 5:32 am

Re: How to transfer the value of the variable from the server to the client?

Post by Buggie »

f7r wrote: Fri Apr 30, 2021 2:17 am How can I find out everything that includes a specific package?
Just in UnrealEd - no way (currently). You can use UCC for extract or list contents of entire package.
Or use 3-party tools like UTPT.
For well known packages use github or other sources, where another users publish package contents.
f7r wrote: Fri Apr 30, 2021 2:17 am Is there any search in the tree class?
In v469b UnrealEd you can search by class name.
scr_1619763312.png
f7r wrote: Fri Apr 30, 2021 2:17 am And, it seems, here is a bug. If you set config variables in the Ueditor and set defaults, and then remove config clause, then the defaults value of those variables still remains. It is strange, but it is. In my case, these values simply have nowhere to take. Variables of the scope of the class are not set anywhere and already have values other than initial (instead of false true, for example).
Read about defaultproperties section in .uc files.
You do not have the required permissions to view the files attached to this post.