Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: Martin on February 17, 2004, 10:39:51 AM

Title: Problems...
Post by: Martin on February 17, 2004, 10:39:51 AM
I have two problems... The first is that the object that ego is picking up in my game doesn
Title: Re:Problems...
Post by: Joey on February 17, 2004, 02:33:50 PM
instead of erase(o1);
try erase(gun);
if that doesnt work, try erase("gun");

im not sure if that will work. i forget how i made it so you wont walk over an object. i changed some lines in the tutorial and ego didnt walk over it. ill try and post the code later.
Title: Re:Problems...
Post by: MagickPoultry on February 17, 2004, 06:06:47 PM
Where in the logic do you have "draw(o1)"?  Make sure it isn't drawing it again after it erases it.
Title: Re:Problems...
Post by: Martin on February 18, 2004, 09:19:29 AM
This is the end of the logic:

     erase(o1);
      get("gun");
    }
    else {
      print("You're not close enough.");
    }
  }
  else {
    reset(input_parsed);    // let logic 90 take care of it
  }
}

return();

I tried to write both "gun" and gun, but it came up an error that said that it should be an object, and when I write o1, it says "compile successful".
Title: Re:Problems...
Post by: MagickPoultry on February 18, 2004, 10:46:05 AM
I'm sorry.  I should've been more specific.  Is there a "draw(o1)" command somewhere in the logic that gets executed every cycle?  For example, is it outside of the "if (new_room)" block?  If it is somewhere outside of any "if" statement, it will get executed every cycle, and the gun will look like it never got erased.  Or, if it is inside of an "if" statement that is still true during the next cycle, the same thing will happen.  So, probably, unless there is a reason to do otherwise, you should put the draw command inside the "if (new_room)" section.  If that's where it is already, then I don't know what the problem is off-hand.
Title: Re:Problems...
Post by: Chris Cromer on February 18, 2004, 11:55:03 AM
Joey is completley wrong so don't worry about doing those things because they will not work.

It would only have worked if he had defined the o1 as gun somewhere else, which most likely he didn't. I don't even define my objects when I work with AGI. I use o1, o2, o3, etc... instead of giving them defined names. And you don't have to define a name either.
Title: Re:Problems...
Post by: Martin on February 18, 2004, 02:46:52 PM
Thanks Jimmy! That was the problem.
Anyone knows anything about my other problem?
Title: Re:Problems...
Post by: MagickPoultry on February 18, 2004, 07:44:09 PM
I'm not quite sure of what you mean by your second problem.  Is it "observe.objs(o1)" that you want, as opposed to "ignore.objs(o1)"?  That would make it so the ego can't walk through the bottom line of the object.  Is that what you want?
Title: Re:Problems...
Post by: Martin on February 19, 2004, 09:45:37 AM
Hmm... It is hard to explaine. Just so ego can`t walk over an object, I mean so that he stops when he reaches it.
Title: Re:Problems...
Post by: MagickPoultry on February 19, 2004, 11:36:51 AM
I'm still not sure exactly what you mean, but how about doing the following:

distance(ego,o1,v255);

if (v255 < 5) {
  if (!isset(f255)) {
    set(f255);
    ego_dir = 0;
  }
}
else {
  reset(f255);
}

You can replace v255 with another variable and f255 with another flag, and you can replace 5 with whatever distance away from the object that you want the ego to stop walking.  What this ought to do is when the ego is walking and gets within a certain distance from the object, he'll stop, and then if the player presses an arrow, he should start walking again.  If he gets back within the distance again, he'll stop again.
If it's an object that you can pick up, once it gets erased, the distance between it and the ego should always be 255, so the ego shouldn't stop anymore.

There are other ways of doing the same thing.