UnitDef->moveType dought
Moderators: hoijui, Moderators
UnitDef->moveType dought
what does UnitDef->moveType field means what ????
ive tried it on a lot a diferent units like kbots and vehicles and planes and i always get 0!
am i doing something wrong ?
can anyone give more details on this ?
ive tried it on a lot a diferent units like kbots and vehicles and planes and i always get 0!
am i doing something wrong ?
can anyone give more details on this ?
well, moveData is a pointer. moveType, afaik, was the old way that spring used to store the move information.
now the pointer points directly to the class that handle the movement physics of the unit. so if you look at it you will find that buildings are set to null and that moving unit are set to something, wich point to a moveDAta class.
the need for this is that an automated parser should tag unit this way:
builder if canmove&&buildspeed>0
factory if !canmove&&buildspeed>0
turret if !canmove&&wapons.size()>0
and so on.
BUT factoryes in spring have canmove=true
I'don't know the motivation for this. an explanation is that maybe a factroy should be checked by the collision engine as it can be opened, and unit that cannot move are skipped by the collision check (units collides to them but they cannot actively collide, wich makes sense for a non-moving unit)
now the pointer points directly to the class that handle the movement physics of the unit. so if you look at it you will find that buildings are set to null and that moving unit are set to something, wich point to a moveDAta class.
the need for this is that an automated parser should tag unit this way:
builder if canmove&&buildspeed>0
factory if !canmove&&buildspeed>0
turret if !canmove&&wapons.size()>0
and so on.
BUT factoryes in spring have canmove=true
I'don't know the motivation for this. an explanation is that maybe a factroy should be checked by the collision engine as it can be opened, and unit that cannot move are skipped by the collision check (units collides to them but they cannot actively collide, wich makes sense for a non-moving unit)
That's essentially what I use, except that it's more like this:
Code: Select all
if(canbuild)
{
if(speed > 0)
builder
else
factory
}
well maybe my intentions werent very clear as i was trying to know ingame wich plat is wich (kbot, vehicle , air).
to find out wich ones are the plants i went on the builders UnitDef->buildOptions and look for builders (a con can only build plants and other structures , not units and thats what i built from).
Allthough i might take a look at your methods of doing this as my might not be very precise.
to find out wich ones are the plants i went on the builders UnitDef->buildOptions and look for builders (a con can only build plants and other structures , not units and thats what i built from).
Allthough i might take a look at your methods of doing this as my might not be very precise.
In that case I darent ever attempt AI code you write with the kindgoms mod. Considering that, there must be more to it otherwise builders would eb classed as factories for being able to build factories whcih can build things.Chocapic wrote:well maybe my intentions werent very clear as i was trying to know ingame wich plat is wich (kbot, vehicle , air).
to find out wich ones are the plants i went on the builders UnitDef->buildOptions and look for builders (a con can only build plants and other structures , not units and thats what i built from).
Allthough i might take a look at your methods of doing this as my might not be very precise.
Try this:
I think 0 = Tank, 1 = Kbot, 2 = Hover, 3 = Ship.
Look in the movedata.h file in the source.
Code: Select all
unitdef->movedata->movefamily
Look in the movedata.h file in the source.
Look at Taros in the TA:Kingdoms mod for spring. con units building other con units, heck even the usual way fo doing ti makes for somewhat messy play on Kingdoms, I'm gonna have to make NTAI build trees incapable of distinguishing between factorys and cons and treating them the same so I can be more robust while havign support for upgrade like structures beign built by factories.