Proximity Events

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Proximity Events - v1.3

by V.M.


Introduction

This script will allow you to use the script portion of conditional branches to activate events based on player proximity. Uses could be monster groups that chase down the player or lights that activate when the player walks near them, or anything else you can manage to do with it.

Features

- Activate events based on how close the player is to them

How to Use

All details in the script.

It's a demo! Uses an older version of the script but allows you to see many different ways of using the script!

Here

Script

Convenient Pastebin: Here

FAQ

To be announced if necessary?

Credit and Thanks

- By V.M.of D.T.

- Free to use in any project with credit given

History

Version 1.3 - Simple Line of Sight! Ooooh ahhhh.

Version 1.2 - Added rectangle function (inprox_r?)

Version 1.1 - Added directional function (inprox_d?)
 
Last edited by a moderator:

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I like this feature, great demo too, shows many ways to use this script.

For the mobs chasing you, how does it work, they chase you as long as your in X range? Theres not some limit say they chase for X frames then return, or chase you as long as they have sight of you?

I think that might be interesting having the chase start when the mob faces you, so you can sneak up on them, gives the option to add Preemptive strikes. In addition if they hit your back, they get first strike.

Edit: Also I found a broken part, in the demo if you aggro 2 slimes, and they chase you ending up both right next to you, you begin combat with one, you defeat them, then instantly after combat you begin the combat with the other slime. However after defeating the slime, or escaping, the slime does not go away and restarts combat, endlessly.

Edit2: Also when you beat a slime the tile it was on cannot be passed. I know thats less to do with script but none the less if people copy paste it from your demo it will be broken. Setting page 3 to Under Character will fix that I believe... Im sure you already knew that though :p
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
I like this feature, great demo too, shows many ways to use this script.

For the mobs chasing you, how does it work, they chase you as long as your in X range? Theres not some limit say they chase for X frames then return, or chase you as long as they have sight of you?

I think that might be interesting having the chase start when the mob faces you, so you can sneak up on them, gives the option to add Preemptive strikes. In addition if they hit your back, they get first strike.

Edit: Also I found a broken part, in the demo if you aggro 2 slimes, and they chase you ending up both right next to you, you begin combat with one, you defeat them, then instantly after combat you begin the combat with the other slime. However after defeating the slime, or escaping, the slime does not go away and restarts combat, endlessly.

Edit2: Also when you beat a slime the tile it was on cannot be passed. I know thats less to do with script but none the less if people copy paste it from your demo it will be broken. Setting page 3 to Under Character will fix that I believe... Im sure you already knew that though :p
I'm glad someone found/liked this, it's easily my favourite of all I've done! Wait... no, yup. Event positioning is only second.

Let's see. The chasing mobs thing is only events checking if the player is within range. They chase as long as in range and can be dragged anywhere in that demo.

I wasn't going for anything wonderfully well done, just something that showed many of the possibilities! And hoped they would do things their own way hehe.

Line of Sight and pathing stuff isn't in this tho, you could do chase you for x frames within the event easily but not the other thing.

That other thing though, you can certainly work around in the events to have the mobs do that! Sneaky and preemptive stuff and whatnot.

I think that semi-answers everything!
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I dont know how to work in sneaky and preemptive stuff :( .

How can this be done if the mob chases as soon as you get close enough, you'll never be able to stab it in the back so to speak.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
I dont know how to work in sneaky and preemptive stuff :( .

How can this be done if the mob chases as soon as you get close enough, you'll never be able to stab it in the back so to speak.
Easy! Well, not too easy. But I did it! However, that's a lot of work. So instead I added a function to allow for checking of proximity as well as direction!

New version includes the function Proxy.inprox_d?(@event_id) that will only return true if player is within range and event is facing towards the player.

No line of sight still, but close enough! (I'm not up for it currently).

If ya need help, let me know. I'll update the demo and you know.. stuff.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Easy! Well, not too easy. But I did it! However, that's a lot of work. So instead I added a function to allow for checking of proximity as well as direction!

New version includes the function Proxy.inprox_d?(@event_id) that will only return true if player is within range and event is facing towards the player.

No line of sight still, but close enough! (I'm not up for it currently).

If ya need help, let me know. I'll update the demo and you know.. stuff.
Oh cool! Just tried it and it works!

Im not sure how I feel about that, it seemed to dumb down the AI so that its so easy to avoid the chase. Perhaps if I had it trigger the chase upon the first sighting then resort to normal proximity, that could work nicely :) , I try it a bit later.

Edit: Silly me it took 2 seconds, it works nicely, they see you then chase until you leave their range. Thanks!

If possible would you know how to set up the preemptive strikes and ambushes? I haven't a clue where to begin, I assume it involves a script? Is it out of your hands so to speak?
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Oh cool! Just tried it and it works!

Im not sure how I feel about that, it seemed to dumb down the AI so that its so easy to avoid the chase. Perhaps if I had it trigger the chase upon the first sighting then resort to normal proximity, that could work nicely :) , I try it a bit later.

Edit: Silly me it took 2 seconds, it works nicely, they see you then chase until you leave their range. Thanks!

If possible would you know how to set up the preemptive strikes and ambushes? I haven't a clue where to begin, I assume it involves a script? Is it out of your hands so to speak?
Huh, they don't have that option built in, how bizarre... I know RM2k3 had it... Yah, that'd be scripty now! I don't have one.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Huh, they don't have that option built in, how bizarre... I know RM2k3 had it... Yah, that'd be scripty now! I don't have one.
I know me too... Anyway thanks ill get looking :) .

Great script, I love your scripts they are soooo simple to use! Keep up the good work.
 

starcrescendo

Stargazer
Veteran
Joined
Mar 13, 2012
Messages
198
Reaction score
41
First Language
English
Primarily Uses
Awesome! I love the bard in the demo, it reminds me of a game called "Nier" for Xbox 360. Probably not where you got the idea from but its sweet nonetheless! I think your solution form "line of sight" is perfect! Can't wait to find a game to use this in. :)
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
So I found a way to get first strike and back attacks via script. However since the enemy events are parallel process it makes thing tricky.

First im using this in my condition branch:

Proxy.inprox_d?(@event_id)

The problem is the player can touch the enemy from behind or the side, and nothing will happen since its only triggered when the enemy looks at the player. Is there anyway to change it or maybe I don't know how to set it up, but when player touches enemy from behind self switch D for example.

Also do you think its possible to add slightly smaller then 1 (like a .5), because right now 1 is awkward looking when initial contact is made, and I want to have some enemies smaller hit boxes.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Can use below Proxy.inprox_d?(@event_id) branch, on the same page, Proxy.inprox?(@event_id, 1) to check if player is within 1 square after checkin if event can see player to initiate combat.

The smaller then 1 values would be more difficult to put in so youll have to work around it, the reason it looks awkward is because it uses the events and players x,y location on the map and that updates when movement begins and not after. You can however set it up like... Proxy.inprox?(@event_id, 1) >> wait of 10 or so frames >> Proxy.inprox?(@event_id, 1)... with that it will check if player is within range, if so, waits 10 frames, then checks again, and if they are still in range then boom! Combat.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Hmmm thanks you been helpful as usual :) .

