Made for a
request here.
This script acts like a radar/scanner to check the distance of the player from the enemy events on the map.
Features:
[1] Able to check the nearest enemy and return the event's id.
[2] Able to list down a list of enemy event's ids and their distance from the player.
[3] Able to check any event's distance from player.
How to Use:
[1] Script itself is plug and play, simply paste it below Material and above Main.
[2] To make an event scan-able by the radar, you will need to add
<enemy> tag to the event's name.
[3] Script calls for scanning:
Spoiler
Get distance value of Event X from Player
$game_map.distance_from(id)id = any event's id (works for event without name tag)
Get distance of all Enemies from Player
$game_map.scan_targetThis will list all the enemy event's id and their distance from the player
Get the nearest enemy event's id
nearest_enemythis will return the event's id of the nearest enemy
Pair these with Control Variables'
Script box to output the result to game variable.
eg. Control Variables: [0001] = nearest_enemy
Compatibility:
Should be compatible with other custom scripts.
Terms of Use:
Free for both Commercial and Non-commercial
Script:
Spoiler Code:
本贴来自国际rpgmaker官方论坛作者:MeowFace处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/enemy-distance-scanner-radar.46115/