Telling AI unit to attack

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
So I've created an AI combat unit using Lua and I want that unit to attack. And I want it to attack NOW and not on next turn (unit was created during AI's turn).

I believe I can do something like:
Code:
unit:PushMission(MissionTypes.MISSION_RANGE_ATTACK, plotX, plotY, 0, 0, 1, MissionTypes.MISSION_RANGE_ATTACK, unitPlot, unit)
But that only works if I do all the logic to select target myself. Is there any way to tell an AI unit to just do something (now!) using its own unit logic?
 
If you find out, can you pass the info on to Firaxis as they need it for their own scenarios ;)
 
From digging into the code, the issue is that units aren't consider in isolation by the AI. They are grouped, and then the groups go off and do something. So when you create a unit for the AI (which will run after the AI has processed all the existing units) it's not part of a group, so stands around doing nothing until the start of the next turn when it is assigned to a group. There is no (simple) way to say to the AI "make this unit / these units attack something" from Lua
 
Back
Top Bottom