Command Walk without eBlock no move the char (SOLVED) - With other problem!

Started by Nahuel, Wed 12/08/2009 19:02:11

Previous topic - Next topic

Nahuel

Hello there! My problem is when I used the command
Character.Walk(int x, int y, optional BlockingStyle, optional WalkWhere);

the game enter in a wait mode, how can I make a function where I can stop the moving or cancel the action, when I click in other area, hotspot ANYTHING (like the lucas games) because it's too many time wasted.

I'm Trying to make a function MoveChar using "while" player.Walking
and when (Mouse.IsButtonDown(eMouseLeft) || Mouse.IsButtonDown(eMouseRight)
player.StopMoving();

but I don't undertand very well.

Thanks for your time!!

Nahuel.
Life isn't a game. Let's develop a life-like-game.


Nahuel

Life isn't a game. Let's develop a life-like-game.

Mazoliin

Look's like you should place the function code after the on_mouse_click function in the global script, not inside it, after.

Nahuel

Quote from: Mazoliin on Wed 12/08/2009 21:01:44
Look's like you should place the function code after the on_mouse_click function in the global script, not inside it, after.

Thanks Mazoliin!! It's working now!

But it's doesn't what I need because I need some like this
this is from a SCUMM template by RULAMAN

Simple while player.Moving if Button Rigth || Left
              cancel

Code: ags

function MovePlayerEx (int x, int y, int direct)
{
  // Move the player character to x,y coords, waiting until he/she gets there,
  // but allowing to cancel the action by pressing a mouse button.

	GUI *guiAt = GUI.GetAtScreenXY(mouse.x, mouse.y);
	InventoryItem *invAt = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);

	if ( g_PlayerCanMove > 0 )
  {
    int cursorspritenumber = 16,
    blankcursorspritenumber = 26;
		GScancelable = 0;

		Mouse.ChangeModeGraphic(eModeWait, cursorspritenumber);

		if (direct == 0)
			player.Walk(x, y);
		
    else
			player.Walk(x, y, eNoBlock, eAnywhere);

		// wait for release of mouse button
    while (player.Moving && (Mouse.IsButtonDown(eMouseLeft) || Mouse.IsButtonDown(eMouseRight) ))
    {
      Wait (1);
      Mouse.Update();
      CheckDefaultAction ();
    }
    // abort moving on new mouse down
		
    while (player.Moving)
    {
      if ( Mouse.IsButtonDown (eMouseLeft) && ( null == guiAt || null != invAt ))
      {
        player.StopMoving();
        GScancelable = 1;
      }
      else if ( Mouse.IsButtonDown(eMouseRight) && (null == guiAt || null != invAt ))
      {
        player.StopMoving();
        GScancelable = 2;
			}
      else
      {
        Wait (1);
        Mouse.Update();
        CheckDefaultAction();
      }
    }
    mouse.ChangeModeGraphic(eModeWait, blankcursorspritenumber);

		if ( GScancelable == 0 && player.x == x && player.y == y )
		{
			return 2;
		}
    else if ( GScancelable == 0 )
		{
			return 1;
		}
    else
		{
			return 0;
		}
  }
  else return 0;
}



Thanks!!!!!
Life isn't a game. Let's develop a life-like-game.

Khris

I've written a module to do that, based on the code in the other thread.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36383.msg477380#msg477380

Please don't say "it doesn't what I need", tell us what you need it to do.

Nahuel

Quote from: KhrisMUC on Wed 12/08/2009 21:33:14
I've written a module to do that, based on the code in the other thread.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36383.msg477380#msg477380

Please don't say "it doesn't what I need", tell us what you need it to do.

oh, I'm sorry KhrisMUC. Sometimes I write with mixing two languajes (English and Spanish) I apologize.

Thanks for the information, and sorry again.

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Khris

There's no need to apologize, I was just interested in why the other method failed to do what you wanted it to.

Nahuel

Quote from: KhrisMUC on Wed 12/08/2009 22:17:24
There's no need to apologize, I was just interested in why the other method failed to do what you wanted it to.



