[Oxyd] [0.17.54] Unit Group gets stuck between move and attack commands in a compound command.
Posted: Sat Jul 06, 2019 3:19 am
I noticed this while trying to create a scenario/mod that creates some enemy groups and goes to attack the player or some player buildings.
In this particular case, they are trying to attack a stone furnace.
The problem is as follows:
1. Group is created and given a compound command with several "go_to_location" followed by an "attack" command.
2. The group executes all go_to_locations, and an on_ai_command_completed is done for all.
3. The group stops all movement and does not continue to the attack command. There is no on_ai_command_completed failed!
4. The group state is "moving".
5. Shooting them will get them out of the bad state. So the "distraction" part is still active.
6. 1 of the units in the group is rapidly spinning in one spot or something. Like it's shaking left and right or something. (in the picture attached, it's the one I circled in red)
https://gyazo.com/abaf56662044aae615ef2e12d0976f01 (This is what the biter looks like in gif form, but it's way way faster in the actual game, more like a blur.)
I uploaded my save of the one I shared in this pic. When I loaded that save I could see the unit group was still stuck.
I do not know how to reliably reproduce this. But it happens often enough I can retry with different locations and sometimes it fails.
In about 30 tries I probably saw it happen like 5 times, each with different target locations though.
This is what the compound command looks like:
I have not seen a case where a unit group just stops like this. Either a command fails and they disband, or they proceed with whatever other command is assigned or something.
Any ideas? Am I mis-using the commands somehow?
In this particular case, they are trying to attack a stone furnace.
The problem is as follows:
1. Group is created and given a compound command with several "go_to_location" followed by an "attack" command.
2. The group executes all go_to_locations, and an on_ai_command_completed is done for all.
3. The group stops all movement and does not continue to the attack command. There is no on_ai_command_completed failed!
4. The group state is "moving".
5. Shooting them will get them out of the bad state. So the "distraction" part is still active.
6. 1 of the units in the group is rapidly spinning in one spot or something. Like it's shaking left and right or something. (in the picture attached, it's the one I circled in red)
https://gyazo.com/abaf56662044aae615ef2e12d0976f01 (This is what the biter looks like in gif form, but it's way way faster in the actual game, more like a blur.)
I uploaded my save of the one I shared in this pic. When I loaded that save I could see the unit group was still stuck.
I do not know how to reliably reproduce this. But it happens often enough I can retry with different locations and sometimes it fails.
In about 30 tries I probably saw it happen like 5 times, each with different target locations though.
This is what the compound command looks like:
Code: Select all
-- I do this for a few path points:
table.insert(combined_commands, {type = defines.command.go_to_location,
destination = path[i].position,
pathfind_flags={low_priority=true}, -- I don't think this effects the issue I saw.
radius = 5, -- I don't think this effects the issue I saw.
distraction = defines.distraction.by_damage})
-- This is the attack:
table.insert(combined_commands, {type = defines.command.attack,
target = target,
distraction = defines.distraction.by_damage})
-- Compound command:
local compound_command =
{
type = defines.command.compound,
structure_type = defines.compound_command.return_last,
commands = combined_commands
}
I have not seen a case where a unit group just stops like this. Either a command fails and they disband, or they proceed with whatever other command is assigned or something.
Any ideas? Am I mis-using the commands somehow?