Unit groups cancel current action
Posted: Mon Sep 05, 2016 1:49 am
Hey,
In my Robot Army mod, i'm having a tough time making the units do things when requested.
Example: Squad of units is moving north, but a new command is given to them to move-to a position ~100 tiles south of their current location - 2 things I notice go wrong - the calcuation of the unitgroup position is wrong (the unit group circle moves south instead of staying with/near the units) and the units keep going north instead of stopping and turning back and moving to the new location.
I've tried this with the start_moving() command after setting the new position, and also without this.
I think in general it would be nice if the API for unit groups caused units to stop and re-evaluate their orders when they get a new command, or let modders request this with some kind of "cancel current action" command.
The calculation of the unit's position seems bugged because the API says "When the group is moving, the position is the expected position of its members along the path" the units can be WAY off and in my example the unit circle actually does what I want, going south to the new position, while the units continue north ignoring the orders. Their VIRTUAL unit group position/indicator DOES follow orders and ends up completing the order and thus my custom AI scripting thinks that the job is done despite the units being 100's of tiles away.
I suggest that the API is fixed so that the unit_group.position is calculated while moving to be the average position just like in attack mode, and that the units correctly stop what they are doing and act appropriately to their newly received command. This will make the unit commanding behaviour much more responsive and make things a lot easier for us modders to manipulate units (be they biters for AI mods like Misanthrope or Rampant AI, or in my case, friendly robotic soldiers)
In my Robot Army mod, i'm having a tough time making the units do things when requested.
Example: Squad of units is moving north, but a new command is given to them to move-to a position ~100 tiles south of their current location - 2 things I notice go wrong - the calcuation of the unitgroup position is wrong (the unit group circle moves south instead of staying with/near the units) and the units keep going north instead of stopping and turning back and moving to the new location.
I've tried this with the start_moving() command after setting the new position, and also without this.
I think in general it would be nice if the API for unit groups caused units to stop and re-evaluate their orders when they get a new command, or let modders request this with some kind of "cancel current action" command.
The calculation of the unit's position seems bugged because the API says "When the group is moving, the position is the expected position of its members along the path" the units can be WAY off and in my example the unit circle actually does what I want, going south to the new position, while the units continue north ignoring the orders. Their VIRTUAL unit group position/indicator DOES follow orders and ends up completing the order and thus my custom AI scripting thinks that the job is done despite the units being 100's of tiles away.
I suggest that the API is fixed so that the unit_group.position is calculated while moving to be the average position just like in attack mode, and that the units correctly stop what they are doing and act appropriately to their newly received command. This will make the unit commanding behaviour much more responsive and make things a lot easier for us modders to manipulate units (be they biters for AI mods like Misanthrope or Rampant AI, or in my case, friendly robotic soldiers)