I ran into this piece of code in file player_comptask.c:
Code:
TbBool create_task_dig_to_attack(struct Computer2 *comp, const struct Coord3d startpos, const struct Coord3d endpos, PlayerNumber victim_plyr_idx, long parent_cproc_idx)
{
struct ComputerTask *ctask;
SYNCDBG(7,"Starting");
ctask = get_free_task(comp, 0);
if (computer_task_invalid(ctask)) {
return false;
}
if ((gameadd.computer_chat_flags & CChat_TasksScarce) != 0) {
message_add_fmt(comp->dungeon->owner, "Player %d looks like he need a kick.",(int)victim_plyr_idx);
}
ctask->ttype = CTT_DigToAttack;
ctask->dig_somewhere.startpos.x.val = startpos.x.val;
ctask->dig_somewhere.startpos.y.val = startpos.y.val;
ctask->dig_somewhere.startpos.z.val = startpos.z.val;
ctask->dig_somewhere.endpos.x.val = endpos.x.val;
ctask->dig_somewhere.endpos.y.val = endpos.y.val;
ctask->dig_somewhere.endpos.z.val = endpos.z.val;
ctask->field_8C = parent_cproc_idx;
ctask->dig_somewhere.target_plyr_idx = victim_plyr_idx;
ctask->lastrun_turn = 0;
ctask->flags |= 0x04;
// Setup the digging
setup_dig_to(&ctask->dig, startpos, endpos);
return true;
}
My best guess is we should use this command to get the computer player to attack: SET_COMPUTER_GLOBALS(PLAYER1,7,7,7,7,7,7)
This command should make the CP dig a tunnel from one location to another, exactly what you'd want. Now just figure out what number to use instead of '7'.