New account registrations are disabed. This website is now an archive. Read more here.

RPG Maker MV    Posted March 4, 2016 by dolarmak

Event Radius Check

Introduction

This plugin will allow you to have events detect one another.

Features

Set custom event name detection
Set radius of detection
Set which Self Switch detection activates

The Code

License Terms

Attribution 3.0 Unported - You must attribute the work in the manner specified by the author or licensor. Commerical use allowed.

Instructions

Set the Self Switch you want to active in the Plugin Manager.

 

Use the Plugin Command : EventRadiusCheck name_of_event_to_check #_of_tiles_away
This will then check if the event name_of_event_to_check is within the # of
tiles you specified.

Author Notes

This was build for my own project, but I figured it might be useful for other people.

Compatibility

I’m pretty new to Java Script, but it shouldn’t have any issues with other plugins.

Credits & Thanks

Marked for helping solve a major issue.

Terms & Conditions

Free for use in non-commercial projects with credits.
Contact me for commercial use.

Comments (3)

  • Just to let you know, there's a distance function built into the Game_Map class, you can use it like this:

    [code]$gameMap.distance(start.x, start.y, goalX, goalY);[/code]

    Using this code is a really big shortcut, and avoids using nested forloops.

    That function has this inside:
    [code]return Math.abs(this.deltaX(x1, x2)) + Math.abs(this.deltaY(y1, y2));[/code]

    You could follow the functions to try and learn. Tbh I've spent a lot of time searching and following references to functions to try to understand what's happening. The MV is barely commented, which makes things a bit harder and it's time consuming to sort of get the whole picture.

    And one last thing (just to be super picky :P) is that you can place your if statement into the final forloop rather than setting var ev_event_true = true; and then cancel both loops (i think you can go return false for that). Cancel both loops because once we've found one match, that's all we need to turn the switch on.

  • well, arn't we the expert here lol thanks for the advice. to be honest i'm afraid to tweek it more since it took so long to get working in the first place, and now that it's working i don't want to mess it up lol

  • Lol not the expert, just things I've expressly come across recently. In any case, it's just advice if you create more plugins: always try to see if you can borrow core functions rather than rewriting them. With something like this, there's bound to be a similar function and it's quite interesting to see how they do it. (to be fair I don't understand it :P).

Leave a Reply

dolarmak

  • Posted about 9 years ago

  • Engine
    RPG Maker MV
  • Category
    Environment and Field Scripts
  • License
    Attribution 3.0 Unported
  • Version
    1.0

Stats

1,443 views

3 comments

Tags

n-a