Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: MajorSkalle on February 22, 2008, 09:08:21 PM

Title: Line Of Sight
Post by: MajorSkalle on February 22, 2008, 09:08:21 PM
Yes, people. I am absolutely aware that this has been posted LOADS of times. I have been searching GamingW and Charas (even google), and really, I can't find anyone who can make a more detailed description of what exactly needs to be done.

Well, over to my problem. I want to place guards on a map, and when hero is seen, something happens. It really don't matter.
Actually I want the guards to move, but I can't even get this to work with stationary guards. Creating events with conditional branches and "touched by" will not work. If the hero already stands in the sight of the guard, he won't be noticed.

So, it is here you guys come in. I know variables is the thing here. I'm not really good at variables (I know what they are, but can't really use them).
So please. I would appreciate some (detailed) help here.

Thank you.

EDIT: Wow. Forgot. I am talking about RPG Maker 2003. Sorry for that.
Title:
Post by: Moosetroop11 on February 23, 2008, 01:33:15 AM
With the stationary guards, have you tried making it 'collision with' rather than 'touched by'?

I had the same problem where if you stood still you couldn't be seen. I can't remember whether collision with hero makes it work...
Title:
Post by: MajorSkalle on February 23, 2008, 09:38:17 AM
Quote
Originally posted by Moosetroop11
With the stationary guards, have you tried making it 'collision with' rather than 'touched by'?

I had the same problem where if you stood still you couldn't be seen. I can't remember whether collision with hero makes it work...


Well, I just tried but it didn't work. Actually it crashed. I created a conditional branch to check if the guard was facing in the right direction, and tried adding a 0.1 pause as I have heard that may work.
But no luck here.

Variables is the only way out is it?
Title:
Post by: MajorSkalle on March 02, 2008, 09:39:29 AM
Well. Finally I found a understandable guide. (I found it  HERE (http://www.rmtutorials.com/), check out the intermediate tutorials)
At least I got the guards to notice the hero.

My only problem is that the guard may even see the hero if he moves in the back. Suggestions?
Title:
Post by: DedlellyDeth on March 28, 2008, 06:25:56 AM
 Branch if they're in the same row or column. Record the distance between guard and hero. Wait however long it takes for a guard to move. Record again in different variable. The second variable is less, then it means that he is moving towards hero; facing hero and moving forward as there are only two directions, the other one making the distance more.