Announcement

Collapse
No announcement yet.

Basic Variable Question

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

    Basic Variable Question

    I need to know if my pawns groundspeed is between specific values.

    How do I code it to work out if it's between 0 and 180 for example??

    At the moment I've tried this and it doesn't work:

    Code:
    if (Pawn.GroundSpeed >=0 && <=180)
    {
      UDNPawn(Pawn).AimBlend.SetBlendTarget(1, 0.05);
    }
    else if(Pawn.GroundSpeed >=180 && <= 350)
    {
     UDNPawn(Pawn).AimBlendWalking.SetBlendTarget(1, 0.05);
    		 }
    else if(Pawn.GroundSpeed >=350 && <=900)
    {
     UDNPawn(Pawn).AimBlendRunning.SetBlendTarget(1, 0.05);
    		 }

    #2
    Are you sure GroundSpeed is what you're looking for? According to its comment it's "the maximum ground speed" and I guess that never changes unless some new value is assigned to it.
    Or did you want to check the current speed/velocity of your pawn (which can be done using 'VSize(Pawn.Velocity)'?

    Comment


      #3
      You need to use:

      if (Pawn.GroundSpeed >=0 && Pawn.Groundspeed <= 180)

      etc.

      Cheers,
      Robin.

      Comment


        #4
        hmm, I must be doing something wrong. In my Log file, it doesn't register "ENABLE RUNNING HAND UP ANIMATION"

        Code:
        function AimWeapon(float DeltaTime)
        {
            
        
            if(Pawn.GroundSpeed >=0 && Pawn.Groundspeed <= 180)
            {
               `log("ENABLE IDLE HAND UP ANIMATION");
                UDNPawn(Pawn).AimBlend.SetBlendTarget(1, 0.10);
            }
        
        else if(Pawn.GroundSpeed >=181 && Pawn.Groundspeed <= 350)
            {
               `log("ENABLE WALKING HAND UP ANIMATION");
                UDNPawn(Pawn).AimBlendWalking.SetBlendTarget(1, 0.10);
            }
        
        else if(Pawn.GroundSpeed >=351 && Pawn.Groundspeed <= 900)
            {
               `log("ENABLE RUNNING HAND UP ANIMATION");
                UDNPawn(Pawn).AimBlendRunning.SetBlendTarget(1, 0.10);
            }
            
        }
        Any ideas please?

        Comment


          #5
          I've got this fixed now thanks. The speeds didn't match up correctly.

          Comment


            #6
            What if GroundSpeed is 180.5?

            Comment

            Working...
            X