UnitAITypes Question ?

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
I want to generate some barbarian stationnary units Through a map script (So i can't do a special promotion for that or set move=0 into unit xml ) .

The only way i found to do that is to set the UnitAIType to ICBM :

Code:
unit=gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit(gc.getInfoTypeForString("UNIT_TRUC"), dx, dy, UnitAITypes.NO_UNITAI)
unit.setUnitAIType(UnitAITypes.UNITAI_ICBM)

I played about 20 turns and all seems to go well : the barbarian units don't move even if you put a worker near them or if your culture include them .

My question is :

Does the UnitAIType is permanently ? (or AI may change it at every moment)
Does that may create bugs ? (setting a combat melee unit the UnitAITypes.UNITAI_ICBM may make anything else to stop working or bug)

I don't know anything about UnitAIType , I would appreciate if someone can explain me what append with that example , or where this is implemented ?

Thanks !
 
The Great Apple said:
Can't you just make a new unit type with no movement?

In fact , i want to generate some stationary unit which keep the goody huts through the mapscripts ( my aim is to make a kind of random scenario with many barbarians , this is at the frontier of the mapscript ) . And because of that , i can't touch anything on XML ( this is not a mod and all will be lost on reload ) .

So i test many things :

- If you generate a powerfull unit into a goody hut . It will keep the goody hut until the barbarian make some warrior that unfortunately replace the powerfull unit and you have a barbarian ruch at the 50st turn that destroy all .

- i try to put all them the unitAITypes.ANIMAL . all unit act like animals (so exploring is a bit difficult -> that's my aim ) .but they still can enter into your cultural borders and attack you .

The last thing i found is to set them unitAITypes.ICBM and even if i see there is no big bugs : unit are stationnary and all seems to work. I don't know what really happend when i do that and ask if someone may explain me how the PC deal with that or give me a track to found where's these functions are implemented ? :confused:

that's why i can't create the unit or create a promotion that turn the movement point to 0 . :sad:
 
I should have just answered your question really...

UnitAI types stick from a unit's birth to a unit's death. I don't know if it will cause any bugs, but I doubt it.
 
Many thanks !! :)

I will do like that and play some integral game to see i encounter bugs.

Tcho !
 
Back
Top Bottom