Want player to be able to interrupt walking to object [SOLVED]

Started by Jasmine, Fri 26/03/2010 23:06:38

Previous topic - Next topic

Jasmine

I'm sure this has been asked before, but I can't figure out the keywords to find it, sorry!

Goal: click "look" on object -> character walks to object, but player can click somewhere else to stop walking to the object -> character says something about object.

Problem: if I use eBlock, the player can't interrupt the walk.  If I use eNoBlock, the script continues to run and the character says something before s/he reaches the object.  I'm sure the solution uses "character.Moving", but the only example I could find in the manual was:
Code: ags
cEgo.Walk(125, 40);
while (cEgo.Moving) Wait(1);

which won't work becuase the player can't do anything while waiting.

InCreator

Force him to walk to the point he's at right now (thus-no walking) maybe?

Calin Leafshade

what about something like:

Code: ags

while(cEgo.Moving && !mouse.IsButtonDown(eMouseLeft)) Wait(1);


Havent tested so i might have got some of the syntax wrong.

but the idea is that if you click the mouse the loop will exit.

Jasmine

That does not appear to have any effect, Calin.  (The character talks and then walks.)  Leaving the part about the mouse button out causes it to mimic eBlock, so something about the mouse button part is ending the loop when it begins, instead of when the mouse is clicked.

Khris


Jasmine


SMF spam blocked by CleanTalk