Problem with "Characters turn to face direction" (SOLVED)

Started by , Wed 14/03/2007 19:02:19

Previous topic - Next topic

Mr T.

Hi.

I've got the "Characters turn to face direction"-field activated in the global settings, but it is not working the way I thought.  :-\

Blocking actions seem to override it, as far as i can see. If I've got a hotspot, for example, that is interacted with, I let my Player-Char walk there (blocking) and then run an animation (blocking). When that is done the "turn to..."-routine suddenly sets in and lets the char perform an unwanted additional "swing".

Is there an easy way around this? (Apart from deactivating the "turn to..." setting, I mean ;) )

If not, is there an easy way to script a turn-to-function oneself?

My own thoughts about this involved a function in the global script that is called after a mouse-click and that contains:
- detecting the loop of the character, to see which direction he is facing
- comparing the mouse-coordinates with those of the character, to see where he should turn to
- facing the "in between" directions one after each other with a pause, until the final direction is reached.

Is there a simpler solution?


Regards,
Mr T.


Ali

I could be wrong, but I've never noticed anything like that happen. I have an idea of what the problem might be, but I'm not sure.

When you click to make the character move he will turn, and then walk. After that, the "Characters turn to face direction" thing doesn't come into play as far as I'm aware.

Lets suppose that your character is facing down. If you call a blocking animation in which the character appears to be facing left, he will appear to turn and turn back. This may be what you're seeing when you observe an additional swing.

I would use...

cEgo.FaceLocation (cEgo.x+10, cEgo.y-10, eBlock); (or whatever values you need)

...to get the character facing the same way as he does in your animation, then so LockView and Animate.

Mr T.

#2
(Edit by strazer: No need to quote the whole post directly above yours!)

Hi Ali.

I'm already using a facelocation for that purpose in my script. I think my problem has to do with the unlockview- command

This is my code. It works OK without the "character turn.."-thingie.

  cEgo.Walk (x,  y,  eBlock, eWalkableAreas);
  cEgo.FaceLocation (cEgo.x-500, cEgo.y, eBlock);
  Wait (10);
  cEgo.LockView(3);
  cEgo.Animate(9, 1, 0, eBlock, eForwards);
  cEgo.UnlockView();
  cEgo.FaceLocation (cEgo.x-500, cEgo.y, eBlock);

When the view is unlocked, the character is set back to loop one of his normal view. So I use the last facelocation to flip him back into looking-direction he had during the animation. As said, this works perfectly if "character turn..." is off. If it's on though, the last facelocation doesn't seem to be executed fast enough and the unlocking of the view becomes visible to the human eye (At least that's my theory at the moment.) Don't know, if anything can be done about that.

Regards,
Mr T.

Ashen

I think the problem is that with 'Character turns...' checked, you're supposed to see the character turn. That's what you'd expect to happen, and it sounds like that's what IS happening. (I could be missing something, though.)

What if you change the Character's Loop directly, instead of using the second FaceLocation:

Code: ags

  cEgo.Walk (x,  y,  eBlock, eWalkableAreas);
  cEgo.FaceLocation (cEgo.x-500, cEgo.y, eBlock);
  Wait (10);
  cEgo.LockView(3);
  cEgo.Animate(9, 1, 0, eBlock, eForwards);
  cEgo.UnlockView();
  cEgo.Loop = 1;
I know what you're thinking ... Don't think that.

Mr T.


SMF spam blocked by CleanTalk