Page 1 of 1

Make a pawn imitate animations

Posted: Fri Aug 11, 2006 5:31 pm
by Fallen
I am trying to make a pawn imitate the animation of the player. So if the player is walking the pawn is walking, if the player is jumping the pawn is jumping and so on.

I know I have to script it, I got the pawn following me correctly, but I dont' know the commands to get the players current animation and apply it to the pawn. Help would be great!

Also, is there a reference to the scripting that tells us names of attributes we can get and functions we can perform for this scripting language?

Posted: Fri Aug 11, 2006 5:49 pm
by QuestOfDreams
In the RF075A release there is a new pawn script variable that returns the player's animation (self.player_animation)

Posted: Fri Aug 11, 2006 9:58 pm
by AndyCR
Exactly. With that in, you can then just tell the pawn to set the animation to the player's animation constantly.
QuestOfDreams wrote:In the RF075A release there is a new pawn script variable that returns the player's animation (self.player_animation)
(slightly offtopic, but is that the version of self.player_animation I made? just curious)

Posted: Sat Aug 12, 2006 5:57 am
by QuestOfDreams
(slightly offtopic, but is that the version of self.player_animation I made? just curious)
yes, that is your code (thx for the contribution btw) :)

Posted: Sat Aug 12, 2006 2:09 pm
by AndyCR
No problem, just glad I could get SOME code into RF1, I never had the proper compiler so I couldn't... Thanks!

Posted: Sat Aug 12, 2006 8:14 pm
by Fallen
so would it be someting simular to this? (obviously not this, cause if it worked i wouldn't be asking the question) Sorry just not familiar with the language trying to learn it, but definately am lost.

Code: Select all

{
	PANIM [Idle];
	
	Spawn[()
	{
		LowLevel("anim");
	}]

	anim[()
	{
		PawnRender(true);
		PlayAnimation(PANIM, true, "");
		self.ThinkTime = 1;
		self.think = "update";
	}]
	
	update[()
	{
		PANIM = self.player_animation;
		self.think = "anim";
	}]
		

}


Posted: Mon Aug 14, 2006 2:25 pm
by Fallen
I've managed to keep myself occupied scripting a few tools the past couple of days ... which has been fun. But now I am back to this and am still clueless. Any help?

Posted: Mon Aug 14, 2006 3:36 pm
by AndyCR
I could be way off, but try this. (It's been awhile since I used simkin; expect a few errors)

Code: Select all

{
   PANIM [Idle];
   
   Spawn[()
   {
      LowLevel("anim");
   }]

   anim[()
   {
      PawnRender(true);
      PlayAnimation(PANIM, true, "");
      self.ThinkTime = 1;
      self.think = "update";
   }]
   
   update[()
   {
      if(PANIM != self.player_animation)
      {
         PANIM = self.player_animation;
         self.think = "anim";
      }
   }]
      

}

Posted: Mon Aug 14, 2006 3:43 pm
by QuestOfDreams
PlayAnimation is a high level command which can't be used in a low level order...

Posted: Mon Aug 14, 2006 3:50 pm
by Fallen
hence my problem. I don't knwo what the low level command is to tell a pawn how to animate... or if there is one. And it there isn't one ... how would one go about doing this?

Posted: Mon Aug 14, 2006 4:00 pm
by QuestOfDreams
Maybe you should read the manual... :roll:

http://dhost.info/realityfactory/online ... #ANIMATION

Re: Make a pawn imitate animations

Posted: Mon Aug 14, 2006 5:15 pm
by Fallen
Fallen wrote: Also, is there a reference to the scripting that tells us names of attributes we can get and functions we can perform for this scripting language?

Thank you, missed that link when looking through the online help.

Posted: Mon Aug 14, 2006 7:05 pm
by AndyCR
QuestOfDreams wrote:PlayAnimation is a high level command which can't be used in a low level order...
Good grief, maybe I should avoid even trying, it's pretty clear I haven't used simkin in awhile! :?

Posted: Mon Aug 14, 2006 8:40 pm
by Fallen
Incase someone else searches for this in the future, this works well.

Code: Select all

{
	PANIM [Idle]

	Spawn[()
	{
		LowLevel("setup");
	}]

	setup[()
	{
		self.think = "update";
	}]

	update[()
	{
		self.ThinkTime = 0.0;
		self.think = "fll";
	}]

	fll[ ()
	{
		if(self.player_animation != PANIM){
			Animate(self.player_animation);
		}
		PANIM = self.player_animation;
	}]
}