Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: ForceTalkAnim  (Read 7637 times)

0 Members and 1 Guest are viewing this topic.

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
ForceTalkAnim
« on: April 26, 2005, 03:49:27 PM »

Hi.
I should use a special animation for talking in some cases.
I found ForceTalkAnim function in SDK.
But it works not right i need: it plays special animation once and then it switches to standard one. And this happens during one call of Talk method of Actor.
How can i make actor use this animation from beginning to the end of execution of Talk method ?

Here is my code
Code: [Select]
actor.PlayAnim( "actors\kewa\phone\01.sprite" ); // intro to special animation
actor.ForceTalkAnim( "actors\kewa\phone\02.sprite" ); // my special animation
Game.Msg( "1" ); // start talk
actor.Talk( "fsafsdafsdafsdafsadfsdafsadfsdafsdafsdafsdafsa", null, 5000 ); // i'd like to see my special animation for 5 seconds, not only once.
Game.Msg( "2" ); // stop talking
actor.PlayAnim( "actors\kewa\phone\03.sprite" ); // outro from special animation

While i wrote this post, i've found a decision :)
Talk animation should be LOOPED :)

Logged

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #1 on: April 26, 2005, 04:06:08 PM »

Stil got the problem :(
After Talk animation i see "stand" animation for a moment. And only after that - outro animation starts.
How can i make it more constrained??
Logged

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: ForceTalkAnim
« Reply #2 on: April 26, 2005, 05:36:13 PM »

Did you try it without the Game.Msg in between? Maybe that causes the short display of the stand animation.

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #3 on: April 26, 2005, 06:28:15 PM »

Yes.
Tested it this way:

Code: [Select]
case 1:
actor.PlayAnim( "actors\kewa\phone\01.sprite" );
actor.ForceTalkAnim( "actors\kewa\phone\02.sprite" );
actor.Talk( "fsadsa fsaddsaf safsdafsda fasdfsdaf sadfsdafs adfsa" );
// here it seems to be a "stand" micro delay between sprites
actor.PlayAnim( "actors\kewa\phone\03.sprite" );

All the same :(
Logged

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: ForceTalkAnim
« Reply #4 on: April 26, 2005, 09:12:34 PM »

Hi Art,

I had a similar problem and worked around it. I created a new sprite with only the first frame of the animation that should be played after the talking.
Then I added a actor.SetSprite command right before the actor.Talk command.
You will not see the change of the sprite before the talking but in the moment between talking and playing the 2nd animation.

In your case you should give this piece of code a try:

Code: [Select]
case 1:
actor.PlayAnim( "actors\kewa\phone\01.sprite" );
actor.ForceTalkAnim( "actors\kewa\phone\02.sprite" );
                                                actor.SetSprite("actors\kewa\phone\03_start.sprite");
actor.Talk( "fsadsa fsaddsaf safsdafsda fasdfsdaf sadfsdafs adfsa" );
// here it seems to be a "stand" micro delay between sprites
actor.PlayAnim( "actors\kewa\phone\03.sprite" );

where '03_start.sprite' is just the first frame of '03.Sprite'.

Logged

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #5 on: April 28, 2005, 07:33:17 AM »

Hi Mac.

It seems that Actor object does not have SetSprite method :)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ForceTalkAnim
« Reply #6 on: April 28, 2005, 07:39:19 AM »

That's right, Mac's solution would work with entities but not with actors. I'll see what I can do about the problem, either by adding SetSprite for actors (I have it in my ToDo for some time anyway) or by eliminating the "gap" when the actor is switching from talking state to playing an animation.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #7 on: April 28, 2005, 07:41:10 AM »

PlayAnim instead of SetSprite with LOOPED 03_.sprite helped....
Logged

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #8 on: April 29, 2005, 06:30:43 PM »

...either by adding SetSprite for actors (I have it in my ToDo for some time anyway) or by eliminating the "gap" when the actor is switching from talking state to playing an animation.

Hi Jahn!

I've encountered the following problem while coding my game.
I think it's a common case of the described above (i may err). And (or) existance of solutions to these problems can easily resolve ForceTalkAnimation problem.
It's not a bug, it's a missing of feature which would be great for me:
1. I need the last frame of last animation to stay on screen instead of switching to default sprite.
How can i do it?
2. I want to call some method synchronously and by string name :)
Can i ApplyEvent with some syncro parameter?
Or call method not through point operator (obj.SomeMethod), but by some special function calling by string name ( name = "SomeMethod"; obj.CallFunction ( name );
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ForceTalkAnim
« Reply #9 on: April 29, 2005, 06:45:16 PM »

I've encountered the following problem while coding my game.
I think it's a common case of the described above (i may err). And (or) existance of solutions to these problems can easily resolve ForceTalkAnimation problem.
It's not a bug, it's a missing of feature which would be great for me:
1. I need the last frame of last animation to stay on screen instead of switching to default sprite.
How can i do it?
Well, if you only need it temporarily stay, you could set some loooong delay for the last frame. If you want it to stay forever, you'd have to go the hard way, attach a script to that sprite and the script would periodically set CurrentFrame to the last one (kind of brute-force approach, but it should work).

2. I want to call some method synchronously and by string name :)
Can i ApplyEvent with some syncro parameter?
Or call method not through point operator (obj.SomeMethod), but by some special function calling by string name ( name = "SomeMethod"; obj.CallFunction ( name );
I'm afraid that's not possible at the moment.. What do you need it for, some dynamic branching of code?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Art

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 54
    • View Profile
Re: ForceTalkAnim
« Reply #10 on: April 29, 2005, 07:03:49 PM »

1. Between start playing next animation and after the first one is finished, i need to make some preparation think. It takes very little time, some lines of code. But entity has time to blink. Entity has lot of sprites and there are lot of entities :). I could do a static last frame sprite for each of them, but it would take LOT of time, so i though may be we could do some option in sprite, like "leave last frame as default" or something like that, which would do all this work automatically. It would be really great.

2. I wrote some kind of internal language for easy programming of entity's behaviour. It like assembler:
play ANIMATION
loop N times
jmp LABEL (goto label)
je LABEL (goto if entity's property is set).
jne LABEL (goto if entity's property is not set)
and so on
call some_method <= here i need to call external entity's method, and name of function is operation's parameter.

i've implemented it with ApplyEvent with following infinite loop. which waits a semaphore from object, so this is not a really nececcary think.  ::rock

The first question really gives me trouble  ???
Logged
 

Page created in 0.044 seconds with 20 queries.