[RMMV] Script for Event and Actor Map X,Y

Status
Not open for further replies.

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
18
First Language
English
I looked through the Script Call Equivalent post and I did a few searches and didn't find the whole answer to what I was looking for.

I found $gameMap.regionId(x, y); on the Script Call Equivalent page, but I need to know the variable of the Actor's Map X/Y as well as getting an Event's Map X/Y

and also, how would a conditional look to compare the two region ID's to see if they are the same, with an else statement as well?

This is what I am looking for:

If RegionID(Actor X, Y) = RegionID(Event X, Y) then

Else

    if RegionID(Actor X, Y) = RegionID(Event X-1, T) or RegionID(Actor X, Y) = RegionID(Event X+1, T)... ext to check the adjacent map tiles

    else

    End Conditional

End Conditional

Thanks in advance!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You can do this with events, you know - Control Variables will let you get the player's or an event's coordinates - so you'd need 4 of them.

However, in a conditional branch, you can use the following in the script section to see if they are on the same tile - replace # with the event id (EV003 would be 3, not 003):

Code:
$gamePlayer.x === $gameMap.event(#).x && $gamePlayer.y === $gameMap.event(#).y
 

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
18
First Language
English
Just to clarify, I am comparing the region ID's the Actor and events occupy, they may be in 2 different parts of the map but on the same Region ID

So for the condition I would need:

$gameMap.regionId($gamePlayer.x, $gamePlayer.y) === $gameMap.regionId($gameMap.event(#).x, $gameMap.event(#).y)

Why three "===" ?

What is used for "OR"

Do I need to include the ";" at the end of the script in the event script box?

Thanks for your reply!
 

Sn0wCrack

Veteran
Veteran
Joined
Aug 2, 2015
Messages
82
Reaction score
48
First Language
英語
Just to clarify, I am comparing the region ID's the Actor and events occupy, they may be in 2 different parts of the map but on the same Region ID

So for the condition I would need:

$gameMap.regionId($gamePlayer.x, $gamePlayer.y) === $gameMap.regionId($gameMap.event(#).x, $gameMap.event(#).y)

Why three "===" ?

What is used for "OR"

Do I need to include the ";" at the end of the script in the event script box?

Thanks for your reply!
Shaz has given the way of finding if the Player and Event are on the same tile.

3 equals signs is the same as 2 equals but also checks data types, so normally 0 == false would evaluate to true, but 0 === false would become false.

For your purposes all you need to do is replace the actor's X and Y with $gamePlayer.x and $gamePlayer.y

and the event's X and Y with $gameMap.event(#).x and $gameMap.event(#).x

(Make sure you change # to the event id)

However I'm unsure as to what you're actually trying to achieve with this to be honest, as what you have setup checks if a player and the event are on the same tile graphic.
 

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
18
First Language
English
I was experimenting with a Tiled Lighting system.

I would have 1 event for each tile visible on the screen, in my case 22x14, so 308 events. Each room would be given a different Region ID, when  the player enters Room with Region ID 1, then any other rooms with a different Region ID still visible on screen would be blocked out by changing the graphics on the events, only allowing you to see in the room you are currently in.

I ran into a few issues that I could have worked around but came up with a new way to do the same with only 1 event for each room instead of 308 events moving with the character lol.

Either way it was nice to learn the above!

Thanks!
 

CameronCalvert

LazyCam
Veteran
Joined
Aug 15, 2013
Messages
48
Reaction score
4
First Language
English
Primarily Uses
N/A
I know this is late guys but I can't find it anywhere. Is there a way to make a code for THIS event? Like $gameMap.event(#) But instead of an event ID is there a way to tell it to make the action on THIS event? As I want multiple instances on my map but I don't want to have to make a seperate code for every single event.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
[necro]CameronCalvert[/necro]

This thread is over 2 years old. In addition, your query is different from that of the OP's. In an active thread this would count as hi-jacking a thread.

Please post a new thread, setting out fully what it is you want to achieve.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top