Announcement

Collapse
No announcement yet.

Freezing pawns in place?

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

    Freezing pawns in place?

    I'm trying to create a pseudo-pause where the world continues to run but the pawns can't move.

    I wasn't sure whether I should search for some sort of Pawn boolean, PlayerController state, or whatever to do this best. I just want to pause the player for a while, but keep timers and things going.

    I also thought maybe I could create an Interaction to swallow keypresses until the pause period is over?

    Can anybody suggest the best way to do this?

    Thanks.

    #2
    The way that I did it is to create a new State in the your own playercontroller and xBot classes called, well whatever you want to call it but I called it freeze. Then in the freeze state, just have it continue to go back to itself (after a sleep() call, so no infinite loop issues) while something is true or false. For example, if you have a pawn that is to be frozen, like you said you could have a boolean called bFrozen.

    So in the player and bot subclasses:
    Code:
    state Freeze
    { 
      ignores blah blah blah // actually, you want to ignore a lot of stuff, so when the frozen guy sees someone it wont go to another state
    
      begin:
        if (myPawnSubclass(Pawn).bFrozen)
        {
          Sleep(.10);
          GotoState('Freeze');
        }
        else 
          GotoState('PlayerWalking') ;  // for player controller.  For bots, use Hunting or something
    }
    Get the idea? You want to ignore just about every event, or else it will get out of your state and you won't know why. Also, what you ignore will differ for bots and player controllers. Look at the Dead states to see what to ignore.

    Good Luck!

    Comment


      #3
      If you happen to have the 2004 DVD release with the tutorials, one of them shows you how to do exactly this.

      Comment


        #4
        My mutator RealPauser, included in bN-RealUtils mutator is done yet and manage the disconnections pause and can be used to pause the game when you want.
        The mutator use a non-UT pause.
        Work with any game-type... ONS included!!!

        My last working release is v1.5
        There are some problems (again) with some replication state and i do not understand why!!!
        Seem that happen some type of multiple replication even if bNetOwner is specified in replication statement... and it happens only some times.

        Anyway... take a look at www.fh-clan.it




        Originally posted by Lehm
        If you happen to have the 2004 DVD release with the tutorials, one of them shows you how to do exactly this.
        Really? ...explain how to create a new pause?
        I don't think!
        ...anyway... tonight i will search my DVD for this explanation ^^

        Comment


          #5
          i havent used states much and i was just wondering.

          would this be right?

          ignores nameOfEvent, nameOfEvent2;
          or
          ignores nameOfEvent();
          or
          ignores event'nameOfEvent';

          any of the above?

          Comment


            #6
            Its the first one.

            And Im not sure they have to be events to be ignored. If you look at the Pawn class, look at the Dead state. See where it says Ignores?

            Im not in front of code, lemme look at how I coded the sleep state and I will get back to you. I have to download to work, look at the stuff, and then repost so it shouldnt take long.

            Comment


              #7
              Heres my Frozen state from the my subclass of bot:

              Code:
              state Frozen
              {  ignores SeePlayer, EnemyNotVisible, HearNoise, ReceiveWarning, NotifyLanded, NotifyPhysicsVolumeChange, NotifyTakeHit,NotifyHeadVolumeChange,NotifyLanded,NotifyHitWall,NotifyBump;
              
                 function BeginState()
                 {
                    ChosenPawn(Pawn).isFrozen = true;
                 }
              
                 function EndState()
                 {
                    ChosenPawn(Pawn).chosenHealth = 100;
                 }
              
                 Begin:
                   if(ChosenPawn(Pawn).isFrozen)
                   {
                     ChosenPawn(Pawn).SetPhysics(PHYS_None);
                     ChosenPawn(Pawn).PlayVictoryAnimation();
                     ChosenPawn(Pawn).StopWeaponFiring();
                   }
                   else
                   {
                     ChosenPawn(Pawn).chosenHealth = 100;
                     GotoState('Hunting');
                   }
                   Sleep(0.5);
                   GotoState('Frozen', 'Begin');
              }
              And heres the Frozen state in the subclass of player controller:

              Code:
              state Frozen
              {     ignores SeePlayer, EnemyNotVisible, HearNoise, ReceiveWarning, NotifyLanded, NotifyPhysicsVolumeChange,
              		NotifyTakeHit,NotifyHeadVolumeChange,NotifyLanded,NotifyHitWall,NotifyBump;
              
                  exec function Fire( optional float F )
                  {
                  }
              
                  exec function AltFire( optional float F )
                  {
                  }
              
                 function BeginState()
                 {
                    ChosenPawn(Pawn).isFrozen = true;
                 }
              
                 function EndState()
                 {
                    ChosenPawn(Pawn).chosenHealth = 100;
                 }
              
                 Begin:
                   if(ChosenPawn(Pawn).isFrozen)
                   {
                     ChosenPawn(Pawn).SetPhysics(PHYS_None);
                     ChosenPawn(Pawn).PlayVictoryAnimation();
                     ChosenPawn(Pawn).StopWeaponFiring();
                   }
                   else
                   {
                     ChosenPawn(Pawn).chosenHealth = 100;
                     GotoState('PlayerWalking');
                   }
                   Sleep(0.5);
                   GotoState('Frozen', 'Begin');
              }
              This probably could have been better set up in the subclass of Pawn, but I wouldnt know what state to send them back to once they were unfrozen. If you look, both states are basically identical, but the state for the bot ignores different things than the state for the Player. Also, when they are not frozen any longer, it sends them back to different states...

              Comment


                #8
                Originally posted by byNeutral
                Really? ...explain how to create a new pause?
                I don't think!
                ...anyway... tonight i will search my DVD for this explanation ^^
                It's one of the mutators "Medusa Combo"

                Comment

                Working...
                X