Unit enters range callback
Moderators: hoijui, Moderators
Unit enters range callback
Hi, I was wondering if the AI interface (specifically the Java interface), had a callback for when an enemy unit enters a given units range (either reclaim or attack). I know this event happens internally (for instance, when an enemy enters the range of a LLT, it fires on the enemy), but it would be cool to program an AI where builders automatically reclaim nearby enemies. Specifically, this would make sense for nano towers, since you would want them to reclaim nearby enemies. Any idea how to achieve this behavior?
Re: Unit enters range callback
there's an widget for that, maybe see how it does it (was it smart nanos?)
Re: Unit enters range callback
In case anyone else wants to know: the widget "Smart Nanos" does this and can be found here: http://www.springfiles.com/show_file.php?id=1011
Re: Unit enters range callback
In each Update() call it scans units in a range. It does not use any specific event (if would exist).
Re: Unit enters range callback
In the Spring Engine and Skirmish AI world:
Callback: AI ----requests-something-from----> Engine
Event: Engine ----sends-to----> AI
Callback: AI ----requests-something-from----> Engine
Event: Engine ----sends-to----> AI
Re: Unit enters range callback
There were events for enemy unit entered radar and entered LOS in the legacy AI interface, there should be events in the other APIs too
Re: Unit enters range callback
But there are no events for unit entered attack or reclaim range.
Re: Unit enters range callback
If an enemy unit is not in LOS then the information should not be available anyway, thus the events would be pointless, as it would require a set of calculations be done. The whole point of the events is to avoid these calculations, but if they're done anyway then that defeats the point