Announcement

Collapse
No announcement yet.

Spawning a specific looking pawn

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

    Spawning a specific looking pawn

    I'm sure this will be a trivial answer, but how does one spawn a bot with a specific mesh/player? ie. If I wanted to write my own custom version of Gorge, how would I do it? So far I have this:

    Code:
    class MyPawn extends xPawn;
    
    #exec OBJ LOAD FILE=HumanMaleA.ukx
    #exec OBJ LOAD FILE=PlayerSkins.utx
    
    defaultproperties
    {
    	mesh = HumanMaleA.MercMaleD
    	species = xGame.SPECIES_Merc
    	skins(0) = PlayerSkins.MercMaleDBodyA
    	skins(1) = PlayerSkins.MercMaleDBodyA
    }
    
    class MyBot extends xBot;
    
    function SetAttractionState()
    {
    	GotoState('Roaming');
    }
    
    defaultproperties
    {
    	PawnClass = class'MyMutator.MyPawn'
    }
    
    class MyBotSpawner extends Actor;
    
    event PostBeginPlay()
    {
      Spawn(class'MyPawn', self,, self.Location);
    }
    But when I run this, I just get the Pawn icon where I've placed MyBotSpawner. I've obviously missing a step, but I can't find good example code about how to do this? I'm trying to create a pawn that's not a player, ie. it isn't going to run around and shoot and show in the scoring, etc. As if I was going to code up a dog pawn, that's sole purpose is to wander the map and maybe run when it gets shot

    Anyone know what I'm doing wrong?

    #2
    Re: Spawning a specific looking pawn

    I'm trying to create a pawn that's not a player, ie. it isn't going to run around and shoot and show in the scoring, etc.
    You should extend monster and monstercontroller then.

    Comment


      #3
      Thanks for the tip Grzech! I've switch them over to deriving off of Monster & MonsterController but until I have a an actual bot spawning (as opposed to these 2D pawn icons) I can't start fiddling with the AI

      Anyone every done something like this before? What step am I missing? Something is spawning, it just looks like the engine doesn't have enough information to render it :P Is my syntax on the mesh or skin assignment wrong?

      Comment


        #4
        This is what I use:
        Code:
        //-----------------------------------------------------------
        //	Creature class for TD
        //-----------------------------------------------------------
        class TDCreature extends xPawn;
        
        
        
        event PostBeginPlay()
        {
        	Super.PostBeginPlay();
        
        	if ((ControllerClass != None) && (Controller == None))
        		Controller = spawn(ControllerClass);
        	if(Controller != None)
        	{
        		Controller.Possess(self);
        	}
        }
        
        
        event Destroyed()
        {
        	if(Controller != none)
        		Controller.Destroy();
        	Super.Destroyed();
        }
        
        
        
        DefaultProperties
        {
        	ControllerClass=class'TD.TDCreatureController'
        	Mesh=mesh'SkaarjAnims.SkaarjUT2004'
        	Health=300
        	HealthMax=300
        	SuperHealthMax=300
        }
        <-Removed stuff before edit->
        Opps sorry, didnt see you're code properly. Hmm, I dont know whats wrong other than UT not finding your mesh, or maybe its not set properly.

        -> PawnClass=class'MyPawn'

        Comment


          #5
          Thanks GK! I've added your controller code; I suspect I was going to be asking about that sooner or later :P

          The pawn still isn't rendering though. I even tried dropping in the Mesh you use but nothing

          Do I have to do an #exec OBJ LOAD or something to get the mesh? I mean, I'm using built-in UT2K4 skins & meshes here, or I'm trying to at least!

          Comment


            #6
            just a stupid idea...try
            Code:
            Mesh=SkeletalMesh'HumanMaleA.MercMaleD'
            dont know if it helps, but at least it isn't wrong...

            btw: i think the "#exec ...." statements are only Preprocessor directives, meaning they're used only by UCC and not by the game engine...

            Comment


              #7
              Originally posted by skyshooter
              just a stupid idea...try
              Code:
              Mesh=SkeletalMesh'HumanMaleA.MercMaleD'
              dont know if it helps, but at least it isn't wrong...
              Tried it; nothing unfortunately

              Originally posted by skyshooter

              btw: i think the "#exec ...." statements are only Preprocessor directives, meaning they're used only by UCC and not by the game engine...
              True, but I drop the following line:

              Code:
              #exec OBJ LOAD FILE=PlayerSkins.utx
              then these lines cause compile errors:

              Code:
              skins(0) = PlayerSkins.MercMaleDBodyA
              skins(1) = PlayerSkins.MercMaleDBodyA
              This leads me to believe that I should be getting an error on the Mesh assignment since I'm not OBJ LOAD'ing the .ukx to which the mesh I've referenced belongs.

              I'm stumped on this. I don't think it's supposed to be this hard to do this! Most of my test code is based on the Invasion gametype, and the tips I've received in here, but it just won't work!

              Comment


                #8
                I asked this very same question a month ago, about using custom meshes/skins for my player.

                You need to extend xPawn, then override the Setup function.

                Code:
                class MyCustomPlayer extends xPawn;
                
                simulated function Setup(xUtil.PlayerRecord rec, optional bool bLoadNow)
                {
                	local Mesh PlayerMesh;
                
                	super.Setup(rec, bLoadNow);
                	PlayerMesh = Mesh(DynamicLoadObject(MyMesh, class'Mesh'));
                	LinkMesh(PlayerMesh);
                	Skins[0]=MyBodySkin;
                	Skins[1]=MyHeadSkin;
                }
                
                defaultproperties
                {
                	MyMesh="HumanMaleA.SkeletonMale"
                	MyHeadSkin=Texture'PlayerSkins.AlienMaleAHeadA'
                	MyBodySkin=Texture'PlayerSkins.AlienMaleABodyA'
                }
                Try that out.

                Comment

                Working...
                X