Can eventA check if it occupies the same tile as any other event?

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Using Orange Custom events, I copy eventA multiple times onto a region, acting as rocks.
What Im locking for is a
(parallel process)Conditional branch check for eventA to see if the tile its currently on, is in fact already occupied by something else.

If occupied.tile
delete.this
else
end

There might be other ways around this, but Im looking for a way to not get two rocks on same tile.
"rock eventA" runs a parallel process at start of map anyways so this is a good time to check if there is another rock or event on the same tile, for then to selfdestruct if there is.
 
Last edited:

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
168
First Language
English
Primarily Uses
RMMV
JavaScript:
$gameMap.distance($gameMap.event(event a id).x, $gameMap.event(event a id).y, $gameMap.event(event b id).x, $gameMap.event(event b id).y) === 0
Returns true if they're on the same tile!

JavaScript:
$gameMap.distance($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y, $gameMap.event(event b id).x, $gameMap.event(event b id).y) === 0
To compare with the event checking it.
 

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Thank you very much @ozubon ! Will play with this right away!

Edit: Seems i may have forgotten to say that I wont know that ID to check with. In any case I need to check them all, or any at all.
Im copying event onto a "random generated map" so I need it to fit this kind of logic

If any other event is on this tile
delete.this
else
end
 
Last edited:

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
168
First Language
English
Primarily Uses
RMMV
Sorry that will of course not work if you're spawning in events you don't know the id of.
In that case use this. It's shorter code than the first one anyway:

JavaScript:
$gameMap.eventIdXy($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y) != 0
Returns true if the event that's checking is standing on an occupied tile.
 

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Hmm interesting. that script actually deletes them all. I think it is because they are spawned from same object. I can delete via a variable ID then maybe
 
Last edited:

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
168
First Language
English
Primarily Uses
RMMV
My bad again, that only finds itself so it will run true everytime.

Try this, this should work lol:
JavaScript:
$gameMap.eventsXy($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y).length != 1
 

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Thank you! This is just what I needed. :D
 

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
168
First Language
English
Primarily Uses
RMMV
Inga problem ;)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I FINALLY DID IT! 5 years making my very first game and I just officially released it on STEAM..... OMG..... I can say I finished a game! The feelings!!!!!
Stream will be live shortly! I am going to be playing some Among Us! Feel free to drop by!
Ami
tv program always get the ratings (it's the reason why drama series has 1000+ episode),also full and nonsense of censorship (weird blur, a scene getting cut because the unconvenient viewer,but it unconvenient to me either. you never see what the original is)

i know the reason is to take cover the viewer from the negative thing,but i just laughing and mocking of them that they're always suck :guffaw:
Star Chart Idea - Just something I am working on.
My sister learned spanish the old fashioned way and saw my way of conjugating. I don't use the formal method and just wing it. I thought her heart might explode. Apparently, different words use different endings. Weird part is even though I never learned the difference, I still can tell when the endings "look wrong".

Forum statistics

Threads
104,456
Messages
1,006,411
Members
135,964
Latest member
Musixim
Top