MasterKulon
Chieftain
- Joined
- Jun 9, 2011
- Messages
- 8
I am making a combat unit that has one build charge for any improvement that a builder can make (comparable to the Roman Legion). Everything seems functional so far, but I am getting a visual problem. The unit starts with only one guy visible, and he turns invisible after using the build charge. However, the unit is still alive and can move and attack as normal. I think the number of visible models is linked to the number of build charges rather than unit health, but I don't know how to fix this. Any advice would be appreciated. Here is my code:
Code:
-----------------------------------------------
-- Types
-----------------------------------------------
INSERT INTO Types
(Type, Kind )
VALUES ('TRAIT_CIVILIZATION_CUSTOM_UNIT', 'KIND_TRAIT' ),
('UNIT_CUSTOM_UNIT', 'KIND_UNIT' ),
('ABILITY_CUSTOM_UNIT', 'KIND_ABILITY' );
-----------------------------------------------
-- Tags
-----------------------------------------------
INSERT INTO Tags
(Tag, Vocabulary )
VALUES ('CLASS_CUSTOM_UNIT', 'ABILITY_CLASS' );
-----------------------------------------------
-- TypeTags
-----------------------------------------------
INSERT INTO TypeTags
(Type, Tag )
VALUES ('UNIT_CUSTOM_UNIT', 'CLASS_CUSTOM_UNIT' ),
('ABILITY_CUSTOM_UNIT', 'CLASS_CUSTOM_UNIT' );
INSERT INTO TypeTags (Type, Tag)
SELECT 'UNIT_CUSTOM_UNIT', Tag
FROM TypeTags
WHERE Type = 'UNIT_WARRIOR';
-----------------------------------------------
-- Traits
-----------------------------------------------
INSERT INTO Traits
(TraitType, Name )
VALUES ('TRAIT_CIVILIZATION_CUSTOM_UNIT', 'LOC_UNIT_CUSTOM_UNIT_NAME' );
-----------------------------------------------
-- CivilizationTraits
-----------------------------------------------
INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_CUSTOM_CIV', 'TRAIT_CIVILIZATION_CUSTOM_UNIT' );
-----------------------------------------------
-- Units
-----------------------------------------------
INSERT INTO Units (
UnitType,
Name,
Description,
TraitType,
BaseMoves,
Cost,
PurchaseYield,
AdvisorType,
Combat,
RangedCombat,
Range,
BaseSightRange,
ZoneOfControl,
Domain,
FormationClass,
PromotionClass,
Maintenance,
MandatoryObsoleteTech,
PrereqTech,
PrereqCivic,
BuildCharges
)
SELECT 'UNIT_CUSTOM_UNIT', -- UnitType
'LOC_UNIT_CUSTOM_UNIT_NAME', -- Name
'LOC_UNIT_CUSTOM_UNIT_DESCRIPTION', -- Description
'TRAIT_CIVILIZATION_CUSTOM_UNIT', -- TraitType
BaseMoves,
Cost,
PurchaseYield,
AdvisorType,
Combat,
RangedCombat,
Range,
BaseSightRange,
ZoneOfControl,
Domain,
FormationClass,
PromotionClass,
Maintenance,
MandatoryObsoleteTech,
PrereqTech,
PrereqCivic,
1
FROM Units
WHERE UnitType = 'UNIT_WARRIOR';
-----------------------------------------------
-- UnitUpgrades
-----------------------------------------------
INSERT INTO UnitUpgrades (Unit, UpgradeUnit)
SELECT 'UNIT_CUSTOM_UNIT', UpgradeUnit
FROM UnitUpgrades
WHERE Unit = 'UNIT_WARRIOR';
-----------------------------------------------
-- UnitAiInfos
-----------------------------------------------
INSERT INTO UnitAiInfos (UnitType, AiType)
SELECT 'UNIT_CUSTOM_UNIT', AiType
FROM UnitAiInfos
WHERE UnitType = 'UNIT_ROMAN_LEGION';
-----------------------------------------------
-- UnitReplaces
-----------------------------------------------
INSERT INTO UnitReplaces
(CivUniqueUnitType, ReplacesUnitType )
VALUES ('UNIT_CUSTOM_UNIT', 'UNIT_WARRIOR' );
-----------------------------------------------
-- UnitAbilities
-----------------------------------------------
INSERT INTO UnitAbilities
(UnitAbilityType, Name, Description )
VALUES ('ABILITY_CUSTOM_UNIT', 'LOC_ABILITY_CUSTOM_UNIT_NAME', 'LOC_ABILITY_CUSTOM_UNIT_DESCRIPTION' );
-- Improvement_ValidBuildUnits
-- Allow unit to build any improvement a builder can
INSERT INTO Improvement_ValidBuildUnits (ImprovementType, UnitType)
SELECT ImprovementType, 'UNIT_CUSTOM_UNIT'
FROM Improvement_ValidBuildUnits
WHERE UnitType = 'UNIT_BUILDER';
Last edited: