Water depth && Unit type values
Moderator: Moderators
Water depth && Unit type values
I'm working on my unviersal build routiens for NTai and I have no way of telling the difference between submarines amphibious units, and udnerwater structures, save wether they're mobile or not.
So, based on maxWaterDepth and MinWaterDepth, what would I expect for:
A submarine
A pelican/hvoercraft
A triton/croc/Gimp
An underwater mex
A normal building.
A normal unit
So, based on maxWaterDepth and MinWaterDepth, what would I expect for:
A submarine
A pelican/hvoercraft
A triton/croc/Gimp
An underwater mex
A normal building.
A normal unit
Re: Water depth && Unit type values
Don't these totally ignore water depth?AF wrote:A pelican/hvoercraft
I think if it has a minimum depth it can be classified as a sub, if it doesn't it can obviously move on land and is amphibious. Also I'd check more for underwater weapons as those matter more for submarine combat than the movement type. E.g. a construction sub shouldn't try to approach a torpedo-equipped amphibious unit.
The problem is, regardless of wether you define the tag, when i look through the AI itnerface it always has a value, so I need to know what that value represents and how ti works.
And I think floater=1 is used for hovercraft and pelicans, but it doesnt tell me anything about how MinWaterDepth and maxWaterDepth work
And I think floater=1 is used for hovercraft and pelicans, but it doesnt tell me anything about how MinWaterDepth and maxWaterDepth work
Re: Water depth && Unit type values
Also Floater, WaterLine and CanHover tags are useful here.AF wrote:So, based on maxWaterDepth and MinWaterDepth, what would I expect for:
Try something like this:
Code: Select all
if (ud->canhover) {
//it is a hovercraft
}
if (ud->minWaterDepth > 0) {
//it is a water-only unit or building
if (ud->floater || ud->waterline) {
if (ud->waterline > 10) {
//it is a sub
} else {
//it is a ship
}
}
else {
//it is something like underwater mex and stays at the bottom
}
}
if (ud->minWaterDepth <= 0) {
//it is a ground unit or building
if (ud->floater) {
//unit can float, like Pelican for example
}
else if (ud->maxWaterDepth > 30) {
//unit can move underwater
}
else {
//unit is ground only
}
}
Everything was tested and worked prefectly for AA and XTA but it was some time ago, so some values might need a little tweaking.
Btw it wasn't so hard find out with a look at mod files and some testing.
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
-
- Posts: 501
- Joined: 18 May 2006, 21:19
this check should be enough
also
with
Could this be moved to the AI forum now?
Code: Select all
if(ud->canfly && (ud->movedata==0))
Code: Select all
if(ud->type == string("Fighter"))
if(ud->type == string("Bomber"))
Code: Select all
if(ud->type == string("Fighter")){
if(ud->hoverattack == true){
//gunship
}else{
// fighter
}
}
ud->type is defined based on which Unit AI was assigned to the unit.
Gunships and fighters both have the same Unti AI and thus are assigned the Fighter value.
You need to check anythign with the Fighter value for the hoverattack value, which dictates wether a fighter circles its target like a gunship or if it atatcks like a hawk..
Factory
Builder
MetalExtractor
Ground
Fighter
Bomber
not sure about Ground and there may be another one to be added
Gunships and fighters both have the same Unti AI and thus are assigned the Fighter value.
You need to check anythign with the Fighter value for the hoverattack value, which dictates wether a fighter circles its target like a gunship or if it atatcks like a hawk..
Factory
Builder
MetalExtractor
Ground
Fighter
Bomber
not sure about Ground and there may be another one to be added
in that case you are doing something wrong.
GroupAI's and the Skirmish AI's have identical itnerfaces, infact they're the same interface.
Always check for error codes.
if the unit you're trying to check is out of LOS/radar and you shouldnt be able to tell what type of unit it is then cb->getUnitDef will return a null pointer.
Thus check if(ud){do stuff}else{skip}
GroupAI's and the Skirmish AI's have identical itnerfaces, infact they're the same interface.
Always check for error codes.
if the unit you're trying to check is out of LOS/radar and you shouldnt be able to tell what type of unit it is then cb->getUnitDef will return a null pointer.
Thus check if(ud){do stuff}else{skip}