Two questions, Cancel walk to object and interact, and object blocking

Started by Rentin, Sun 25/01/2009 21:59:58

Previous topic - Next topic

Rentin

Hello, I have two questions. The first one is:

Is there a way to cancel an interaction by clicking elsewhere? What I mean by this is say I click look at object, well the character will walk from its current position to the object first then he will say the description of the object and that whole action is blocked. What I'm asking is if there is a way to cancel the blocked interaction, so if the player clicks somewhere else while that interaction is being executed is there a way to cancel that current interaction and have the character walk to where the player clicked instead, you know just like in any regular Lucas Arts games for example. Is there a way to do that? If so, how?

My second question is quick and simple and I think I already know the answer to it but I want to make sure first.

Is there a way to make an object block diagnally instead of a big square? My guess is no but I want to make sure. So a simple yes or no anwser will do fine here. And if the answer is yes, then how?

Thank you
I've got FIVE death cards... That can't be good...

Matti

Regarding question 1:

Look up eBlock and eNoBlock in the manual. If you write character.Walk(x,y,eNoBlock) for example you're able to click anywhere to redirect the character. eNoBlock can be used with the following commands:

Character.Animate, Character.FaceCharacter, Character.FaceLocation, Character.FaceObject, Character.Move, Character.Walk, Character.WalkStraight, Object.Animate, Object.Move

Khris

Here's a tested and working solution:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36383.msg477380#msg477380

Regarding 2:
If the object is static, remove the walkable area around it. If it isn't, use several objects. (To avoid duplicate code, simply put e.g. "wall_Interact" into all the objects' "interact with object" fields.)

Rentin

Quote from: matti on Sun 25/01/2009 22:13:00
Regarding question 1:

Look up eBlock and eNoBlock in the manual. If you write character.Walk(x,y,eNoBlock) for example you're able to click anywhere to redirect the character. eNoBlock can be used with the following commands:

Character.Animate, Character.FaceCharacter, Character.FaceLocation, Character.FaceObject, Character.Move, Character.Walk, Character.WalkStraight, Object.Animate, Object.Move


Alright I tried replacing eBlock with eNoBlock but he didnt walk to his destination before executing the rest of the code. That's what I'm saying, my understanding is that in order to have the character WALK to x,y BEFORE interacting with the object you had to eBlock so it wouldn't execute the rest of the code before he got there. I'm wondering if there is a way to cancel that whole walk and interaction with a click of a button. Here is my code where I tried your suggestion with eNoBlock where he didnt even walk to the object before the interaction:

Code: ags

function oFridgedoor_AnyClick()
{
  if (mouse.Mode==eModeOpen)
  {
  player.Walk(470, 170, eNoBlock); 
  oFridgedoor.Visible=false;
  player.Say("Hmmm, Not much in here...");
   }
}


Did I do something wrong?
I've got FIVE death cards... That can't be good...


Rentin

I've got FIVE death cards... That can't be good...

Rentin

Could you show me how I would implement the GotThere code into

Code: ags

function oFridgedoor_AnyClick()
{
  if (mouse.Mode==eModeOpen)
  {
  player.Walk(470, 170, eNoBlock); 
  oFridgedoor.Visible=false;
  player.Say("Hmmm, Not much in here...");
   }
}



To make it work pls?  I played around with it a bit and I was able to walk the oFridgedoor without it blocking but once it got there nothing happened, it would continue with the rest of my code. Can you show me how it's done?
I've got FIVE death cards... That can't be good...

Khris

It should work like this:

Code: ags
function oFridgedoor_AnyClick() {

  if (!GotThere()) GoFace(470, 170, eUp);  
  else {
    if (mouse.Mode==eModeOpen) {
      if (!oFridgedoor.Visible) player.Say("It is already open.");
      else {
        oFridgedoor.Visible=false;
        player.Say("Hmmm, Not much in here...");
      }
    }
  }
}

SMF spam blocked by CleanTalk