Page 1 of 1

Removing a command from a unit's command que

Posted: 18 Mar 2007, 07:19
by EmMeister
I am currently making my first script which would have bombers (actually units from a list) attack their assigned target once and then remove it from their command que so that they will then continue on an egress path planned presumably to avoid enemy AA.

My question is, is it possible to remove a command from a units command que or do I have to simply recreate the command que less the current command?

EmMeister

Posted: 18 Mar 2007, 11:21
by Tobi
I think you need to do the last, recreate the que without the command(s) you want to delete.

Posted: 18 Mar 2007, 11:36
by trepan
But not for long ... ;)

Upcoming commit:

Code: Select all

* Added the CMD_INSERT and CMD_REMOVE commands
  (these can use the command tags, positions, and types)
To get this working, I had to add command "tags", to uniquely
identify every command that gets inserted into a unit's command
queue (or build queue or new unit command queue for factories).

CMD_INSERT
- insert by position (negative numbers to reference the back of the queue)
- insert before or after a tagged command

CMD_REMOVE
- remove all commands with a specific id (ex: remove all peewee builds)
- remove by command tag (multiple tags in a single command)

Posted: 18 Mar 2007, 11:48
by trepan
I forgot to mention the most of the state commands can now be
queued as well. FireState, MoveState, OnOff, Cloak, Trajectory,
Repeat, and Stockpile can be inserted into a command queue for
later execution (I haven't bothered with the others yet).

Posted: 18 Mar 2007, 12:37
by Licho
Nice, that can be very usefull :)

Posted: 19 Mar 2007, 11:22
by AF
How would a skirmish AI use these?

Posted: 19 Mar 2007, 11:42
by trepan
Subject to change:

id = CMD_INSERT
options.ALT -> treat param0 as a position instead of a tag
options.CONTROL -> use the build queue for factories
params[0] = position or command tag
params[1] = insertCmd id
params[2] = insertCmd options
params[3 ... N+2] = insertCmd params[0 ... N-1]

id = CMD_REMOVE
options.ALT -> use the parameters as commandIDs
options.CONTROL -> use the build queue for factories
params[0 ... N-1] = tags or commandIDs to remove

Posted: 31 Mar 2007, 10:28
by kuqa
This means it could be done a such widget that allows altering command queues on-the-fly dragging ala supcom ? SWEET :)

Posted: 31 Mar 2007, 18:35
by trepan
That could already be done, this just makes it easier/cheaper.
http://spring.clan-sy.com/phpbb/viewtop ... =dragndrop