NotThatOneGuy
Chieftain
- Joined
- May 4, 2019
- Messages
- 4
I made a builder identical to the vanilla Builder, except he only has 1 build charge. I gift him to players (human and AI) with a lua script. Everything is working fine, except the AI refuses to use the custom Builder unless he is both able to be trained in a city and cheaper than the vanilla Builder. When I give them it at the start when they refuse to use it, all the AI's send the custom Builders to a random point on the map (I assume it is point (0, 0)?), and just builds a vanilla Builder to improve the first tiles instead.
I don't want the custom Builder to show up in the UI for building new units in cities. If I mark it with CanTrain="false" in the Units table while creating the unit, it works fine for me and doesn't show up as a buildable unit (as I wanted). However, the AI refuses to use it. The (useless) price of the custom Builder makes no difference.
If I leave the custom Builder in the UI for building new units in cities, but put their cost at 55 gold (+5 from the vanilla Builder), the AI refuses to use it again.
However, if I leave the custom Builder in the UI for building new units in cities, but put their cost at 45 gold (-5 from the vanilla Builder), the AI uses it immediately just fine. However, it will also build that custom Builder instead of the regular Builder, despite that it has only 1 charge.
Anybody know what might be going on or how to fix it?
Below are the properties/data used for the custom Builder (with price = 1, CanTrain=false):
INSERT INTO Types (Type , Kind )
VALUES ('UNIT_FREEBUILDER' , 'KIND_UNIT' );
INSERT INTO Units (UnitType , Cost, BaseMoves , BaseSightRange , ZoneOfControl , Domain , FormationClass , AdvisorType , Name , Description , CanCapture , CostProgressionModel , CostProgressionParam1 , CanTrain , PurchaseYield , BuildCharges)
VALUES ('UNIT_FREEBUILDER' , '1', '2' , '2' , 0 , 'DOMAIN_LAND' , 'FORMATION_CLASS_CIVILIAN' , 'ADVISOR_GENERIC' , 'LOC_UNIT_BUILDER_NAME' , 'LOC_UNIT_BUILDER_DESCRIPTION' , 0 , 'COST_PROGRESSION_PREVIOUS_COPIES' , '4' , 0 , 'YIELD_GOLD' , '1' );
INSERT INTO UnitAiInfos (UnitType , AiType )
VALUES ('UNIT_FREEBUILDER' , 'UNITAI_BUILD' ),
('UNIT_FREEBUILDER' , 'UNITTYPE_CIVILIAN' );
INSERT INTO UnitCaptures(CapturedUnitType , BecomesUnitType )
VALUES ('UNIT_FREEBUILDER' , 'UNIT_FREEBUILDER' );
INSERT INTO TypeTags(Type , Tag )
VALUES ('UNIT_FREEBUILDER' , 'CLASS_LANDCIVILIAN' ),
('UNIT_FREEBUILDER' , 'CLASS_BUILDER' );
INSERT INTO Units_XP2 (UnitType , CanEarnExperience , CanFormMilitaryFormation )
VALUES ('UNIT_FREEBUILDER' , 0 , 0 );
I don't want the custom Builder to show up in the UI for building new units in cities. If I mark it with CanTrain="false" in the Units table while creating the unit, it works fine for me and doesn't show up as a buildable unit (as I wanted). However, the AI refuses to use it. The (useless) price of the custom Builder makes no difference.
If I leave the custom Builder in the UI for building new units in cities, but put their cost at 55 gold (+5 from the vanilla Builder), the AI refuses to use it again.
However, if I leave the custom Builder in the UI for building new units in cities, but put their cost at 45 gold (-5 from the vanilla Builder), the AI uses it immediately just fine. However, it will also build that custom Builder instead of the regular Builder, despite that it has only 1 charge.
Anybody know what might be going on or how to fix it?
Below are the properties/data used for the custom Builder (with price = 1, CanTrain=false):
Spoiler Code :
INSERT INTO Types (Type , Kind )
VALUES ('UNIT_FREEBUILDER' , 'KIND_UNIT' );
INSERT INTO Units (UnitType , Cost, BaseMoves , BaseSightRange , ZoneOfControl , Domain , FormationClass , AdvisorType , Name , Description , CanCapture , CostProgressionModel , CostProgressionParam1 , CanTrain , PurchaseYield , BuildCharges)
VALUES ('UNIT_FREEBUILDER' , '1', '2' , '2' , 0 , 'DOMAIN_LAND' , 'FORMATION_CLASS_CIVILIAN' , 'ADVISOR_GENERIC' , 'LOC_UNIT_BUILDER_NAME' , 'LOC_UNIT_BUILDER_DESCRIPTION' , 0 , 'COST_PROGRESSION_PREVIOUS_COPIES' , '4' , 0 , 'YIELD_GOLD' , '1' );
INSERT INTO UnitAiInfos (UnitType , AiType )
VALUES ('UNIT_FREEBUILDER' , 'UNITAI_BUILD' ),
('UNIT_FREEBUILDER' , 'UNITTYPE_CIVILIAN' );
INSERT INTO UnitCaptures(CapturedUnitType , BecomesUnitType )
VALUES ('UNIT_FREEBUILDER' , 'UNIT_FREEBUILDER' );
INSERT INTO TypeTags(Type , Tag )
VALUES ('UNIT_FREEBUILDER' , 'CLASS_LANDCIVILIAN' ),
('UNIT_FREEBUILDER' , 'CLASS_BUILDER' );
INSERT INTO Units_XP2 (UnitType , CanEarnExperience , CanFormMilitaryFormation )
VALUES ('UNIT_FREEBUILDER' , 0 , 0 );