But the thing is, my gears aim in a 360 degree radious but only fire in the forward 180 degree radious. And the whole point is that the torso should never swivel beyond those 180 degrees.
And why would the tanks be difficult, apart from the small turret on large turret they are all quite conventional i think? The MRP on the Hun tank is interesting but I don't think I'll make that a turreted weapon at all...
Units don't turn in order to fire their arc-ed weapons
Moderator: Moderators
There should also be a way to specify that certain weapons will work out their own targeting. While a unit's main weapons may be intended for a certain type of unit, it may also have secondary weapons that target all of their own accord, ie, mini flak turrets to protect a ship with a giant bertha on top or something. Right now this CAN be partially achieved through clever use of ONLYTARGETCATEGORYx, but this will mean that these lesser weapons won't fire at large targets even if those large targets are the only ones available.
This is a place where the old "attached unit" thing zwszg was talking about would be handy. You have a big ship with several small (1x1) turrets on it that are independant units - so if the player wants them to attack a selected target, he can, or if he wants them to behave autonomously, he can - and if he wants them to hold fire, he can. Of course, it means that one unit has the micro'ing tediousness of many. Did that ever get added to the engine?Caydr wrote:There should also be a way to specify that certain weapons will work out their own targeting. While a unit's main weapons may be intended for a certain type of unit, it may also have secondary weapons that target all of their own accord, ie, mini flak turrets to protect a ship with a giant bertha on top or something. Right now this CAN be partially achieved through clever use of ONLYTARGETCATEGORYx, but this will mean that these lesser weapons won't fire at large targets even if those large targets are the only ones available.
Currently its not possible for an AI to know the direction a unit is facing (unless there are some hidden functions somewhere). It can't ask a unit to change its direction either, we must use a move order right now
Some more problems:
There are no way to order only one weapon to fire. Its all or none (and none makes the unit do normal free fire).
This can be solved (i think) by using the "nonQueingCommands" list every unit have, and push orders to it instead of the normal "commandQue". It will also make it possible to order a unit to hold position while ordering it to attack, so that it wont move even if the target moves out of range.
Getting something like canTargetAndFireAtUnitWithoutMoveing(int myUnit, int enemyUnit, int weaponNumber) might be a good idea too.
Also usefull: obstructionExists(float3 startPos, float3 endPos) and related functions.
As KAI is doing its own micro management now its probably useless to have some of the unit scripts. A nice possibly here can be an "disable unit weapon/move/control scripts" command that an AI can give to units (but firenu is working on this, so I'm not sure).

Some more problems:
There are no way to order only one weapon to fire. Its all or none (and none makes the unit do normal free fire).
This can be solved (i think) by using the "nonQueingCommands" list every unit have, and push orders to it instead of the normal "commandQue". It will also make it possible to order a unit to hold position while ordering it to attack, so that it wont move even if the target moves out of range.
Getting something like canTargetAndFireAtUnitWithoutMoveing(int myUnit, int enemyUnit, int weaponNumber) might be a good idea too.
Also usefull: obstructionExists(float3 startPos, float3 endPos) and related functions.
As KAI is doing its own micro management now its probably useless to have some of the unit scripts. A nice possibly here can be an "disable unit weapon/move/control scripts" command that an AI can give to units (but firenu is working on this, so I'm not sure).
It will also make it possible to order a unit to hold position while ordering it to attack, so that it wont move even if the target moves out of range.
Code: Select all
// code to change a untis mvoe state to hold position
int unit = magicboxthatgivesunitID();
Command c;
c.id = CMD_MOVE_STATE;
c.params.push_back(0);
callback->GiveOrder(unit,&c);
1 = maneouvre
2 = roam
also CMD_FIRE_STATE
0 = hold fire
1 = return fire
2= Fire at will
You and firenu would do good to read NTai + OTAI source code as it's been doing stuff like custom firing and movement states and trajectory for quite a while now
Start a game, select the commander and set it to hold pos. Then order it to attack the ground or a unit outside its weapon range. This will make it move, and that's not what i wanted. Hold pos is intended for humans that dont watch their units every frame, not the AI. The CMD_FIRE_STATE command don't help either as it don't give us any control over each weapon independently.AF wrote:It will also make it possible to order a unit to hold position while ordering it to attack, so that it wont move even if the target moves out of range.0 = hold posCode: Select all
// code to change a untis mvoe state to hold position int unit = magicboxthatgivesunitID(); Command c; c.id = CMD_MOVE_STATE; c.params.push_back(0); callback->GiveOrder(unit,&c);
1 = maneouvre
2 = roam
also CMD_FIRE_STATE
0 = hold fire
1 = return fire
2= Fire at will
You and firenu would do good to read NTai + OTAI source code as it's been doing stuff like custom firing and movement states and trajectory for quite a while now

For a second thought I had a brilliant solution. I was going to say add c.options|=INTERNAL_ORDER; Unfortunately, that does not actually do what I had hoped. I may try to change that. (CMobilAI currently uses an internal bool and I don't understand why, and does not handle idle maneuver units properly in my opinion.)