Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Ganderzz on August 17, 2005, 07:42:03 PM

Title: Guards
Post by: Ganderzz on August 17, 2005, 07:42:03 PM
is it possible to make it where something like a guard.. when he see's you something happens (like u go to jail or something)?
Title:
Post by: WarxePB on August 17, 2005, 08:34:44 PM
If he's stationary, easily. Just make a few "Touched By Hero" events in his line of sight, and when the hero steps on those events, it does something.

If the guad can face different directions or if he moves, it gets a bit more difficult.
Title:
Post by: Dashman on August 18, 2005, 12:32:08 PM
Put the guard on a single square facing, let's say, left, then face up, then face left, then down. The hero must pass left of him. The corridor is 2 steps wide. At the left of the guard put 2 events. Both of them on hero touch. Put a fork condition. If guard is facing left, a battle start, or you get kicked from the place. If the guard is not facing left when you are there, you can pass. I have not tried it, but I think it would work.

But if you want them to move, the method of Warxe_PhoenixBlade would be better, because I think it would be too hard to make them move and see you from a distance.
Title:
Post by: Moosetroop11 on August 18, 2005, 01:30:50 PM
Or you could do 4 pages, with a switch each. When the 'face down' switch is active, the guard looks down, and his line of sight for him when looking down is activated, etc. You'll need a parralel process for it to work.
Title:
Post by: Bluhman on August 18, 2005, 01:39:26 PM
Moving guards: When doing this, variables are your friends.

Ok. First you should make 4 variables that determine the guards X and Y, and the players X and Y.

Then make several fork conditions for each direction.

For each direction, check for the following

If the guard is facing left, check for an equal Y value for both the hero and guard, and the guards X value more than that of the heroes

If the guard is facing right, check for an equal Y value for both the hero and guard, and the guards X value less than that of the heroes

If the guard is facing up, check for an equal X value for both the hero and guard, and the guards Y value more than that of the heroes

If the guard is facing down, check for an equal X value for botht the hero and guard, and the guards Y value less that of the heroes.

Then if any of those succeed, have the guard say "Hey" and there you go.

Edit: Err... They'll be able to see you through walls... Hmm...
Title:
Post by: Ganderzz on August 18, 2005, 04:10:25 PM
thanx :)
Title:
Post by: Linkforce on August 18, 2005, 09:06:11 PM
This helped me too.  Thanks all.