Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Terminator2

#1
Thank you so much, Matti. I tried your code and it works. I also want to thank you, Khris, as you did give me a better understanding of coding for other parts of my game. Thanks, everyone.
#2
I entered the code like this:
Code: ags

  if (cLibrarian.Moving || cLibrarian.Animating) {
    return;
  }

  if (TimerStart == true) {
    location = Random(0); // Randomize 9 numbers
    TimerStart = false; // Stop timer from randomizing
    Walked = false;
    return;
  }

  if (location == 0) {
    if (cLibrarian.x == 444 && cLibrarian.y == 229) {
      Walked = true;
      cLibrarian.FaceDirection(eDirectionRight);
    cLibrarian.LockView(39);
    cLibrarian.Animate(2, 5, eOnce, eNoBlock, eForwards);
    return;
    }
    if (!Walked) {
      cLibrarian.Walk(444, 229, eNoBlock, eWalkableAreas);
      return;
    } 
  }
  
  cLibrarian.UnlockView();
  Walked = false;
  TimerStart = true;

If I remove the first line then the librarian just walks in the initial spot forever.
#3
I tried the code that you suggested Khris but it still isn't working. However, if I remove the return; from the if(!walked) statement the librarian performs the animation but on the starting point. If I remove the return; from below the animation statement the librarian only walks to the designated location.

So basically, I'm getting either one but not both as I wanted. I also tried a while loop to see if I can get the result but still nothing.

Any ideas, anyone?
#4
Hello everyone,

I need some help resolving an issue with the following code. Now what I want is to have my NPC (the librarian) randomly walk to various locations and then when he gets to the spot, he needs to perform an animation. I can get it working for the most part but the animation doesn't work when I use the eNoBlock parameter. In other words, the librarian just stands there. Here's the code in the room repeat function:

 
Code: ags

if (TimerStart == true) {
    location = Random(0); // Randomize 9 numbers
    TimerStart = false; // Stop timer from randomizing
  }
  
  if (TimerStart == false) { // If timer is paused then send librarian to location
    if (cLibrarian.Moving) {
      // If librarian is moving do nothing
    } else {
      if (location == 0) {
        if (Walked == false) {
          cLibrarian.Walk(444, 229, eNoBlock, eWalkableAreas);
        }
          if (cLibrarian.Moving == true) {
            return;
          } else {
            Walked = true;
            cLibrarian.FaceDirection(eDirectionRight);
            cLibrarian.LockView(39);
            cLibrarian.Animate(2, 5, eOnce, eNoBlock, eForwards);
            if (cLibrarian.Animating == true) {
              return;
            } else {
              cLibrarian.UnlockView();
              Walked = false;
              TimerStart = true;
            }
          }
      }
	}
  }


There are normally 9 locations but for testing purposes, I just have it as 0.
When I do debug and the engine gets to the Animate command it goes and loops around through the GlobalScript repeatable
and doesn't come back to the room repeatable.

If I do the eBlock parameter it works but I can't control Ego.

Thanks.
SMF spam blocked by CleanTalk