Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
this.regionId() == $gamePlayer.regionId()
So the even if the event is triggered it's not going to do anything unless their region Ids match.
This is handy for "touch" events where the player might be on a cliff and a monster is standing on the tile next to them, but "below". They're suppose to be on different elevations.
I was thinking something with regions but didn't know how to code it.
Sadly, with that script it wasn't working so I tried separating it and storing the values in variables to see what was the issue, the player's regionId is being stored just fine but the events' is always zero so I'm guessing it's missing something.
Using a control variables command in the event's page with the script "this.regionId()" as the variable's value running on parallel. =/
"this" can mean different things depending on where the script command is. I believe this.regionId() would work if it was used inside the event's move route. Because there, "this" is the event itself as part of the Game Map. But in the event command list, "this" is the game interpreter that processes the event's commands. So we have to be a little more specific about what we're pointing to.
Edit: Or, use the specific ID number like, $gameMap._events[8].regionId()
If you want true line-of-sight, that's typically done by rasterising the line to the tile grid (e.g. Bresenham algorithm) then iterating through the resulting tiles to check if any of them block the line. It's not super complicated, but you'd definitely want a plugin for it. There's this one for MV, haven't tested it in MZ: