Announcement

Collapse
No announcement yet.

Server getting/setting a clientside variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Server getting/setting a clientside variable

    Hi everybody.

    I want my subclass of MapVotePage to be used by players, but to do that I need to change the variable MapVotingMenu in the Player's GUIController (or UT2K4GUIController, since GUIController is abstract). The annoying thing is: on the server this variable is empty and obviously not being used. So I need to modify the variable on the client. What is the best way to get/set a variable on the client?

    #2
    i needed this also, the players console, i couldnt access it..

    Comment


      #3
      replicate the variable
      Code:
      replication
      {
          reliable if (role == role_authority)
              Variable;
      }
      this will make it so the next server tick after you change the variable on the server side it will change on the clients side.

      if you want to read the variable, the client has to send it to you with
      Code:
      replication
      {
          reliable if (Role < ROLE_Authority)
              Variable;
      }
      Though if you have mutliple clients you may want to use a function to send the variable back as well as the client

      psudo-code
      Code:
      replication
      {
          reliable if (Role < ROLE_Authority)
              MyFunction;
      }
      
      simulated function SomeFunciton()
      {
          MyFunction(var1, var2);
      }
      
      //only is called on the server
      function MyFunction(float varvalue, float playerID)
      {
          //stuff
      }

      Comment


        #4
        Hey Hsoolien, what about a xBombFlag Accessing PlayerConctriller(Holder.Controller).Player.Consol e i couldnt get it because it was client, i was adding Message()'s

        Comment


          #5
          Hsoolien, I need to change a variable in a remote class on the client. You can only replicate the variables that are in the class you're replicating in, right? So how do I change that variable without subclassing and inserting a replication block for that? Or am I now just rambling and not getting it at all? :bulb:

          Comment


            #6
            ok for Big A

            You should be able to have the remote bomb recieve messages in a replicated blcok that it could then using a simulated funciotn give the player

            somehting like this:
            Code:
            replication
            {
                Reliable if (ROLE == ROLE_Authority)
                    ClientMessagePLayer;
            }
            
            function ServerMessagePlayer(string Message)
            {
                ClientMessagePlayer(Message)
            }
            
            simulated function ClientMEssagePLayer(string message)
            {
                local playercontroller PC;
            
                PC = Level.GetLocalPLayerController();
            
                PC.Player.Console.Message(message, 2);
            }
            At least if I understand your question right. This will probably only work while your player has the Xbombflag cause replication only works for player owned classes (playercontroller, pawn, weapons, vecs), pri's and gri's


            Your option Nove4 would be to spawn anoher class that alters the variables an have the replication blocks there. it hink like above you need to be sure the class is owned byt he player you wish to message though... I wish I knew of an online link for the authoritative guide to replication....

            Comment


              #7
              ****, because i need it to recieve messages as its not holding it

              Comment


                #8
                Originally posted by Hsoolien
                This will probably only work while your player has the Xbombflag cause replication only works for player owned classes (playercontroller, pawn, weapons, vecs), pri's and gri's

                Not true. "Function calls can only be replicated to or from the client owning the actor"
                This does not apply to variable replication.
                Your option Nove4 would be to spawn anoher class that alters the variables an have the replication blocks there. it hink like above you need to be sure the class is owned byt he player you wish to message though... I wish I knew of an online link for the authoritative guide to replication....
                How about: http://wiki.beyondunreal.com/wiki/Replication
                and: http://wiki.beyondunreal.com/wiki/Replicated_Function

                As authorative as possible, IMO.

                Comment


                  #9
                  the wiki replication pages were not very good last time I looked (it's down ATM), however there is an article called: Replication De-Obfuscation somwhere kicking around which was very very good.


                  My mistake on variable replication, it's hard to remeber all that stuff...

                  Comment

                  Working...
                  X