Player stops animating when Walk cursor is clicked on a blank spot (SOLVED!)

Started by Akril15, Mon 09/02/2015 19:39:54

Previous topic - Next topic

Akril15

I'm working on a game that has a couple of rooms where there are no walkable areas and the walk cursor only functions as a cursor that changes to an arrow when the player moves it over a hotspot designated as an exit and makes the player character leave the room when the player clicks on one of those hotspots.

The problem is that the player character is constantly animating in these rooms, and if I have the walk cursor selected and click anywhere on the screen that isn't designated as an exit hotspot, the character stops animating. I've tried setting the animation as a continuous idle animation, but I still get the same result.

Does anyone have any idea what might be causing this problem?

Thanks in advance.

johanvepa

Possibly, if the character is standing on a non-walkable area, and the walk cursor is clicked anywhere, the character should begin to walk, then immediately stop, since he is, after all, standing on a non-walkable...?

I have no working idea as to a solution, though, sorry.
You might want to turn the character "off" and instead use an animated object that looks exactly the same.

Cassiebsg

Shot in the dark, but did you remember to lock your animation loop? Maybe that's what's missing?
There are those who believe that life here began out there...

Crimson Wizard

Quote from: Akril15 on Mon 09/02/2015 19:39:54
Does anyone have any idea what might be causing this problem?
Do you have a walking command scripted anywhere in your script, like in on_mouse_click?

Akril15

Quote from: Nanuaraq on Tue 10/02/2015 21:10:36
You might want to turn the character "off" and instead use an animated object that looks exactly the same.
That would require a lot of work, since there are a lot of complicated character animations in each of the rooms this error appears in. If push comes to shove, that may be my only option, though.

Quote from: Cassiebsg on Tue 10/02/2015 22:00:44
Shot in the dark, but did you remember to lock your animation loop? Maybe that's what's missing?
Do you mean LockView? I tried that and LockViewFrame, but I'm afraid neither worked.

Quote from: Crimson Wizard on Wed 11/02/2015 08:29:17
Do you have a walking command scripted anywhere in your script, like in on_mouse_click?

I do have a custom walk script under on_mouse_click that reads:

Code: ags

if (player.Room==80 && mouse.Mode==eModeWalkTo) { //if player is in a room that requires a special walkto function
//lots of code here
}
else if (player.Room!=80 && mouse.Mode==eModeWalkTo) player.Walk(mouse.x,mouse.y, eNoBlock, eWalkableAreas);


i thought that adding player.Room!=35 (one of the rooms where I'm encountering this error) to the last line would fix the problem, but sadly, it didn't.

Crimson Wizard

Quote from: Akril15 on Fri 13/02/2015 01:04:54
Quote from: Crimson Wizard on Wed 11/02/2015 08:29:17
Do you have a walking command scripted anywhere in your script, like in on_mouse_click?

I do have a custom walk script under on_mouse_click that reads:

Code: ags

if (player.Room==80 && mouse.Mode==eModeWalkTo) { //if player is in a room that requires a special walkto function
//lots of code here
}
else if (player.Room!=80 && mouse.Mode==eModeWalkTo) player.Walk(mouse.x,mouse.y, eNoBlock, eWalkableAreas);


i thought that adding player.Room!=35 (one of the rooms where I'm encountering this error) to the last line would fix the problem, but sadly, it didn't.
Can you show how did you add that condition with room 35?
Also, is this the only one on_mouse_click in your project? They may present in other script modules.

E: Hmm, on other hand, LockView should have prevented walking animation from running AFAIK, and you say it did not. :undecided:
No, I just made a test, and calling Character.Walk actually stops any animation running previously. LockView does not prevent this. So it might be the problem.

NOTE: Walk overrides the animation; while Move does not. I remember now, it was the correct way to use Character.Move if you wanted special animation playing while character moves around the room. (That's unrelated to your case, because you need it to not moving at all),

Snarky

I'd verify that the if-condition is correct first, like CW says, but isn't there also a game-wide setting for something like "click on non-hotspot acts as walk-to"? That sounds like it could be involved somehow.

Akril15

Quote from: Snarky on Fri 13/02/2015 09:48:45
I'd verify that the if-condition is correct first, like CW says, but isn't there also a game-wide setting for something like "click on non-hotspot acts as walk-to"? That sounds like it could be involved somehow.
Good grief...I had "Automatically move the player in Walk mode" set to True this whole time. :( Setting it to False fixed my problem like that.

Oh, and to answer the question that both of you had, I changed that last line to read:
Code: ags
else if (player.Room!=80 && player.Room!=35 && mouse.Mode==eModeWalkTo) player.Walk(mouse.x,mouse.y, eNoBlock, eWalkableAreas);


Thanks again! This issue has been bugging me for months, and I'm glad to finally have it dealt with.

Snarky

Glad to help!
... And for the record, that condition looks fine, although as a matter of formatting it's generally better to have the action on a separate line.

SMF spam blocked by CleanTalk