Announcement

Collapse
No announcement yet.

Switching GameInfo's Mid-Game...

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

    Switching GameInfo's Mid-Game...

    I really hope this is possible, but right now I'm getting the error:

    Could not spawn player

    whenever I try to run my level. I'm currently trying to switch the GameInfo within the PostBeginPlay of the gametype currently being used like this:
    Code:
    function PostBeginPlay()
    {
         NewGame=Spawn(class'ADifferentGameType');
         self.Level.Game=NewGame;
    }
    Like I said, I get an error that a player couldn't be spawned. Will I have to "restart" the level somehow with the new gametype?

    Thanks for any advice you can offer!

    #2
    thats sort of like changing your car while youre sitting in it, i dont think it will work

    however, you can always start a map with any gametype you wish via the server travel string. console command "open mapname?gametype=gametype?playerclass=player" i think its playerclass anyway, heh. might wanna double check that one before you use it.

    Comment


      #3
      ****, I was really banking on this working. It seems like it should be possible because the Level.Game property isn't const. You CAN change it, I just need to find some command to "restart" or something. I tried Level.Reset() but that didn't work...

      Comment


        #4
        well, i mean...it could work. but it would be pretty weird if it did, heh. also i think self and level.game are referring to the same thing in this case.

        but if you have your own gametype, why do you need to switch to another in the beginning of the match?

        Comment


          #5
          It's a bit of a long story, but I'm working around it by changing the GameRules instead of the GameInfo. Now I'm just having this weird casting problem though...

          My new game info is called, say, MyGameInfo...

          log(Level.Game); // this is fine
          log(MyGameInfo(Level.Game)); // this says bad parameter

          What the heck is goin' on?!

          Comment


            #6
            log function may not like typecasted variables? maybe try:

            somevar = MyGameInfo(level.game);
            log(somevar);

            Comment


              #7
              Sorted out now, turns out I had mistakenly placed the new class in another package that wasn't being compiled. Phew!

              Thanks for all the help BoneHed...

              Comment

              Working...
              X