Announcement

Collapse
No announcement yet.

Can't SpawN PAwns?

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

    Can't SpawN PAwns?

    Code:
    // When damaged (by a welder) , remove Mover and instate KFOBJMover Door to replace it.
    
    function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,
                            Vector momentum, class<DamageType> damageType)
    {
        local KFOBJMover SDoor;
    
        if ( bClosed && damageType == class 'DamTypeBullpup' )
        {
         Log ("A welding tool has sealed a door!");
         // So it doesnt collide with the OBJ door we're about to spawn
         self.SetCollision(false,false,false);
    
         // Spawn KFOBJPawn in place of the Mover
    
         SDoor = Spawn(class'KFmod.KFOBJMover',,, self.Location , self.Rotation);
         SDoor.SetDrawScale(self.DrawScale);
         SDoor.SetDrawScale3D(self.DrawScale3D);
    
         Destroy();
        }
    }
    So basically, I have this Mover which (if it is in the closed state) and is recieving damage from a certain weapon, will spawn a KFOBJMover (ignore the name, it extends from xPawn in fact) and then destroy itself.

    should be pretty run of the mill right? I've got checks in place to ensure that it sets the Spawned pawn's scale to the old mover's and it's in the same location, rotation etc. etc.

    with ANY other object than a pawn, this code will work (i've tried.)

    But it says in my Log (SDoor = none) and ends up failing to spawn every time, with my class extended from xpawn

    any thoughts?

    (I also did some tests spawning a KFOBJMover by the same method, on another KFOBJMover, and it worked...so i dunno if this is just a mover issue or what)

    #2
    Have you tried summoning your pawn in game???

    Comment


      #3
      My guess would be it's failing the collision checks since it's spawning the xPawn in its location before it gets destroyed. Ever try to translocate into a small space?

      Comment


        #4
        Yeah, that was my thought too, angelmapper.

        but you see, the KFOBJMover xpawn has no collision radius (it's like .01 ) I think

        Moreoever, the Destroy() function call used to be BEFORE the spawning of the OBJMover, and I got the same (SDoor = none ) when it tried to spawn

        hence you will notice this line

        self.SetCollision(false,false,false);

        before the spawn occurs.

        SHouldn't this rule out any possiblity of interference from the Mover doing the spawning?

        Comment


          #5
          It's most likely the Collision properties of the xPawn that's keeping it from spawning.
          May I ask why you have an xPawn class for a door?

          Comment


            #6
            Hehehe cuz then my zombies will treat it as a viable target during gameplay :P

            i still had to tweak the Monstercontroller code somewhat to allow for this, but not NEARLY as much as If I wanted them to go after lets say...a plain actor

            additionally, i can use the PlayDirerctionalHit() function in Xpawn to get the door to "shake" when it's hit with custom skeletal animations, and other fun little things

            My biggest annoyance with the Xpawn door is

            a. this problem with not spawning from the mover

            and

            b. The collision is STILL cylinder based even though i've told it to be false (i'd prefer if the Door pawn could use box collision or something else)


            I tried setting

            self.SetCollision(false,false,false);

            from the PreBeginPlay event of the door pawn and still no dice?

            Any thoughts on how i can be POSITIVE it's not failing some check by touching the old mover it's meant to replace?

            Comment


              #7
              Originally posted by XAlexX
              b. The collision is STILL cylinder based even though i've told it to be false (i'd prefer if the Door pawn could use box collision or something else)


              I tried setting

              self.SetCollision(false,false,false);

              from the PreBeginPlay event of the door pawn and still no dice?
              Can't help here, but I have noticed SetCollision not doing what was asked on other occasions as well. There are obviously some factors limiting its behavior.

              Comment


                #8
                Hey Alex XD, ok wat i would do is, in the monstercontroller, if you dont have a new one make one.
                if no enemy or if enemy is behind somthing, bCanSeeEnemy (i think off hand) is false, check to see if its behind the door, do a trace and if the player is shoot anyway or attack,
                otherwise just attack it if there isnt an enemy to try and get thru, so you can use the mover anyway just disable it

                Comment


                  #9
                  Um..

                  Buddy, you don't just say " HEY GO ATTACK"

                  if you've looked in the monster controller for UT2004 you would see that the attack process is handled by a myriad of states.

                  If you would like to re-write it with parallel code which handles Actors if no enemy player pawns are in sight, then be my guest. (but I think you'll have a hell of a time seeing as the ENTIRE code for the Monstercontroller centers around searching for, and attacking Pawns only.)

                  After two days of frying my brain trying, and only ending up with lobotimized zombies, I have opted for the workaround method.


                  Either way, this thread is not about editing the MonsterController

                  Comment


                    #10
                    Ok, as a test did you try setting,
                    bCollideActors=False
                    bCollideWorld=False

                    in the defaults other than using the function?

                    [EDIT]
                    just to atleast see if it spawns

                    Comment


                      #11
                      Yes I have tried that

                      I also tried only calling the Destroy()

                      if (SDoor!=none)


                      But of course, SDoor == none always, regardless....

                      Comment


                        #12
                        [EDIT]
                        I see your problem:

                        // Spawn KFOBJPawn in place of the Mover

                        SDoor = Spawn(class'KFmod.KFOBJMover',,, self.Location , self.Rotation);
                        You not spawning a KFOBJPawn , your spawning a KFOBJMover, returns None.

                        Comment


                          #13
                          What?

                          re-read the code.

                          I'm spawning a KFOBJMover ,what you quoted is just comment code.

                          Comment


                            #14
                            they why are u state spawn pawn where it spawns a mover?

                            Comment


                              #15
                              1. Comment is for reference. It is a personal note to myself to remind MYSELF what I'm doing. I could have said

                              // SPAWN FOOTLONG DONKEY DONG

                              and as long as I understood what it meant, it would be useful to me.

                              2. As I explained above, KFOBJMovers extend from xpawns and therefore they ARE pawns.

                              Comment

                              Working...
                              X