How do I sort through all the events on the map?

tvorimvsevmeste

Villager
Member
Joined
Nov 11, 2015
Messages
26
Reaction score
3
First Language
русский
Events on the map are created during the game.
We don't know how many of them there are.
Please explain how to set up a distance check from the player to each one? (in one event!!!)
 

akoniti

Veteran
Veteran
Joined
Mar 4, 2020
Messages
85
Reaction score
64
First Language
English
Primarily Uses
RMMV
Do you literally mean an event that runs a distance check on every single event at once? Though I can't say for certain, I'd imagine that event could introduce considerable load.

Or, are you simply looking for a way to check the distance from specific events, as the need arises during your game? There's bound to be a way to do this, since the engine knows the coordinates of everything. I saw a mention of:

this.ActorDistance(var, actor, actor);

...in a mostly unrelated post (see the @NatePlays reply on 9/24) .

I'm wondering if the trailing 'actor' in that statement could be an event number instead. Or, maybe there's an better way...

Edit: Sorry, above is for MV, I'm uncertain if it pertains directly to MZ.
 
Last edited:

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
Do you literally mean an event that runs a distance check on every single event at once? Though I can't say for certain, I'd imagine that event could introduce considerable load.

Or, are you simply looking for a way to check the distance from specific events, as the need arises during your game? There's bound to be a way to do this, since the engine knows the coordinates of everything. I saw a mention of:

this.ActorDistance(var, actor, actor);

...in a mostly unrelated post (see the @NatePlays reply on 9/24) .

I'm wondering if the trailing 'actor' in that statement could be an event number instead. Or, maybe there's an better way...

Edit: Sorry, above is for MV, I'm uncertain if it pertains directly to MZ.
Wait wait wait wait... That function is exclusive to the SRPG Battle plugin, as with that you can set your actors in different spots on the map instead of right behind you. Yeah, it has an Event version, but it is still not relevant for MV.
 

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
@tvorimvsevmeste you might want to see this:

JavaScript:
$gameVariables.setValue(w, $gameMap.distance($gamePlayer.x, $gamePlayer.y, $gameMap.event(z).x, $gameMap.event(z).y) )
This sets variable W to the distance between the player (party leader) and an event Z. I don't know if it works in MZ but the versions are similar enough the functions should still be the same.

Then make a loop or a sequence that tests for every event number you need (say, 1 to 10) and save them to variables (say, 101 to 120).

The easy way is to just copy-paste the script above and change W and Z accordingly.
 

tvorimvsevmeste

Villager
Member
Joined
Nov 11, 2015
Messages
26
Reaction score
3
First Language
русский
And how can I make it for EVERY event on map if I don`t know how much :eek: events shall respawn on that map in advance?
Please help me! :LZSsmile:
 

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
Not to be a bother, but have you tried looking on Google as "RMMV script get all events" or even on this forum?
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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
It's Saturday already. Last Saturday felt just like yesterday. o_o
I really need to stop adding more levels to this thing already...
My computer is now on the dead list. Parts and Services stopped two days ago for this type.

Forum statistics

Threads
105,843
Messages
1,016,923
Members
137,550
Latest member
Whuazu
Top