AI trigger

by Tafe
Save resources by using collision to trigger AI.
ID:2473639
 

ai_trigger


Think smart, save resources!


ai_trigger uses 'crossed()' to trigger events for whatever you desire! Make it huge or small, with 'Scale()' you can change the area of how far you want to trigger an ai.

Read more, or download the latest release on Github.

Github
https://github.com/accnameOwl/aitrigger
Download
latest release: https://github.com/accnameOwl/aitrigger/releases

Been using this method a while myself, it's probably one of the most efficient ways you can pull this off on BYOND.
In response to Nadrew
Nadrew wrote:
Been using this method a while myself, it's probably one of the most efficient ways you can pull this off on BYOND.

Yes, I agree. I honestly thought it was weird how i couldn't find other libraries or demos for this, so i simply couldn't stop myself from making one.
I threw one out on Discord a while ago but never really bothered to properly turn it into a hub entry. It's still sitting on my Google drive.
One thing you do need to add is type checking in your Crossed(), having

Crossed(mob/M)


Doesn't actually assure that the argument is in fact a mob, just like Entered(). You'll want an ismob() there otherwise mobile objects will also trigger your monsters.
Update: Made the hub more welcome, and made sure git repo was welcoming and beginner friendly with an available release.