Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Samwise on Thu 19/04/2007 07:31:51

Title: Few Character Animation Issues
Post by: Samwise on Thu 19/04/2007 07:31:51
Good morning,

I've got several problems with character animation:

1. I'm having a hard time understanding non-blocking scripts, even after reading the "understanding blocking scripts" section of the manual and reading some posts here.  What I'm trying to do is to have the player give (physically) something to an NPC, and having the NPC simultaneously reaching his hand and taking it after less then a second (say, wait(20)).  Could anybody show me around how to do that?

2. In several ocassions I'd like to "freeze" the player, so he won't be able to WALK anywhere, but WILL be able to look, talk and interact.  I've figure out StopMoving is not the right function, so how can this thing be done?

3. Sometimes, when I run a "talk to character" script on an NPC who's standing above the player, the player is talking to him (facing up), but occasionally faces to the side for a while in the middle of the scripts, then returning to face up.
Notice that all my "talk to character" scripts begin with the player walking until he's below the NPC, and then facing him ( character[EGO].FaceLocation(character[EGO].x, character[EGO].y - 50 , eBlock); )

Any help will be highly appreciated...
Title: Re: Few Character Animation Issues
Post by: Khris on Thu 19/04/2007 10:40:26
1. Use something like:
  player.Animate(..., eNoBlock, ...);
  Wait(20);
  cOtherguy.Animate(..., eBlock, ...);


2.   RemoveWalkableArea(GetWalkableArea(player.x-GetViewportX(), player.y-GetViewportY()));
That, or intercept eModeWalkto-clicks in on_mouse_click depending on a global var:
// beginning of left-click code:
  if (mouse.Mode==eModewalkto && player_frozen) return; // exit


3. Hmm, the frames in the talking view are all facing the correct way?
Title: Re: Few Character Animation Issues
Post by: Samwise on Thu 19/04/2007 12:33:00
KhrisMUC, thank you very much for your feedback,
but:

1. This is actually what I'm doing, but it doesn't work.  Here's an example to a script I'm using (OSER is the player character):

if (NogaHasRegistration == 1) {
   character[OSER].Walk(180, 209, eBlock);
   character[OSER].LockView(7);
   character[OSER].Animate(11, 4, 0, eNoBlock);
   Wait(20);
   character[OSER].UnlockView();
   character[NOGA].LockView(30);
   character[NOGA].Animate(10, 6, 0, eBlock);
   character[NOGA].UnlockView();
   character[OSER].FaceLocation(character[OSER].x + 50, character[OSER].y , eBlock);
   character[NOGA].Say("&4301");
   character[OSER].Say("&4336");
   character[OSER].FaceLocation(character[OSER].x, character[OSER].y + 50 , eBlock);
}

2. I think I understand the meaning of your second suggestion, but I don't know how to do it, can you be more specific?  The first suggestion is a good idea, but it will cause problems because all the characters are scaled in relation to the walkable areas.
EDIT: I found out you've already answered a similar question: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=29369.0
I'll try to figure it out from there.

3. Yes, I'm sure.  Sometimes this problem happens and sometimes not - in scripts that use the same methods - and I just don't know what to do...

Title: Re: Few Character Animation Issues
Post by: Khris on Thu 19/04/2007 15:11:24
1. Don't unlock the player's view until after the animation.
Just move "character[OSER].UnlockView();" below "character[NOGA].Animate(10, 6, 0, eBlock);"
This might solve it.

Also keep in mind that you can use "cOser" or "player" instead of character[OSER]. Similarly, you can use "cNoga" instead of "character[NOGA]".

2. Well, I THINK turning a walkable area off will only affect the pathfinding, I've never thought about the scaling. Did you try it out?

3. Nothing else comes to mind that could cause such behavior, sorry. Maybe someone else has an idea?
Title: Re: Few Character Animation Issues
Post by: Samwise on Thu 19/04/2007 15:25:52
1. Many thanks.  Now that you've mention it, it sounds so elementary...  :D

2. I'm not sure about it, but I think I'll try your other suggestion first.

3. Someone has an idea?