Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Dynamic Pawn Changing

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

    Dynamic Pawn Changing

    hello

    heres something ive been meaning to do for a while, and someone asked me how to do it.
    and it turns out its really easy

    this will allow you to walk up to another pawn and possess it. you should probably add some conditions if you want to use this in multiplayer lol

    player controller
    Code:
    class TegPlayerController extends UTPlayerController;
    
    var int CrashingDistance; 
    
    //this function is called by a button press
    exec function PawnSwap()
    {
        local Pawn OtherP;
    
         //check if theres a pawn near by
        ForEach Pawn.OverlappingActors(class'Pawn', OtherP, CrashingDistance)
        {
            if (OtherP != None) //if there is one close enough
            {
              //possess the pawn
              Possess(OtherP, false);
            }
        }
    }
    
    defaultproperties
    {
            //how close to the pawn we have to be
    	CrashingDistance=100
    }


    add this line in DefaultInput.ini at the end of 'Game Keyboard/Mouse Bindings' block
    this is for the button press, change it from "P" if you like.

    Code:
    .Bindings=(Name="P",Command="PawnSwap")



    and thats all there is to it!

    have fun

    heres a vid

    #2
    That is awesome - bookmarked for later use.
    Thanks for sharing.

    Comment


      #3
      yeah totally awesome
      I might probably never need it either but I'll keep a bookmark just in case

      seeing this makes me think making a new bot possess the old pawn doesn't sound any complicated either

      anyway thanks!
      btw nice red paper-trashman!

      Comment


        #4
        Interesting concept but it seems like replication would thrash the hell out of this type of implementation (as you already alluded to).

        Comment


          #5
          i like the concept! but i have a question.

          i was trying to make 2 different kind of pawns, one being possess-able and the other being non-possess-able. i had defined 2 different classes of bot using unrealscript, but i am not sure how to go about inside the pawn swap function to ignore one of those pawns.

          i tried adding another condition in it like so:

          if (OtherP != None && OtherP == class'PossessablePawn') //if there is one close enough
          {
          //possess the pawn
          Possess(OtherP, false);
          }

          it returns an error saying the comparison will always fail, please help!

          sorry, i am new to udk if the solution is obvious :P

          thanks!

          Comment


            #6
            if (PossessablePawn(OtherP) != None)......

            Comment


              #7
              omg thanks! is it a big help

              Comment


                #8
                Mind control!!!!!!!

                Comment


                  #9
                  This is great, keep up the good work mate !

                  Comment

                  Working...
                  X