Results 1 to 9 of 9
  1. #1
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    309

    Question Having trouble with my custom TeamInfo class

    I am having problem with my custom TeamInfo (in game HUD variable TeamTickets shows up as 0 instead of 150 as defined).

    Also command DisplayAll WW2Game_TeamInfo TeamTickets doesnt show the variable (but finds it in class)

    I created new class and here is the code of it:

    Code:
    class WW2Game_TeamInfo extends UTTeamInfo;
    
    var int TeamTickets;
    
    replication
    {
        if ( bNetDirty && (Role == Role_Authority) )
    		TeamTickets;
    }
    
    function Initialize(int NewTeamIndex)
    {
        super.Initialize(NewTeamIndex);
        if( WW2Game(WorldInfo.Game) != None)
            TeamTickets = WW2Game(WorldInfo.Game).StartingTickets;
    }
    
    function Reset()
    {
    	super.Reset();
        if( WW2Game(WorldInfo.Game) != None)
            TeamTickets = WW2Game(WorldInfo.Game).StartingTickets;
    }
    
    
    
    defaultproperties
    {
       Name="Default__WW2Game_TeamInfo"
       ObjectArchetype=UTTeamInfo'UTGame.Default__UTTeamInfo'	
    }
    In WW2Game there is StartingTickets variable and it has value of 150

    Also I have a function in MyHUD that displays TeamTickets on screen.

    All code compiles fine.

    So where I went wrong?

  2. #2
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    GameInfo doesn't exist on clients. You need to have the server set the TeamTickets in the TeamInfo

  3. #3
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    309

    Default

    What you mean by that? Is it done with replication?

  4. #4
    Boomshot
    Join Date
    Oct 2007
    Location
    UK
    Posts
    2,211

    Default

    Why do you have "Name" and "ObjectArchetype" in your default properties? You shouldn't set those manually.

  5. #5
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    sorry, i was thinking you were trying to set them from the client side querying GameInfo.

  6. #6
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    309

    Default

    Removed Name" and "ObjectArchetype" no effect.
    It just seems that it compiles the files properly but it doesn't use it

    when I type in console displayall WW2Game StartingTickets variable I set up in GameInfo shows up
    but when I type displayall WW2Game_TeamInfo TeamTickets nothing appears, though there is no error shown (so it finds variable and the class)
    Last edited by InhexSTER; 03-03-2010 at 11:47 PM.

  7. #7
    Boomshot
    Join Date
    Oct 2007
    Location
    UK
    Posts
    2,211

    Default

    Are you sure the relevant code is being executed? Use log statements to be sure.

  8. #8
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    309

    Default

    Damn, I guess its my silly mistake, but i just found a function in UTTeamGame

    Changed to my TeamInfo:

    Code:
    function CreateTeam(int TeamIndex)
    {
    	Teams[TeamIndex] = spawn(class'WW2.WW2Game_TeamInfo');
    	Teams[TeamIndex].Faction = TeamFactions[TeamIndex];
    	Teams[TeamIndex].Initialize(TeamIndex);
    	Teams[TeamIndex].AI = Spawn(TeamAIType[TeamIndex]);
    	Teams[TeamIndex].AI.Team = Teams[TeamIndex];
    	GameReplicationInfo.SetTeam(TeamIndex, Teams[TeamIndex]);
    	Teams[TeamIndex].AI.SetObjectiveLists();
    }
    Now it works. Thanks for help anyways
    Last edited by InhexSTER; 03-04-2010 at 12:03 AM.

  9. #9
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    309

    Default

    One more question if I want to get variable from MyCusomActor to MyHUD and MyGameInfo how would i do that?
    Last edited by InhexSTER; 03-04-2010 at 12:31 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.