eBlock / eNoBlock and looking at an object

Started by Nickydude, Tue 23/12/2008 23:50:15

Previous topic - Next topic

Nickydude

Hi folks, brand spanking newbie here trying to figure AGS out  :=

I'm wondering if anyone can point me in the right direction with the following:

I have an object that the character walks to to 'look' and see what it is and I use the following code

function hPillow_Look()
{
  cEgo.Walk(104, 160, eBlock, eWalkableAreas);
  cEgo.Say("Looks like a comfy pillow to me.");
}

This works fine, he walks to the object to see what it is. At the moment the player can't do anything with the character till he's gone over to the object and looked at it, I'd like to be able to have the character change direction if the player clicks somewhere else, on the way to the object. I changed eBlock to eNoBlock but then the character doesn't walk to the object and just says what it is from where ever position he is in the room.

Basically I'd like the character to walk to an object if it's to be looked at, but be able to divert him somewhere else if need be as he's going towards the object. Any help would be appreciated. :)
Best Regards,
Nickydude
www.madladdesigns.co.uk

AGS Beginner's Guide - All you'll ever need!

Dualnames

Ok, well there's a module for that called noblock but well, you need to do that.
I'm assuming your using sierra style interface. Find a line like this(on the global script):

ProcessClick(mouse.x,mouse.y,emodewalkto);

and replace it with this:

player.Walk(mouse.x,mouse.y,eNoBlock,eWalkableAreas);

Also remove that walk line from the object interaction.

or alternatively you can:
function hPillow_Look(){
  cEgo.Walk(104, 160, eNoBlock, eWalkableAreas);
if ((cEgo.x==104)  && (cEgo.y==160) {
cEgo.Say("Looks like a comfy pillow to me.");
}
}

I think what I've provided might not really do the trick. So in case a guy called Khris posts follow his advice.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Nickydude

Best Regards,
Nickydude
www.madladdesigns.co.uk

AGS Beginner's Guide - All you'll ever need!

Khris

#3
EDIT: Do not use the download link or example code below! Current version and example code can be found in the linked post.
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/graphicalfunctional-questions-for-cmi-style-guiinventorymenus/msg636639852/#msg636639852

Here's the module I coded some time ago: GotThere.scm (right-click, save as...)

Import it into AGS, then use it as follows:


Code: ags
function x() {

  if (!GotThere()) GoFace(90, 130, eUp);  // example coords
  else {
    // actual interaction code
  }
}

GoFace(x,y,d) makes the player character walk non-blocking to coords x,y; as soon as they got there without an intermittent click, they'll face direction d, then the interaction is called again, with GotThere() being true now.

maximusfink


SMF spam blocked by CleanTalk