Actor replicating animation

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

cyotic

New Member
Jul 12, 2005
12
0
0
Hey everyone, I hope someone knows a way around this.

I am trying to get an Actor to play an animation and have it play on all clients in the game. Nothing seems to work.

Code:
class A extends Actor
                     placeable;

var name AAnim;

replication
{
        reliable if (Role == ROLE_Authority)
                    AAnim;
}

// Touched used to get my point across.  Not the way it works :)
simulated function Touch(Actor Other)
{
       PlayAnim(AAnim);
}

defaultproperties
{
       DrawType=DT_Mesh
       AAnim="AnimName"
       .......
}
After numerous attempts to find a solution I have come up with one that does the job. The only thing is that I dont want to make everything a child of Pawn in order to have animations on an object.

Code:
class A extends Pawn;

var name AAnim;

simulated function Touch(Actor Other)
{
       SetAnimAction(AAnim);
}

// Adding this in lets the Animation Play just like in the MyFirstExample tutorial.
simulated function SetAnimAction(name NewAction)
{
      AnimAction = NewAction;
      PlayAnim(NewAction);
}

defaultproperties
{
       DrawType=DT_Mesh
       AAnim="AnimName"
       .......
}

Any help would be greatly appreciated.