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.

"Sneak" ability?

I'm doing this here since I have no idea how you would do it regularly. I want to make a sneak script that has an eye that starts to open when an enemy starts getting you near, sort of a warning type thing. Any ideas?
 

Nava

Member

that seems like a good idea im new to scripting but i think im gettin pretty good fast u will have to ignore my first script the prevention system im workin on that now but if i uncover anything i will let you know
 
You can just use Near's View Range, and just test the range of the event with the player. Simply making a window or something, that checks range of events and player on the map.

Code:
# Pass through each event, saving the nearest range
nearest_range = nil

for event in $game_map.events
  if nearest_range.nil? || VR.range($game_player, event) < nearest_range
    nearest_range = VR.range($game_player, event)
  end
end

# Then, just make a case statement, with your range, with when statements for each range:

case nearest_range
when 0..1
  p 'Right Next to Event'
when 2..5
  p 'Getting Close'
when 6..10
  p ' Plenty of room'
else
  p 'no where near you'
end

More or less, something like that. It's not to developed, but if you need any help, just ask.
 
SephirothSpawn said:
You can just use Near's View Range, and just test the range of the event with the player. Simply making a window or something, that checks range of events and player on the map.

Code:
# Pass through each event, saving the nearest range
nearest_range = nil

for event in $game_map.events
  if nearest_range.nil? || VR.range($game_player, event) < nearest_range
    nearest_range = VR.range($game_player, event)
  end
end

# Then, just make a case statement, with your range, with when statements for each range:

case nearest_range
when 0..1
  p 'Right Next to Event'
when 2..5
  p 'Getting Close'
when 6..10
  p ' Plenty of room'
else
  p 'no where near you'
end

More or less, something like that. It's not to developed, but if you need any help, just ask.

*******************

How do I use it? Please be more specific.

Post Back:ASAP
 
First, get the View Range. Check the download manager for it or Near's Test Bed in the download manager.

Secondly, what I posted wasn't some magic script. It is just an example of a how you could detect the closest event. That's it.
 
Wow, I thought that was marshzd's thread and he's the one asking for help. It's okay to ask for help in someone other's thread, but if you guys don't stop to be rude, nobody's going to help you. If you have individual questions about Near's View Range script please make your own topic. Closed this thread for now, if marshzd wants me to open this thread again, just send me a PM.

Edit:
Okay, I'm reopening this thread, but everyone please behave.
 

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