Im still having problems with my other script though :(
 

Oriceles

Veteran
Veteran
Joined
Apr 4, 2012
Messages
384
Reaction score
71
First Language
English
Primarily Uses
N/A
You are awesome, I was waiting for this script. Now we can display arrows to the entrance of places like the pokémon games haha

EDIT: Tried my idea but it was unsuccessfull because It uses parallel process and this will take you to the place endlessly. So i tried to solve it using the advanced option with another parallel process checking where the player is, and if the were player is on the exact area it would be teleported. But I dont know how because the advanced option only check for range and not specific place on the map. Can someone help me?
 
Last edited by a moderator:

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
You are awesome, I was waiting for this script. Now we can display arrows to the entrance of places like the pokémon games haha

EDIT: Tried my idea but it was unsuccessfull because It uses parallel process and this will take you to the place endlessly. So i tried to solve it using the advanced option with another parallel process checking where the player is, and if the were player is on the exact area it would be teleported. But I dont know how because the advanced option only check for range and not specific place on the map. Can someone help me?
There are actually built in options you can do to do that. You can use a conditional branch script call -> $game_player.x == ## and $game_player.y == ##

replacing ## with the correct coordinates (I.E. $game_player.x == 5 and $game_player.y == 17). Or you can manually set variables to the players x, y locations within Set Variable and set up a conditional branch mcbobber there.
 

Oriceles

Veteran
Veteran
Joined
Apr 4, 2012
Messages
384
Reaction score
71
First Language
English
Primarily Uses
N/A
thank you, I don't know well how to work with the store location event, so i will use the script method :) this script have too many posibilities, I love it.
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
New version, New function!

Proxy.inprox_r?(@event_id, width, height) is used to check if the player is within the rectangle defined by width/height with the event as the center! Works well with odd numbers, not so much with even.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Would it be possible to have an addon that allows us to set up Preemptive strikes and back attacks?
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Would it be possible to have an addon that allows us to set up Preemptive strikes and back attacks?
You and your pre-emptive strikes and back attacks! :D

I might look into it if I find time in between commissions and work. ;)
 

Vlue

Talent Extraordinaire
Member
Joined
Mar 13, 2012
Messages
589
Reaction score
382
First Language
English
Primarily Uses
Updated to 1.3 to include a basic sort of line of sight component to the detection (which you can say doesn't apply to specific checks)

Can also use regions to declare certain obstacles as transparent so they don't interfere with los, like pits and small boulders.
 

Acezon

Om Nom Nom
Veteran
Joined
Apr 22, 2012
Messages
131
Reaction score
25
First Language
English
Primarily Uses
N/A
I can't seem to find the demo (well, I assume you removed it). Can you still make one? :D
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

First steps on an interior castle map
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?
I've been having a rough couple of months and as such let down some friends of mine in the RPG Maker community. I still need time to get back to my normal self, but it's nice to be back, to read articles, and to design again (albeit at a slow pace). Hope to give updates on Kid Crescent soon.
Friendly reminder that you don't have to be able to do absolutely everything. It's okay to scale back features or assets if things are too much - especially if you're the only one working on the game! And you can always add things in later. <3

Forum statistics

Threads
107,735
Messages
1,031,742
Members
139,870
Latest member
Berserk94
Top