Line of sight

Status
Not open for further replies.

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
I am having a system in my game where the player can do repeatable stealing quests, where you have to sneak into an area and steal something. But I want there to be guards who can see you and attack you. I need a plugin for this, right? Or can I event it? Can someone help me with making all of this work?
 

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
Somebody please respond!

EDIT: Sorry for the impatience...
 
Last edited:

dbchest

Beast Master
Veteran
Joined
Oct 1, 2013
Messages
434
Reaction score
306
First Language
English
Primarily Uses
RMMV
listen. when asking for assistance, have some sort of direction. help us so we can help you; no one wants to take the time and effort to walk you through a method for accomplishing this (or any feature), when you do not have a clear vision of what you are trying to accomplish. if it is obvious that you created this thread with minimal effort (which is it), then why should other people respond with anything more than their minimal effort?

make it convenient for people to respond and you may just be surprised to see how many people help you; tell us exactly what you want so the right people respond, and they can respond with relevant information.

i.e. how do you imagine this system working from start to finish?
 

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
listen. when asking for assistance, have some sort of direction. help us so we can help you; no one wants to take the time and effort to walk you through a method for accomplishing this (or any feature), when you do not have a clear vision of what you are trying to accomplish. if it is obvious that you created this thread with minimal effort (which is it), then why should other people respond with anything more than their minimal effort?

make it convenient for people to respond and you may just be surprised to see how many people help you; tell us exactly what you want so the right people respond, and they can respond with relevant information.

i.e. how do you imagine this system working from start to finish?
The player is walking through the area. There are guards walking around. What I want is for a certain line of sight for them - maybe 5 squares - and when the player steps on one of those squares, the guard walks up to you - actually that bit about walking up is not necessary, but I would like that - and he says something like "Trespassers do not go unpunished!" or "Surrender, criminal!". Then a battle occurs. If the player loses, game over. Otherwise, the guard dies (so the event disappears) and the player can continue walking. It is somewhat like Pokémon, where the trainers walk around (not all of them walk around, but some do) and when one sees you, a battle occurs.

How would I go about doing that?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
By default, this cannot be done. The only way to even come close is Yanfly's Event chase player script, and the line of sight does go through walls. But if you design your areas with that in mind, you can make it work.

Also keep in mind it is a weekend, there are usually not many on here then. Waiting 48 - 72 hours for an answer is not unusual.

I've moved this thread to RGSSx Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
By default, this cannot be done. The only way to even come close is Yanfly's Event chase player script, and the line of sight does go through walls. But if you design your areas with that in mind, you can make it work.

Also keep in mind it is a weekend, there are usually not many on here then. Waiting 48 - 72 hours for an answer is not unusual.

[move]RGSSx Script Requests[/move]
Okay. I will try that script.
 

WickedWolfy

Touch Fluffy Tail!
Veteran
Joined
Nov 27, 2017
Messages
115
Reaction score
50
First Language
En
Primarily Uses
RMMZ
By default, this cannot be done.
Maybe I am wrong, but can't you get the x:y position of the player? If so, the guard can check if the player is in a block in relation to the guard.
In this case this turns into a math problem with a "while" loop or a timer.
 

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
Maybe I am wrong, but can't you get the x:y position of the player? If so, the guard can check if the player is in a block in relation to the guard.
In this case this turns into a math problem with a "while" loop or a timer.
That might work.
 

dbchest

Beast Master
Veteran
Joined
Oct 1, 2013
Messages
434
Reaction score
306
First Language
English
Primarily Uses
RMMV
You do not need a full plug-in for this. A little bit of ingenuity with scripts calls can get you the result you want without needing to install a plug-in, but a plug-in would be more user friendly.

I could demonstrate how I would approach this in RMMV but I do not remember much about VXACE and RGSS3. I can not give you exact instructions.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
on the guards' move route, enter
Code:
move_toward_player if ((self.x - $game_player.x).abs + (self.y - $game_player.y).abs) <= distance
as a script entry
where distance is the minimum range they can spot you at, in grid squares.
set the move route to repeat and skip.

if you want a more complex solution, you'll need a dedicated script... but that should do for the most part
 

Nightblade50

Developer of "Delta Origins"
Veteran
Joined
Nov 10, 2016
Messages
2,133
Reaction score
4,253
First Language
English, French
Primarily Uses
RMVXA
on the guards' move route, enter
Code:
move_toward_player if ((self.x - $game_player.x).abs + (self.y - $game_player.y).abs) <= distance
as a script entry
where distance is the minimum range they can spot you at, in grid squares.
set the move route to repeat and skip.

if you want a more complex solution, you'll need a dedicated script... but that should do for the most part
Hey, that will do it! This thread can be closed now.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
@Thomas Smith When you want a thread closed, please Report your opening post and ask for it to be closed. Mods may not see an individual post but will see a Report.
Thanks.
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top