OK. Thank you for the suggestion . I'll change my code. So, is it considered as caching if I put this "local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );" in AbilityUsageThink() and the pass it to some function call like this castDCDesire, castDCTarget = ConsiderDeathCoil(tableNearbyEnemyHeroes); ?
Last edited by arz_on4dt; 04-01-2017 at 04:51 AM.
It would be only really caching if you passed that table to other functions as well. If ConsiderDeathCoil() is the only function to use that table, then it is better to acquire it as you need it.
To truly cache you could do:
npcBot.nearEnemies = npcBot:GetNearbyHeroes(1600, true, BOT_MODE_NONE)
Then use that variable everywhere you need access to your enemies by doing the IsNull check as well as a range check to fit the range you want to consider.
There is some downsides to that, but it is the fastest way, especially if you had your own wrapper to make aquiery of the table a JIT call.
Last edited by nostrademous; 04-01-2017 at 05:27 AM.
^In the latest main client update.Fixed some crashes related to bot AI.
Arz may have changed his code, im using his old code and they still stay near the shrine for me.