Announcement

Collapse
No announcement yet.

Trying to assign server name to a var

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

  • replied
    Grzech,

    it worked like a charm, thanks a million.

    BTW, i still can't find anything like that in the archives. I think it is done but it is nowhere near as straight forward.

    Leave a comment:


  • replied
    Originally posted by Grzech

    ...But I'm certain there must be already a function defined that gives you servername on a client so this would be duplicating something that already exist... :weird: [/B]
    That's what I thought but I haven't been able to find it.

    Thanks again, I will try this out.

    Leave a comment:


  • replied
    I meant to manually replicate your servername variable.
    like:
    Code:
    var string server_name;
    
    replication
    {
        reliable if (Role == ROLE_Authority)
            server_name;
    }
    
    
    function string GetServerName()
    {
        return Level.Game.GameReplicationInfo.ServerName;
    }
    
    function PostBeginPlay()
    {
        server_name = GetServerName();
    }
    Now when u call PostnetbeginPlay on a client you should have servername in server_name variable
    Code:
    simulated function PostNetBeginPlay()
    {
        //here use server_name for whatever you wish, like:
        class'MyWeapon'.default.ItemName = server_name $ " super gun";
    }
    But I'm certain there must be already a function defined that gives you servername on a client so this would be duplicating something that already exist... :weird:

    Leave a comment:


  • replied
    Originally posted by Grzech
    Obtain server name to a variable on server only and then replicate this variable.

    Note that you shouldn't try to use this variable b4 it gets replicated.
    OK, good point.
    So, at what point in the "Chain Of Events At Level Startup" is the ServerName replicated to the client?

    I have had success replicating a variable to the client if I declare the variable in the mutator class, assign a default value, then grab it from the weapon class. Unfortunatey I have not been able to obtain the server name (not even the client's servername for that matter) within the mutator class. :bulb:

    I even tried this in the mutator class:

    Code:
    function string GetServerName(string ServNam)
     {
    				
        ServNam = Level.Game.GameReplicationInfo.ServerName;
          return ServNam;
      }
    I then tried calling it from a simulated function in the weapon class which didn't work. So I tried putting the function and the variable and the call in the weapon class without the default value and that didn't work.

    Am I close with a few adjustments needed or am I barking up the wrong tree entirely?
    Or just barking mad for that matter.

    Thanks in advance.

    Leave a comment:


  • replied
    Hey thanks for trying but I am just not getting it.

    I thought this would be fairly simple. Something I had missed during my ten hours of searching the unreal wiki and the UT2004 code. But I guess not.

    Unfortunately, I'm not a programmer, and can't just read this stuff and have it make sense to me. I am working on that though.

    I have been looking for a specific example but not finding anything that I understand. Most are part of either a menu or a hud which I have almost no experience with.



    Thanks again for trying.

    Leave a comment:


  • replied
    are the objects you use actual objects? References to the classname wont work. To get the servername you need a GameReplicationInfo object.

    Leave a comment:


  • replied
    Obtain server name to a variable on server only and then replicate this variable.

    Note that you shouldn't try to use this variable b4 it gets replicated.

    Leave a comment:


  • started a topic Trying to assign server name to a var

    Trying to assign server name to a var

    I am making a weapon mutator for UT2004 and I'm trying to assign the server name to a variable to use in the weapon.
    So far I have tried to do this in the code of the weapon itself (see below) and either gotten nothing or the
    server name from the client.
    It occurs to me to try this from the mutator itself but I'm afraid by the time I trial and error my way through
    this, UT2005 will be released and I'll have to start over.


    So far I've tried this;

    Code:
    SN=class'GameReplicationInfo'.default.ServerName; 
    //this just grabs the local ServerName instead of the server ServerName
    and this;

    Code:
    SN=GameReplicationInfo.ServerName;
    Compiler error: ...unknown member in GameReplicationInfo...

    and even this;

    Code:
    var GameInfo.ServerResponseLine Server;
    ~
    ~
    ~
    SN=Server.ServerName;
    By now I am pretty much grasping at straws, as you can tell, and I'm sinking fast. :weird:

    I can tell you that I am attempting to use the variable in a render overlays event and as a weapon mutator I have the usual suspects in the form of:
    mutator
    weapon
    weapon fire
    weapon pickup
    weapon attachment
    weapon zoom
    ammo
    ammo pickup
    and two damage types
    Not that any of that will help but I'm pretty pesimistic by now.

    Thanks in advance for anything you can tell me.
Working...
X