Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Click here to join us on IRC (#charas on irc.freenode.net)!
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Line of sight
« previous
next »
Print
Pages: [
1
]
Author
Topic: Line of sight (Read 1969 times)
HobomasterXXX
Your eyes. Are an ocean. Your breasts. Are also an ocean.
Leader
Posts: 2,700
Line of sight
«
on:
January 18, 2008, 04:44:33 AM »
i wanna make a stealth section in one of my games. i can make most of it, but i need to know how to give enemies a line of sight, and make it so when you enter their line of sight something happens. can anyone help? this is for rm2k3.
Logged
1:24 PM - [Razor]: I think
1:24 PM - [Razor]: I almost fell off my chair
1:24 PM - [Razor]: in anticipation for DICK
DragonBlaze
A Wild DB Appeared!
Royal
Posts: 3,329
(No subject)
«
Reply #1 on:
January 20, 2008, 03:53:20 PM »
Yeah, you can do it by using variables. First, you need to record the x and the y possitions of the hero and the gaurds or whatever are going to have the line of site.
Do this by...
Go to variable options
Select a variable to save the value to. (name it gaurd x or gaurd y)
Click on the sprite option
select the sprite you want
select either x coordinate or y coordinate.
After saving an x value, make a new variable, and save the y variable to it.
Repeate for all gaurds and the hero.
Now for all the gaurds, record which dirrection their facing.
Again, this is done in variable options and then the sprite option.
All of these variable options should be put in a parallel proces event with a .1 wait command.
Now you need another parallel process event with a wait of .1 or .0. In this event, you need a bunch of conditional branches to test where the hero is compared to to the gaurd and where the gaurd is facing. Sadly, this will require a lot of conditional branches.
First, for each gaurd, make a conditional branch for the four dirrections they can be facing. In each of those branches, test to see if the hero's x possition is within 10 tiles of the gaurd in whatever dirrection the gaurd is facing. So if the gaurd is facing up, check to see if the hero's y possition is between the gaurds y and 10 less than the guards y. In that branch, do you actions.
For every dirrection, you'll need a differant formula, for up and down, check the y possiitons, if facing left or right, check the x formulas.
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN
HobomasterXXX
Your eyes. Are an ocean. Your breasts. Are also an ocean.
Leader
Posts: 2,700
(No subject)
«
Reply #2 on:
January 21, 2008, 01:53:36 AM »
thanks for that, but the gamingw peeps got it for me first. thanks anyway.
Logged
1:24 PM - [Razor]: I think
1:24 PM - [Razor]: I almost fell off my chair
1:24 PM - [Razor]: in anticipation for DICK
DragonBlaze
A Wild DB Appeared!
Royal
Posts: 3,329
(No subject)
«
Reply #3 on:
January 21, 2008, 01:57:41 AM »
*sigh* gamingw and their quick responces. Well either way, I'm glad you were able to get an answer. The better people get at rpg maker, the better games they make, and the better the rpg maker community gets
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Line of sight