Announcement

Collapse
No announcement yet.

spawning pawns problem

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

    spawning pawns problem

    Hello

    Im develloping a mod on UT2004. I want to create a sentry.

    Basically, you need to build the sentry base during few seconds, and then, once built, the sentry "head" would pop up and kill the bad guys.

    So, I divided it into a sentry "legs" and a sentry "head"

    The sentry base is basically an actor and after a while, it runs FinishedBuild()

    FinishedBuild spawn the Sentry head. That head just inherit (extends) a pawn.

    Im having troubles while spawning the head. No matter how I try, spawn returns me None all the time and refers me no error message.

    Here's the code

    Code:
    class UNF_SentryLegs Extends UNF_BuildingObject;	/* extends actor */
    
    var class<pawn> Top;
    
    function FinishedBuild()
    {
    	local Pawn P;
    	P = Spawn( Top, Owner,, Location, Rotation );
    	UNF_Pawn(Owner).DebugMsg("spawning pawn:" $ string(P));
    }
    
    defaultproperties
    {
         Top=Class'UNF.UNF_Sentry'
    
         Damage=60
         DamageRadius=64
         DismantleAmmo=40
    
         DrawType=DT_Mesh
         Mesh=SkeletalMesh'UNF_rc.UNF_SentryLegsMesh'
    
         DrawScale=1.25
    
    }
    
    /////////////////////////////////////////////////////////
    
    class UNF_Sentry extends Pawn;
    
    defaultproperties
    {
    	ControllerClass=Class'UNF_SentryController'
    
    	bWorldGeometry=true
    	bCanBeDamaged=true
    	bStasis=false
    
    	Health=150
    	Mass=300
    
    	Mesh=SkeletalMesh'UNF_SentryTopMesh1'
    }
    
    /////////////////////////////////////////////////////////
    so, what is annoying is that Pawn is never spawned and I got absolutely no error message.

    Im surely missing something here... but what ?

    please, help


    --
    Best Regards,

    #2
    Looks like when you are spawning it you are spawning it at the same location the base is located at. You generally cannot spawn a colliding object within another colliding object. This would fail with no error if I recall correctly. Try spawning it up higher in the air. (Location+CollisionRadiusofBase+CollisionRadiusofH ead)

    Comment


      #3
      I tought of that

      but, even if I try:

      Code:
      	local vector V;
      
      	V = Location;
      	V.Z += 25;
      
      	P = Spawn( Top, Owner,, V, Rotation );
      P is still equal to None

      :cry:

      Comment


        #4
        You're trying to spawn a Pawn. Pawn is an abstract class. Try spawning a UNF_Sentry. Change this:
        Code:
        var class<pawn> Top;
        to this:this:
        Code:
        var class<UNF_Sentry> Top;

        Comment


          #5
          var class<Actor>

          tell me if I'm wrong but I think this means I got a class that is at least a Pawn

          blah, I even changed and still, pawn is not spawning

          Comment


            #6
            Pawn is a subclass of Actor. That makes all Pawns Actors, but not all Actors Pawns.

            This may be stating the obvious, but just in case... Telling the game to spawn "a Pawn" or "an Actor" is not going to accomplish much. Pawn and Actor can be considered to be "templates" of "real" actors and pawns.

            A variable of type class<Actor> can hold a reference to any class that is either an Actor or a subclass of Actor. No problem there. However, if you try to spawn something of a class that is just "class<Actor>", you're trying to spawn just a basic Actor, not your sentry top.

            Comment


              #7
              Try this change to your code:

              Code:
              function FinishedBuild()
              {
                 local UNF_Sentry P;
                 P = Spawn( Top, Owner,, Location, Rotation );
                 UNF_Pawn(Owner).DebugMsg("spawning pawn:" $ string(P));
              }

              Other things to check:

              Your GameInfo subclass is disallowing the Pawn class spawning.

              A loaded Mutator is disallowing the Pawn class spawning.

              Comment


                #8
                First check the collision info for the legs, you will need to spawn the head outside this, then move or attatch the head to the legs.
                Also keep in mind the collision of the head, the legs will need to be out side it's collision as well.

                Comment


                  #9
                  Try and give no collision to the head first, then try to spawn it. If this solve it, then you know what the issue is

                  Comment


                    #10
                    well, it's just that in GameInfo spawn( pawnclass,,,...)
                    spawn allways returns none

                    I dont really get why...

                    I checked, there was no collision problem

                    Comment

                    Working...
                    X