SOLVED:Making a chaser not see you

Started by Surplusguy, Sun 31/03/2013 20:01:05

Previous topic - Next topic

Surplusguy

I probably shouldn't make a thread for this, but I have a problem. In my game, there's a chase sequence that I've set up, and it's running swimmingly. The thing is, I want to set up a part of a specific room, the bathroom, where you are able to go behind a shower. I want it to be so when you're behind the shower, the guy following you will come into the room, but not chase you while he's there. I want him to just stand there. From there, I want you to be able to go out from behind the shower, and he'll chase you again. Also, I want you to be able to use an item, specifically a rock, on him from behind the shower. This will play an animation of you hurling the rock and knocking him out. Also, if possible, I'd like him to leave after about ten seconds (though this one is optional). Is this possible? Or am I asking too much of the engine?

Help appreciated!:)
GHRPLTSM

Snarky

Yes, all of this is possible, and quite easy to do.

As we recently learned, we can control whether a character follows you by calling chaserCharacter.FollowCharacter(player) to make him start and chaserCharacter.FollowCharacter(null) to make him stop. One way to make it so going behind the shower makes him stop following you, and leaving makes him start again, is to use a region, and tie the FollowCharacter commands to the player enters/exits region events.

Throwing a rock is just a normal scripting command (i.e. "use item on character"). To make him leave after ten seconds, use a timer.

If these things don't ring a bell, you should probably have another look through the manual.

Surplusguy

#2
I knew about the region areas, just didn't know how I should implement them in the right order. Thanks for the help!  :-D
(Also- didn't make it clear- I know you can throw the rock normally, I wanted you not to be able to throw it if you weren't behind the shower- but thanks anyway!)
GHRPLTSM

Khris

In the "throw rock" interaction, check whether the player is standing on the region:

Code: ags
function cChaser_Useinv {
  if (player.ActiveInventory != iRock || player.Room != 5) {
    Display("No.");
    return; // exit function
  }
  
  // we are in room 5, using the rock with cChaser

  if (Region.GetAtRoomXY(player.x, player.y) != region[1]) {
    Display("You can't do that right now.");
    return;  // exit function
  }
  // throws rock
}

Snarky

Depending on exactly how your game should behave, you'll probably also have to do a bit of extra work so that, for example, if you leave the shower while the guy chasing you is in the bathroom, and then pop back behind the curtain, he doesn't immediately forget about you and stop chasing (because that would be silly). And also to make sure that after you knock him out, his unconscious body doesn't still chase you around. :)

Lots of little stuff like that, but once you have the basic idea, you should be able to take care of it.

BTW, the description reminds me of the last chapter of Dagger of Amon Ra, which really got my heart racing when I was a kid, having to run round and hide with a killer after me. Good luck!

Surplusguy

#5
Actually, one of the
Spoiler
ways you take down the killer is one of the possible deaths in the original Laura Bow
[close]
so stay tuned... and thanks guys!

GHRPLTSM

SMF spam blocked by CleanTalk