Thanks guys. My current setup is to superload Player:act() and then check the game.pause flag (and my ai flag) like so:
Code:
local old_act = _M.act
function _M:act()
old_act(game.player)
if (not game.pause) and _M.ai_active then
player_ai_act()
end
end
And it's mostly working. For some reason now, every time I try to rest from the AI it gives me an error that a dialog is up so it can't rest. This is partially true, because the "You are resting..." dialog is open, except that shouldn't stop resting. If I can clean that up so the AI can rest again, I'll have a fully-functional (basic) AI that rests, auto explores, and walks into enemies it can see.
EDIT UPDATE: I added "and not game.player.resting" to the condition, and it still SAYS resting stopped because of dialog, but it seems to rest properly anyways. However, I have now learned that hotkeys don't work while the AI is active because of how I interact with the act() function, so I can't stop the AI once it's on, and it starts autoexploring back and forth between the level entrance and exit. Progress!
_________________
Currently developing the
Player AI addon. You can get it from the
T-Engine Addon Hub or
SteamYou can also
view the source code.