KhrisMUC,
         
          Unfortunately yesterday I could not answer.
          I'm going to expain as best I can (obviously for my English).

I need a method to walk to the hotspot or object, and when use the funcion (for example) PickUp, the player continue walk without a wait time and cancel the action with one click in other part of the room (like Indiana Jones), but these methods doesn't work with my game (I realy don't know) becuse I put the functions in the rigth place.

The character must cancel their action when with the mouse touch in other

It's like SCUMM. Or Indiana Jones or Maniac Mansion.

Thank You.

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Khris

Did you try the module I linked you to? It does exactly what you want.

Nahuel

Quote from: KhrisMUC on Thu 13/08/2009 17:01:35
Did you try the module I linked you to? It does exactly what you want.

Yes KhrisMUC but doesn't work.
Probably some in my script make conflicts, I still working with your module:-\

Thanks for help me. KhrisMUC!

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Nahuel

Quote from: peillat.nahuel on Thu 13/08/2009 17:09:33
Quote from: KhrisMUC on Thu 13/08/2009 17:01:35
Did you try the module I linked you to? It does exactly what you want.

Yes KhrisMUC but doesn't work.
Probably some in my script make conflicts, I still working with your module:-\

Thanks for help me. KhrisMUC!

Nahuel.

KhrisMUC ! It's WORK!!! I has a problem with the direction and coordenades!! Now I can use it to perfection!!!!

Thanks for your script!! I appreciate you very much

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Khris


Nahuel

KhrisMUC,
               exist any way that, during the time that the character walks to the object or hotspot, return to eModeWalkTo by default?? Because my char still with the action I select... understand what I mean??
   
I understand if it is difficult to understand.  :=

Thanks.

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Khris

When exactly do you want the mouse mode to switch back to eModeWalkto?
After the player interrupted the action by clicking on nothing?

Nahuel

Quote from: KhrisMUC on Thu 13/08/2009 20:05:16
When exactly do you want the mouse mode to switch back to eModeWalkto?
After the player interrupted the action by clicking on nothing?

Exactly, do you play some game like indiana jones or monkey island or the dig?? like this when you touch in nothing, the char cancel de action and automaticly the mouse.Mode is WalkTo.

Thanks

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Khris

If you look at the on_mouse_click function in GlobalScript.asc, it should say in there:
Code: ags
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }


Replace that with
Code: ags
  else if (button == eMouseLeft) {
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) ProcessClick(mouse.x, mouse.y, eModeWalkto);
    else ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }

Nahuel

Quote from: KhrisMUC on Thu 13/08/2009 23:02:05
If you look at the on_mouse_click function in GlobalScript.asc, it should say in there:
Code: ags
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }


Replace that with
Code: ags
  else if (button == eMouseLeft) {
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) ProcessClick(mouse.x, mouse.y, eModeWalkto);
    else ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }


KhrisMUC,
              I appreciate all your help.
              Thank you very very much!
              Any problems I have, I will notify you.
              As soon as possible I will make the changes!!!

Thanks KhrisMUC!!! Thank you!

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Nahuel

KhrisMUC doesn't return to eModeWalkto!!  :'(  I 'm fried!! I still working on!!

Thanks!!

Nahuel.
Life isn't a game. Let's develop a life-like-game.

Matti

Quote from: peillat.nahuel on Fri 14/08/2009 14:03:18
KhrisMUC doesn't return to eModeWalkto!!  :'(  I 'm fried!! I still working on!!

Thanks!!

Nahuel.

You're fried just because Khris doesn't return to eModeWalkto?  ;D

No, seriously, KhrisMUCs script doesn't change the cursor, but lets the character walk. Try this instead:

Code: ags

  else if (button == eMouseLeft) {
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) {
      mouse.Mode = eModeWalkto;
      ProcessClick(mouse.x, mouse.y, eModeWalkto);
    else ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }


I guess this is what you sere looking for.

SMF spam blocked by CleanTalk