Enemy Units dont spend their Action points


After last session, enemy units were spending their action points.

After this session, they are not.

Since we are using the same fonction (TakeAction()) as before, I dont understand where the problem is.

As anyone had this problem?

Hi @francois_roy. Welcome to the community

In the lecture Hugo changes the code to find the best enemy action and then adds new code to spend the action points. He then deletes the ‘old legacy’ code just below it that used to spend the points. Make sure you

  1. Added the new code to spend the points, and
  2. Did not accidentally delete the new code when you deleted the ‘old legacy’ code.

the last bit of the TryTakeEnemyAIAction function should look something like this

if (bestEnemyAIAction != null && enemyUnit.TrySpendActionPointsToTakeAction(bestBaseAction))
    bestBaseAction.TakeAction(bestEnemyAIAction.gridPosition, onEnemyAIActionComplete);
    return true;
    return false;


Thank you very much for your fast reply, it solved my problem right away!

I was using the CanSpendActionPointsToTakeAction() method instead of TrySpend.
[They both are identical, minus spending the action points.]