Announcement

Collapse
No announcement yet.

How can I get the value from the player?

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

    How can I get the value from the player?

    I can't get the valid variable value under network play. In single player mod I get the valid value.

    What's wrong?

    Thanks: George Varga

    The code:

    I set the value at class SniperRifle:

    myPlayer(Instigator.Controller).SetIsZoomed( true );

    I get the valid value at class SniperRifle (under network play too):

    if(myPlayer(Instigator.Controller).bIsZoomed)
    // OK.


    I get the wrong value at class SniperFire:
    if(myPlayer(Instigator.Controller).bIsZoomed)
    // Always false

    In server.log file I get many message line:
    Warning: SniperFire.DoTrace:01BE) Accessed None

    The myPlayer class:

    class myPlayer extends xPlayer;

    var bool bIsZoomed;

    replication
    {
    reliable if(Role == ROLE_Authority)
    bIsZoomed
    }

    function SetIsZoomed( bool B )
    {
    bIsZoomed = B;
    }

    function bool GetIsZoomed()
    {
    return bIsZoomed;
    }

    defaultproperties
    {
    bIsZoomed = false;
    }

    #2
    What are you trying to do with this zoom-thingy?

    I wrote a sniper rifle mod for UT that instantly zoomed the scope to full whack, when I was developing the mod it would work perfectly in single player games but would screw up over a network. I did manage to fix it eventually but without the original code in front of me (I'd have to grab it off a back-up CD first) and knowing what you want to do I can't really say anymore.

    If you post the answers to these questions I'll see if I can help you further (I work nights so most of my forum time happens early in the morning or mid-afternoon UK time).

    Comment


      #3
      I want the information from the player (myPlayer(Instigator.Controller).bIsZoomed). The player gun is zoomed or not.

      I set the value at class SniperRifle. I get in this class and the SniperAttachment class valid value, but in the SniperFire class I get the valid value before the code set the fire effect after the "if(Role == ROLE_Authority) line.

      In network play after the if(Role == ROLE_Authority) line I don't get the player and varibles valid value.

      In network play after the if(Role == ROLE_Authority) line the code run in the server, the server send to the client the fire effect, but the server don't know (?) information from the player and owner class variables?

      Thanks: George Varga

      Comment


        #4
        After some digging around and testing I've come up with this little mutator, it will report the 'zoomed' state of all HUMAN players (not bots as they tend to use a different method to simulate zooming) regardless of which weapon they are using.

        The zip file can be downloaded from http://www.speakerprojects.com/devel/zoomtest.zip and contains not only the INT and U files but the UC project file aswell (look at the file to see what it does, I've put comments in there for you).

        To get the mutator to work properly you need to do the following:[list=1][*]Open UT2003.ini and add the following line under the ENGINE.GAMEENGINE section: SERVERPACKAGES=ZOOMTEST[*]Open USER.ini and find a blank key assignment (one that ends =) and add the text MUTATE ZOOMTEST[/list=1]

        Launch the game (network or singleplayer), put Zoom Test into the active mutators list and play the game. The key you assigned to MUTATE ZOOMTEST will cause the mutator to log the state of all the HUMAN players zoom in UT2003.log when pressed.

        Hope this helps...

        Comment


          #5
          Something wrong in my system because your code in single player mod works fine, but under network play I get the not zoomed message always:

          ScriptLog: Team 1
          ScriptLog: Login: Remus
          Log: myPlayer got player TcpipConnection
          ScriptLog: New Player Remus id= b0f03bb46ae62b55c64461bb321f2f0d
          DevNet: Join succeeded: Remus
          ScriptLog: START MATCH
          ScriptLog: This guy: Remus is NOT zoomed.
          ScriptLog: This player's FOV is: 85.00
          ScriptLog: This guy: Remus is NOT zoomed.
          ScriptLog: This player's FOV is: 85.00
          Log: Calling eventClientValidate for client 200.200.131.243:9898
          ScriptLog: This guy: Remus is NOT zoomed.
          ScriptLog: This player's FOV is: 85.00
          ScriptLog: This guy: Remus is NOT zoomed.
          ScriptLog: This player's FOV is: 85.00
          NetComeGo: Close TcpipConnection 09/15/03 14:38:22

          Thanks: George Varga

          Comment


            #6
            Finally got some time to reply,
            it seems my code is at fault (I didn't fully test it on my server, D'oh. Sorry, my bad). The FOV is one of the things that is not replicated on the server, only the client's machine so while weapons are free to examine (and change) them no one else can access them.

            I spent a couple of days working on this problem (it gave me a break from working on my own mod so I didn't mind too much) and the 'best' solution I can come up with is as follows:[list=1][*]Create a property in your custom player's replication info called bzoomed and ensure it has an entry in the REPLICATION function (see how HASFLAG is done)[*]Create your own custom weapons for each 'zoomable' one (a big pain I know but you need to put a function that sets the player's bzoomed to true when they are zooming). This function should not be a SIMULATED function as they generate no network traffic so will not set the player's bzoomed to true[*]Examine the state of the player's bzoomed variable to see if they are zooming[/list=1]
            A lot of work I know, but if you really must know if a player is using a weapon in zoom mode it's the only way I can see round the problem.

            Comment


              #7
              Thanks for the answers.

              George Varga

              Comment

              Working...
              X