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
9
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
9
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
9
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

working hard working hard working hard >:)
Do you have an audio you want me to animate? If so send me the youtube link and I’ll animate it.
Okay, so I'm working on Draft 2 of my game's script.
Will try to keep you guys posted, if you're interested!

This is vid of my new game, Crystalgazers. A demo is available on my Gamejolt

I just thought of the best achievement for my game: "'I Didn't Know You Were a Developer!' Find and enter one or more dev room(s)."

Forum statistics

Threads
105,593
Messages
1,014,856
Members
137,257
Latest member
Kalamar_Sinn
Top