For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Calling Function in Player State Code

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
Post Reply
User avatar
LannFyre
OldUnreal Member
Posts: 157
Joined: Fri Mar 13, 2015 7:01 am

Calling Function in Player State Code

Post by LannFyre »

tl;dr Tried inserting function into state code, function isn't calling, can I call function another way?

Something I'm not understanding regarding animation calls in a playerpawn. I have overridden state PlayerWalking(), function TweenToRun(), and function PlayRunning(). I have replaced several calls of:

Code: Select all

native(259) final function PlayAnim( name Sequence, optional float Rate, optional float TweenTime );
native(260) final function LoopAnim( name Sequence, optional float Rate, optional float TweenTime, optional float MinRate );
native(294) final function TweenAnim( name Sequence, float Time );
native(293) final function name GetAnimGroup( name Sequence );
with code intended to tell another actor to choose a set of textures a player has stored with them (temporary measure, not worried about this yet) and play those textures in a sequence.

Problem is my function call to a separate actor that I've inserted into PlayRunning ("AnimManager.PlayAnimation(...);")
or
("UpdateAnim(PawnSpriteAnim);")
isn't going through.

I've assigned texture sets through some if statements in TweenToRunning
(ex: "if ( SpriteIndex == 0 ^^ SpriteIndex == 8 ){Sprites[0].CurrentSet = Sprites[0].RunForward;}") but I can't test if this is working without my animation playing.

Code: Select all

state PlayerWalking
{
ignores SeePlayer, HearNoise, Bump;

[...]//=========================//[...]

      function AnimEnd()
      {
            local name MyAnimGroup;

            bAnimTransition = false;
            if ( Physics == PHYS_Spider )
            {
                  if ( VSize(Velocity) line 452

            AnimSequence = MyAnimGroup;
      }

[...]//=========================//[...]

      function BeginState()
      {
            WalkBob = vect(0,0,0);
            DodgeDir = DODGE_None;
            bIsCrouching = false;
            bIsTurning = false;
            bPressedJump = false;
            if (Physics != PHYS_Falling)
                  SetPhysics(PHYS_Walking);
            TweenToWaiting(1.0);
            PlayWaiting();
            UpdateAnim(PawnSpriteAnim);
            /*if ( !IsAnimating() ) // AnimCode
            {
            }*/
      }

      function EndState()
      {
            WalkBob = vect(0,0,0);
            bIsCrouching = false;
            SetCrouch(false);
      }
}

Code: Select all

function TweenToRunning(float tweentime)
{
      BaseEyeHeight = Default.BaseEyeHeight;
      
      if ( SpriteIndex == 0 ^^ SpriteIndex == 8 ){Sprites[0].CurrentSet = Sprites[0].RunForward;}
      else if ( SpriteIndex == 1){Sprites[0].CurrentSet = Sprites[0].RunForwardRight;}
      else if ( SpriteIndex == 2){Sprites[0].CurrentSet = Sprites[0].RunRight;}
      else if ( SpriteIndex == 3){Sprites[0].CurrentSet = Sprites[0].RunBackRight;}
      else if ( SpriteIndex == 4){Sprites[0].CurrentSet = Sprites[0].RunBack;}
      else if ( SpriteIndex == 5){Sprites[0].CurrentSet = Sprites[0].RunBackRight;}
      else if ( SpriteIndex == 6){Sprites[0].CurrentSet = Sprites[0].RunRight;}
      else if ( SpriteIndex == 7){Sprites[0].CurrentSet = Sprites[0].RunForwardRight;}
      
      if (bIsWalking)
      {
            TweenToWalking(0.2);
            return;
      }
}

Code: Select all

function PlayRunning()
{
      BaseEyeHeight = Default.BaseEyeHeight;

      PawnSpriteAnim.AnimFrames = Sprites[0].CurrentSet;
      UpdateAnim(PawnSpriteAnim);
}

Code: Select all

function UpdateAnim(SpriteAnimation PawnSpriteAnim)
{
      log("UpdateAnimDing!!");
      AnimManager.PlayAnimation( self, PawnSpriteAnim, PawnSpriteAnim.DefaultAnimTime, -1, '', false );
}
i tryin'a be a gud boi
Post Reply

Return to “UScript Board”