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
62
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
43
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
43
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
43
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 Profile Posts

rux
Just 80% of my motivation on game making lmao, anyone got tips on how to not be unmotivated?
I've signed up for a job training program for people with Asperger's Syndrome. I went to a "test run" today so they could see how well I did with simple jobs, and I amazed them. Most new people do it in 30+ minutes, while I finished in a mere 15 minutes. Gives me time to work on a screenplay for Studio MDHR...
People,I have seen that Someone from China/Chile and London is doing a Vaccine Against COVID-19.
Doing anything that yield good result in the long run is like sowing seeds. With proper care, they will grow and bear fruits. I'm excited for tomorrow. :D

Forum statistics

Threads
105,455
Messages
1,013,841
Members
137,105
Latest member
twilightprincess
Top