Announcement

Collapse
No announcement yet.

spawning something other than a pawn?

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

    spawning something other than a pawn?

    trying to force a gametype to spawn vehicles rather than pawn's. tried replacing the pawn class with a vehicle class but nothing happened, other than I couldnt join the game and not even move.

    So i figured I could mutate the add inventory function to spawn a vehicle and force the player to enter it. I am having some sysntax issues I havent been to find a function to spawn the vehicle class, the closest thing I got is a SpawnVehicle(); but it gives me bad or missing expression in UTDeathMatch.

    Anyone have any ideas on this?

    #2
    I'm sure it would be possible to directly spawn and possess a vehicle, but it would require a lot of changes to the vehicles, so I too decided to just spawn the player as normal, and the vehicle, and force the player into it, and keep them from leaving.

    here is essentially what I had to do within my gametypes RestartPlayer function:
    -spawn the player as usual
    -give the pawn no collision, or do that in the defaults of a new pawn class for your mod
    -spawn the vehicle at the player's location
    -be sure to set the vehicles team and/or unlock it
    -YourVehicle.mesh.WakeRigidBody()
    -YourVehicle.DriverEnter(YourPawn)

    You would also need to edit a few things to make it so the player can't leave the vehicle.

    Comment


      #3
      Someone from UnrealDemolition, I forget their name, posted this up ages ago.
      Code:
      function RestartPlayer( Controller aPlayer )
      {
          Super.RestartPlayer( aPlayer );
      
          if (aPlayer.Pawn == NONE)
          {
              `log("NULL Player pawn.");
              return;
          }
      
          SpawnUDVehicle( aPlayer.Pawn );
      }
      
      unreliable server function SpawnUDVehicle( Pawn P )
      {
          local Vehicle V;
          local vector loc;
      
          `log("LOG - SpawnVehicle");
            
          if (P == NONE) //NULL safety check
          {
              `log("Null pawn SpawnVehicle");
              return;
          }
      
          loc = P.Location;
          
          loc += vect(100,100,100);//need to shift the vehicle so it doesn't crush people
          V = spawn(class'YourPackage.YourClass',,,loc, P.Rotation);
      
          if (V != NONE)
          {
              if ( V != NONE && V.TryToDrive(P))
              {
                  //UDVehicle(V).InitUDVehicle();
                  return;
              }
              V.AttachDriver(P);
          }
       
      }
      That's obviously just getting into it of course.

      Comment


        #4
        I think there's something about vehicles that makes them require a driver pawn in addition to just a controller. I tried spawning AIControllers on empty Mantas, but they'd just hop up and down on the spot.

        Comment


          #5
          Hi all,
          I too faced the same issue when i tried change the DefaultPawnClass in extended gameInfo class from UTPawn to UTVehicle_Scorpion.
          anyone have any updates on how to get it done?

          Comment

          Working...
          X