Check position between Player & Event? HELP

Isabella Ava

Veteran
Veteran
Joined
Sep 13, 2016
Messages
635
Reaction score
756
First Language
English
Hi guys, please HELP. I want to check position between Player & an Event to see if Player is standing next to it or not
(Don't want to do this with command events, it's a lot of nest Conditional Branches)

I found this plugin but i don't know how to use it?
https://forums.rpgmakerweb.com/index.php?threads/player-vs-event-position-plugin.85046/#post-789983

I put it into command script like this but it won't work:
if (this.playerVsThisEventDistance(2))
{$gameVariables.setValue (222, 2);}

And i tried to put the script into Conditional Branch command but it won't work too


Please HElp =.+
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
In a conditional branch in the script section, try this:

Code:
Math.abs($gamePlayer.x - $gameMap.event(2).x) + Math.abs($gamePlayer.y - $gameMap.event(2).y) === 1
That will return true if the player and event are one tile away horizontally or vertically, and false otherwise. If the player and event are one tile away diagonally, it will return false, as the total distance will be 2 tiles (one up/down and one left/right).
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
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'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top