A Script to randomly create an event near a player

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Hi there,

I'm looking for a plugin (this can be paid-for) that creates an event 15 blocks away from the player, and then begins to 'walk' slowly towards the player. If the player goes over 15 blocks away, the event de-spawns and then waits until it re-triggers (again randomly) to do the same thing.

Essentially, I want to use it to scare the player :)
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
I'd say you can do that just fine with events, only.
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Could you possibly explain how you would do it?
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
By

1. generating random number from 0-15 and store it to variable, lets say variable X then subtract 15 with var X and store it to var Y. This way you have X and Y difference that always sum 15.

2. Generate random 0-1, when 0, multiply var X with -1. Do same step with var Y.

3. I'm sure you can check tile passability on using event or maybe using event script call. Wrap the step 1 & 2 to loop, and when coordinate (player x + var x), (player y + var y) is passable and there's no other event exist on that coordinate, break the loop.

4. set your event move route towards player. thats easy.

thats the basic algorithm I could think. I've no idea about check pathfinding so event would stuck above the cliff or something.

hope this could help
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Sorry, a little confused - this would be a JS plugin right? I've never codes JS before so wouldn't have the first clue where to start :(
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
steps I explained above meant to be used on event page.

If you don't need to consider passability (i.e. your enemy event is ghost or flying demon) I could show you a screenshot setup or maybe a demo this night.
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
If you could show a screenshot that would be great ... passability isn't too much of a problem on the map.
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
Hi there,

I'm looking for a plugin (this can be paid-for) that creates an event 15 blocks away from the player, and then begins to 'walk' slowly towards the player. If the player goes over 15 blocks away, the event de-spawns and then waits until it re-triggers (again randomly) to do the same thing.

Essentially, I want to use it to scare the player :)
What do you mean by the words i set to bold?

15 blocks away from what? From your event that chase player, from your player's coordinate when that chasing event started to spawn, or from something else?
 
Last edited by a moderator:

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
OK here's a rewrite of it ... should make more sense ...

Around each of the maps I will be using the Region Markers to note where the enemy will be able to spawn. If the player goes within 15 blocks of those markers then it randomly decides whether to spawn the event or not. It is weighted more on the 'no' side than anything else - so its rare for the enemy to spawn.

If the player goes more than 20 blocks away from the region marker, then the event de-spawns and everything resets. 

Overall there will be 100 to 200 of these markers based around the various maps.

I hope that makes a little more sense! :p
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
Well, that's a little bit more complex than I thought since you will need to calculate distance from that region.

Right now, I've done basic setup and need several common events to make it done and modular (able te be called from multiple maps). Actually it could be done with 1 common event but I like to break it down to several events so it's easier for me to find and edit things.

My advice, a plugin might be more easier approach :p

Anyway, I can't stop laughing when trying to evade the chasing event that always spawn randomly.

:guffaw:   :guffaw:   :guffaw:
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
Yeah I bet it looks very weird, could you show me how you've achieved it - maybe via screenshots? I'd be endebted forever!
 

Eff-n-Geoff

Veteran
Veteran
Joined
Oct 26, 2015
Messages
182
Reaction score
7
First Language
English
OK, as an update i've managed to figure this out without using further plugins ... so we place an event on the floor that the player can walk over (first screenshot) - this generates a random number and then if that number matches a specified number (and the script isn't already running) it moves the event to where it needs to be and turns on the self switch.

Screen Shot 2015-12-12 at 13.49.43.png

 

The self-switch turns on a graphic and then begins following the player, after 6 seconds it turns the switch off and deletes itself ready for another switch to possibly re-activate it

 

Screen Shot 2015-12-12 at 13.49.56.png

Screen Shot 2015-12-12 at 13.49.43.png

Screen Shot 2015-12-12 at 13.49.56.png
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top