TrinityCore/TrinityCore — pull request #11733 by deathicon (2014-03-17 21:06:52+00:00)
Title: Core/SAI: Add new distance to creature/gameobject events.

Added new events to trigger action when the creature/gameobject detects another creature/gameobject within the specified distance. This is a much cleaner implementation than using event update_ooc_los to perform the check, and the event params are separated from the target params which allows the action to be performed on a target different from the source.

For example, if you wanted a creature to perform some action when it gets within distance of another creature or game object, right now people get around this by adding SMART_EVENT_UPDATE_OOC event on some dummy creature/gameobject. This makes it difficult to maintain over time and is error prone because this event wasn't made for that. Instead, by using the new events I added, the code can remain on the source creature/gameobject holding the script.

You can specify either a guid or an entry, but only one of the two is used (guid first). A single distance parameter is used (no need to provide a min/max range in this case). The last fourth event parameter is the amount of time between checks.