Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: actor.TalkAsync() plays the "left" animation instead of the "right" one  (Read 5392 times)

0 Members and 1 Guest are viewing this topic.

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile

Hello everyone. I have a very weird issue I cannot solve.

I have only left and right animations for my main actor. No up, down or diagonal animations exist. I simply use the left and right animations everywhere:

Code: WME Script
  1. ; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\
  2.  
  3. ACTOR
  4. {
  5.         NAME = "MainActor"
  6.         CAPTION=""
  7.         SCALABLE = TRUE
  8.         INTERACTIVE = FALSE
  9.         X = 400
  10.         Y = 460
  11.         SCRIPT="actors\MainActor\MainActor.script"
  12.  
  13.         FONT = "fonts\outline_red.font"
  14.  
  15.         ANIMATION
  16.         {
  17.                 NAME       = "idle"
  18.  
  19.                 LEFT       = "actors\MainActor\left\idle.sprite"
  20.                 RIGHT      = "actors\MainActor\right\idle.sprite"
  21.                 UP         = "actors\MainActor\right\idle.sprite"
  22.                 DOWN       = "actors\MainActor\right\idle.sprite"
  23.  
  24.                 UP_LEFT    = "actors\MainActor\left\idle.sprite"
  25.                 UP_RIGHT   = "actors\MainActor\right\idle.sprite"
  26.                 DOWN_LEFT  = "actors\MainActor\left\idle.sprite"
  27.                 DOWN_RIGHT = "actors\MainActor\right\idle.sprite"
  28.         }
  29.  
  30.         ANIMATION
  31.         {
  32.                 NAME       = "walk"
  33.  
  34.                 LEFT       = "actors\MainActor\left\walk.sprite"
  35.                 RIGHT      = "actors\MainActor\right\walk.sprite"
  36.                 UP         = "actors\MainActor\right\walk.sprite"
  37.                 DOWN       = "actors\MainActor\right\walk.sprite"
  38.  
  39.                 UP_LEFT    = "actors\MainActor\left\walk.sprite"
  40.                 UP_RIGHT   = "actors\MainActor\right\walk.sprite"
  41.                 DOWN_LEFT  = "actors\MainActor\left\walk.sprite"
  42.                 DOWN_RIGHT = "actors\MainActor\right\walk.sprite"
  43.         }
  44.  
  45.         ANIMATION
  46.         {
  47.                 NAME       = "talk"
  48.  
  49.                 LEFT       = "actors\MainActor\left\talk.sprite"
  50.                 RIGHT      = "actors\MainActor\right\talk.sprite"
  51.                 UP         = "actors\MainActor\right\talk.sprite"
  52.                 DOWN       = "actors\MainActor\right\talk.sprite"
  53.  
  54.                 UP_LEFT    = "actors\MainActor\left\talk.sprite"
  55.                 UP_RIGHT   = "actors\MainActor\right\talk.sprite"
  56.                 DOWN_LEFT  = "actors\MainActor\left\talk.sprite"
  57.                 DOWN_RIGHT = "actors\MainActor\right\talk.sprite"
  58.         }
  59. }
  60.  

I display the dialogue in comic book bubbles above the actors. I don't use actor.Talk(), instead I have my own mechanism that prints the text in a static control inside the bubble. But, I use actor.TalkAsync("", null, 10000) to trigger the talk animations of each actor.

My issue is that, sometimes my main actor uses the opposite direction animation. When I click on another actor, he walks toward the point I want him to stand, turns to the other actor (I explicitly call MainActor.TurnTo(direction)). e.g. He has direction 2 (DI_RIGHT) but, while TalkAsync is running, he turns left (i.e. the "left" talk animation is played). Game.Msg(MainActor.Direction) displays 2 which is the correct direction.

This does not always happens. One functionality of my game is that when user clicks on the exit, he immediately exits without walking. So, if I am at a scene and talking to another actor and I am turned left while talking, then I click on exit, go to another scene (through the map), and talk to another actor, this issue occurs. When I click somewhere to walk around and then go back and talk to the other actor, the issue vanishes, but not always!

Is there something I don't understand about TalkAsync or actor directions?
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: actor.TalkAsync() plays the "left" animation instead of the "right" one
« Reply #1 on: January 26, 2016, 02:40:52 PM »

Have you tried to manage your actions with Talk() instead TalkAsync()? This way you can figure out if the problem is related to the  asynchronous condition.
Another test I would do is not to dispose Duration and let the engine to manage the duration according to the text and see how it behaves.
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: actor.TalkAsync() plays the "left" animation instead of the "right" one
« Reply #2 on: January 26, 2016, 05:34:44 PM »

Could be the engine bug I was facing some time ago. Talk anim cache was not always invalidated properly. Could be reproduced if you had several entities to talk to, all with the same point for the actor (so the actor will not walk to a new point when a different entity is clicked) but with different directions to talk to.

I committed a fix some time ago:

https://bitbucket.org/MnemonicWME/wmelite/commits/dc23b38b043ccf0fd91917039227e1e04f49bd7c

So if your scenario triggers this bug, you are doing everything correct usage-wise.
Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: actor.TalkAsync() plays the "left" animation instead of the "right" one
« Reply #3 on: January 26, 2016, 09:46:36 PM »

Hello guys, thanks a lot for your replies.

@valter.home It seems that is is only TalkAsync() that causes the issue. I have tried with Talk() and the actor doesn't turn to the opposite direction. Initially I wasn't using duration, I just used TalkAsync("                             ") but had the same bug.

@HCDaniel I was suspecting that it might be something like this. I didn't want to blame the engine until I got some more input from others. I suspect that this is the problem. The common scenario for this to occur is:

1) Enter location and, without moving you talk to an actor. Let's say direction is Left.
2) Click on exit, click on map location.
3) Map loads and actor is facing Right.
4) Either if I walk Right to talk to the other actor or if the actor is near and just talk without moving, the main actor turns Left only while TalkAsync() is running. When TalkAsync() finishes the actor returns to the correct direction.

If before (4) I walk my main actor Left and then turn Right to talk, the issue does not occur. Is this the bug you are referring to?
I see that the link you provided is for WMELite. I am not using Lite. I am using WME v.1.9.001
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: actor.TalkAsync() plays the "left" animation instead of the "right" one
« Reply #4 on: January 27, 2016, 09:33:33 AM »

The fix also made it into "normal" WME:

https://bitbucket.org/MnemonicWME/wme1/commits/0e420c43be4fa45830778554a467b9ca88eaa8c0

I almost believe its the same bug, however, we saw it with "normal" talk also, not just "talkAsync". It should occur every time that the actor turns to a direction that is "next" to the one he was talking to previously, without walking in between, i.e. from UP to either UP_LEFT or UP_RIGHT. Then, incorrectly, the old UP direction (which was cached) is used.

Let me check if I still have a working setup to compile "normal" WME. Then I can upload an executable in the next days for you to test.
Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: actor.TalkAsync() plays the "left" animation instead of the "right" one
« Reply #5 on: January 28, 2016, 11:27:35 PM »

Thanks HCDaniel. I don't have time to investigate further but I have found a hack to solve the problem. On entering a scene, I first turn the main actor to the oposite direction and then to the correct one (using actor.TurnTo()).

I will investigate when I am done with our game. If you have more info or have time to upload the executable, I would be grateful.
Logged
 

Page created in 0.037 seconds with 24 queries.