Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

I need stealth system.. without useing scripts

I can I do a stealth system using events and variables only noo scripts.

I wanna have it that u can go into a house and sneak around with the npc is in the house
and if u get too close to the npc. it will get spooked and run to a spot on the map and call police or run upstairs or w/e I can think of.

please help
 

Injury

Awesome Bro

thats a lot of work with just events and no script, not going to lie...


Just an FYI...When you think of a system you want to add, think of all the things that are required for it to work...Like this stealth system...or your weather system....or anything else.

You should make it a practiced thing to write it all down in steps

Its going to help you become a better event creator and hopefully make you realize there are certain constraints on a system without scripting it.

You can do it, don't get me wrong, but its a lot more hassle and its going to be slower than scripting.
 
Im doing ok so far. im having trouble with the detection through walls i dont wanna lower the radius I wanna have it so when you walk past the door way there is a chance to get caught.
 
If you make a conditional branch, use the script tab and put this in:
Ruby:
(r = 4; c = $game_map.events[@event_id]; a = ($game_player.x-c.x)**2; b = ($game_player.y-c.y)**2; Math.sqrt(a+b) <= r)

Change the r value to the number of squares to be active radius around the character.

That snippit will make whatever is in the conditional branch run when the player is within 4 units of the character who has this in their event.

You can make an event chase you if you get too close by making something like this:
ce3a247e0cd30b06c125faa2c33700d0.png
I hope this helped :grin:

EDIT: I just noticed this was for VXAce. I have no idea if this will work with VXA or not, but you could give it a try :tongue:
 
So, you have 2 conditions:
IF player is within a constant RADIUS
AND
IF player is within a direct line of sight.

The radius test is simple. To do direct line of sight, first you need to identify obstructions (walls, cabinets, tall plants, etc...) somehow.
You could use passability, but then short objects like tables, chests would block line of sight.
I would suggest using a terrain type. (does this still exist in Ace?)
Then you need an algorithm to check every tile between the NPC & player.

I would do it this way:
Check the Delta distance between the NPC & Player
Using whichever distance is larger (X or Y), iterate through a formula to solve the other axis.
So, if NPC is at (0,0), and player is at (2,3), The Y distance is larger.
The formula is X = Y * 0.75
So,
when Y = 0, X = 0
when Y = 1, X = 0.75
when Y = 2, X = 1.5
when Y = 3, X = 2

When X (in this case) is a fractional number. (X%1 > 0), You need to both round up, and round down.
So, when X = 0.75, you need to check for both X = 0 & X = 1
So, the tiles you have to check are: (0,0) (0,1) (1,1) (1,2) (2,2) (2,3) You can skip the first & last, since a character is standing on that tile.
If any one of those tiles is an obstruction, no detection occurs.

Make sense?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top