Announcement

Collapse
No announcement yet.

Multiple custom pawns on one team

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

    Multiple custom pawns on one team

    Hello,

    I'm trying to do a day of defeat-like mod, in which there are two teams and each team has a set of special "player classes". I'm thinking I need to create a custom pawn for each class (as each class is basically different from each other only through their inventory--their selection of guns).

    I'm trying to figure out when the game starts assigning pawns to ai and player controllers, but so far I haven't been able to track it down.


    All I need is a little push in the right direction. I've tried using PostLogin, but it seems the pawn doesn't get assigned at all in that function, and pre and post begin seem to come to late.

    #2
    The default GameInfo class doesn't support multiple pawns. So you will need to add this feature. You want to look at the GetDefaultPlayerClass function which is defined like this

    Code:
    function class<Pawn> GetDefaultPlayerClass(Controller C)
    {
    	// default to the game specified pawn class
    	return DefaultPawnClass;
    }
    You would probably want to make you own GameInfo and add the following

    Code:
    class MyGameType extends GameInfo
    {
        var class<Pawn> DefaultBotPawnClass;
    
    
        function class<Pawn> GetDefaultPlayerClass(Controller C)
        {
            if (C.PlayerReplicationInfo.bBot)
                return DefaultBotPawnClass;
            else
                return DefaultPawnClass;
        }
    
    
        defaultproperties
        {
            DefaultPawnClass = class'MyPawn';
            DefaultBotPawnClass = class'MyBotPawn';
        }
    }
    Obvisouly you wan't to extend something like UTTeamGame unless you wan't to write the GameType from scratch.

    Comment


      #3
      thank you sir, I will try that and let you know how it goes, and if I manage to complete something useful in the next few weeks, i will post some code so that this thread finishes with a complete answer after taking in all the advice and such.

      thanks again.

      Comment


        #4
        Hey thanks very much, I was trying to do the exact same thing but hadn't included the necessary DefaultProperties thing. It's working now so I can move on to the next roadblock ¬___¬

        Comment


          #5
          var class<Pawn> DefaultBotPawnClass;

          when i compile this line it does not see the ; at the end and makes the prosses fail even after i take it out and put it back in

          Comment


            #6
            The defaultproperties section should not have semicolons. The curly brackets around the class looks like a typo as well.

            Comment


              #7
              Shouldn't it be more like this:
              Code:
              class MyGameType extends GameInfo;
              
              var class<Pawn> DefaultBotPawnClass;
              
              
              function class<Pawn> GetDefaultPlayerClass(Controller C)
              {
                      if (C.PlayerReplicationInfo.bBot)
                          return DefaultBotPawnClass;
                      else
                      return DefaultPawnClass;
              }
              
              
               defaultproperties
              {
                     DefaultPawnClass = class'MyPawn'
                     DefaultBotPawnClass = class'MyBotPawn'
              }

              Comment


                #8
                Try looking at our CTF++ - the mod itself is far from fantastic - but we do have a working, online class system;
                http://www.moddb.com/mods/capture-the-flag1

                Comment

                Working...
                X