Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

All map battlers are Game_Character objects. This means that you can pull their tile X and Y coordinates directly.

For finding out if an actor is next to another actor, the $gameMap.distance(cx1, cy1, cx2, cy2) value must be <= 1.

You must also check through all actors on the map.

Script (assuming the current battler is an actor);

----------

const map_battler = $gameMap.selectedBattler();

const actors = $gameMap._actors.filter((actor_map)=>{

  return actor_map != map_battler;

})

if(!map_battler._battler.isActor())return

const cx1 = map_battler.x;

const cy1 = map_battler.y;

return (

  actors.some((actor_map)=>{

    const cx2 = actor_map.x;

    const cy2 = actor_map.y;

    const distance = $gameMap.distance(cx1, cy1, cx2, cy2);

    return distance <= 1;

)


----------

Haven't tested this but this should tell you if any actor is near the current map selected actor

(1 edit) (+1)

Thanks! About to go to work, but I'll implement this when I'm back and see how it goes.


EDIT: It works! Thanks again for the help.