Make a pawn imitate animations

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Make a pawn imitate animations

Post 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?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

In the RF075A release there is a new pawn script variable that returns the player's animation (self.player_animation)
User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post 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)
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post 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) :)
User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post by AndyCR »

No problem, just glad I could get SOME code into RF1, I never had the proper compiler so I couldn't... Thanks!
User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Post 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";
	}]
		

}

User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Post 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?
User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post 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";
      }
   }]
      

}
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

PlayAnimation is a high level command which can't be used in a low level order...
User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Post 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?
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams »

Maybe you should read the manual... :roll:

http://dhost.info/realityfactory/online ... #ANIMATION
User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Re: Make a pawn imitate animations

Post 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.
User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post 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! :?
User avatar
Fallen
Posts: 36
Joined: Mon Jul 17, 2006 3:41 pm
Location: Waxhaw, NC

Post 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;
	}]
} 
Post Reply