Add a new unit in the game (using SQL)

nop, the database.log, in the log folder :)

you need to activate logging first (see whoward's tutorial in this section)
 
Many thanks for this Gedemon (and others who contributed) it helped me in starting out on SQL.

Regards

Riker13 :crazyeye:
 
Well it seems I have made an error somewhere, could some kind person please point it out where I have gone wrong before I :ar15:

I have made this unit the Evocatas which does show up fine in the game all works well except, its a UU for Rome but everybody can get it?

Also there is a syntax error on the first E (DEF) in ART_DEF_UNIT_EVOCATUS?

Please be gentle its my first day at SQL.

Regards

Riker13 :crazyeye:

SQL CODE:
Spoiler :
Code:
INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
	SELECT	('ART_DEF_UNIT_EVOCATUS'), DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_EVOCATUS'), ('ART_DEF_UNIT_MEMBER_EVOCATUS'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberCombats (UnitMemberType, EnableActions, DisableActions, MoveRadius, ShortMoveRadius, ChargeRadius, AttackRadius, RangedAttackRadius, MoveRate, ShortMoveRate, TurnRateMin, TurnRateMax, TurnFacingRateMin, TurnFacingRateMax, RollRateMin, RollRateMax, PitchRateMin, PitchRateMax, LOSRadiusScale, TargetRadius, TargetHeight, HasShortRangedAttack, HasLongRangedAttack, HasLeftRightAttack, HasStationaryMelee, HasStationaryRangedAttack, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation)
	SELECT	('ART_DEF_UNIT_MEMBER_EVOCATUS'), EnableActions, DisableActions, MoveRadius, ShortMoveRadius, ChargeRadius, AttackRadius, RangedAttackRadius, MoveRate, ShortMoveRate, TurnRateMin, TurnRateMax, TurnFacingRateMin, TurnFacingRateMax, RollRateMin, RollRateMax, PitchRateMin, PitchRateMax, LOSRadiusScale, TargetRadius, TargetHeight, HasShortRangedAttack, HasLongRangedAttack, HasLeftRightAttack, HasStationaryMelee, HasStationaryRangedAttack, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation
	FROM ArtDefine_UnitMemberCombats WHERE (UnitMemberType = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag)
	SELECT ('ART_DEF_UNIT_MEMBER_EVOCATUS'), "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberCombatWeapons WHERE (UnitMemberType = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_EVOCATUS'), Scale, ZOffset, Domain, ('LONGSWORDSMAN_ROME.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_StrategicView (StrategicViewType, TileType, Asset )
	SELECT	('ART_DEF_UNIT_EVOCATUS'), TileType, Asset
	FROM ArtDefine_StrategicView WHERE (StrategicViewType = 'ART_DEF_UNIT_LONGSWORDSMAN');

	INSERT INTO UnitClasses (Type, Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, DefaultUnit )
	SELECT ('UNITCLASS_EVOCATUS'), Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, ('UNIT_EVOCATUS')
	FROM UnitClasses WHERE (Type = 'UNITCLASS_LONGSWORDSMAN');

INSERT INTO Units (Type, Description, Civilopedia, Strategy, Help, Requirements, Combat, RangedCombat, Cost, Moves, Immobile, Range, BaseSightRange, Class, Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness, UnitArtInfo, UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate, UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas)
	SELECT	('UNIT_EVOCATUS'), ('EVOCATUS'), Civilopedia, Strategy, Help, Requirements,
			Combat, (25), (250), Moves, Immobile, (5), BaseSightRange, ('UNITCLASS_EVOCATUS'), Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness,
			('ART_DEF_UNIT_EVOCATUS'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
			UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
	FROM Units WHERE (Type = 'UNIT_LONGSWORDSMAN');

INSERT INTO Civilization_UnitClassOverrides (CivilizationType, UnitClassType, UnitType )
VALUES ('CIVILIZATION_ROME'), 'UNITCLASS_EVOCATUS', 'UNIT_LONGSWORDSMAN' );

INSERT INTO Unit_AITypes (UnitType, UnitAIType)
	SELECT ('UNIT_EVOCATUS'), UnitAIType
	FROM Unit_AITypes WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_ClassUpgrades (UnitType, UnitClassType)
	SELECT ('UNIT_EVOCATUS'), UnitClassType
	FROM Unit_ClassUpgrades WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
	SELECT ('UNIT_EVOCATUS'), FlavorType, Flavor
	FROM Unit_Flavors WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
	SELECT ('UNIT_EVOCATUS'), PromotionType
	FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_ResourceQuantityRequirements (UnitType, ResourceType, Cost)
	SELECT ('UNIT_EVOCATUS'), ResourceType, Cost
	FROM Unit_ResourceQuantityRequirements WHERE (UnitType = 'UNIT_LONGSWORDSMAN');
 
Hi Nutty,

Doh oh yes, done that but it still does not work, playing Greece I could still build the unit? Ummmmmmmm.
 
You shouldn't be making a new unit class. Delete the whole "INSERT INTO UnitClasses..." section and change "('UNITCLASS_EVOCATUS')" to "Class" in the "INSERT INTO Units..." section. [NB: don't actually put the quotes.]
 
Morning Nutty,

Well I changed the code as you suggested (see below) but now no one not even the Romans can make the unit and on the Civilopedia it says the Units cost is FREE?

Don't you just modding there is always something but its good once you figure it out :)

Spoiler :
Code:
INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
	SELECT	('ART_DEF_UNIT_EVOCATUS'), DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_EVOCATUS'), ('ART_DEF_UNIT_MEMBER_EVOCATUS'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberCombats (UnitMemberType, EnableActions, DisableActions, MoveRadius, ShortMoveRadius, ChargeRadius, AttackRadius, RangedAttackRadius, MoveRate, ShortMoveRate, TurnRateMin, TurnRateMax, TurnFacingRateMin, TurnFacingRateMax, RollRateMin, RollRateMax, PitchRateMin, PitchRateMax, LOSRadiusScale, TargetRadius, TargetHeight, HasShortRangedAttack, HasLongRangedAttack, HasLeftRightAttack, HasStationaryMelee, HasStationaryRangedAttack, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation)
	SELECT	('ART_DEF_UNIT_MEMBER_EVOCATUS'), EnableActions, DisableActions, MoveRadius, ShortMoveRadius, ChargeRadius, AttackRadius, RangedAttackRadius, MoveRate, ShortMoveRate, TurnRateMin, TurnRateMax, TurnFacingRateMin, TurnFacingRateMax, RollRateMin, RollRateMax, PitchRateMin, PitchRateMax, LOSRadiusScale, TargetRadius, TargetHeight, HasShortRangedAttack, HasLongRangedAttack, HasLeftRightAttack, HasStationaryMelee, HasStationaryRangedAttack, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing, HasOpponentTracking, HasCollisionAttack, AttackAltitude, AltitudeDecelerationDistance, OnlyTurnInMovementActions, RushAttackFormation
	FROM ArtDefine_UnitMemberCombats WHERE (UnitMemberType = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberCombatWeapons (UnitMemberType, "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag)
	SELECT ('ART_DEF_UNIT_MEMBER_EVOCATUS'), "Index", SubIndex, ID, VisKillStrengthMin, VisKillStrengthMax, ProjectileSpeed, ProjectileTurnRateMin, ProjectileTurnRateMax, HitEffect, HitEffectScale, HitRadius, ProjectileChildEffectScale, AreaDamageDelay, ContinuousFire, WaitForEffectCompletion, TargetGround, IsDropped, WeaponTypeTag, WeaponTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberCombatWeapons WHERE (UnitMemberType = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_EVOCATUS'), Scale, ZOffset, Domain, ('LONGSWORDSMAN_ROME.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_LONGSWORDSMAN');

INSERT INTO ArtDefine_StrategicView (StrategicViewType, TileType, Asset )
	SELECT	('ART_DEF_UNIT_EVOCATUS'), TileType, Asset
	FROM ArtDefine_StrategicView WHERE (StrategicViewType = 'ART_DEF_UNIT_LONGSWORDSMAN');

INSERT INTO Units (Type, Description, Civilopedia, Strategy, Help, Requirements, Combat, RangedCombat, Cost, Moves, Immobile, Range, BaseSightRange, Class, Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness, UnitArtInfo, UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate, UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas)
	SELECT	('UNIT_EVOCATUS'), ('EVOCATUS'), Civilopedia, Strategy, Help, Requirements,
			Combat, (25), (250), Moves, Immobile, (5), BaseSightRange, Class, Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, WorkRate, NumFreeTechs, RushBuilding, BaseHurry, HurryMultiplier, BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness,
			('ART_DEF_UNIT_EVOCATUS'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
			UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
	FROM Units WHERE (Type = 'UNIT_LONGSWORDSMAN');

INSERT INTO Civilization_UnitClassOverrides (CivilizationType, UnitClassType, UnitType )
VALUES ('CIVILIZATION_ROME', 'UNITCLASS_EVOCATUS', 'UNIT_LONGSWORDSMAN' );

INSERT INTO Unit_AITypes (UnitType, UnitAIType)
	SELECT ('UNIT_EVOCATUS'), UnitAIType
	FROM Unit_AITypes WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_ClassUpgrades (UnitType, UnitClassType)
	SELECT ('UNIT_EVOCATUS'), UnitClassType
	FROM Unit_ClassUpgrades WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
	SELECT ('UNIT_EVOCATUS'), FlavorType, Flavor
	FROM Unit_Flavors WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
	SELECT ('UNIT_EVOCATUS'), PromotionType
	FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_LONGSWORDSMAN');

INSERT INTO Unit_ResourceQuantityRequirements (UnitType, ResourceType, Cost)
	SELECT ('UNIT_EVOCATUS'), ResourceType, Cost
	FROM Unit_ResourceQuantityRequirements WHERE (UnitType = 'UNIT_LONGSWORDSMAN');
 
Nutty, I know we have not sorted the above post yet but if I wanted to make this a new class what differences would I need to make.

I thank you for your time and patience.

Riker 13 :crazyeye:
 
In the Civilization_UnitClassOverrides table, you've got UnitClassType and UnitType reversed.

As far as making it a new class, that's what you were doing the first time. If you want Rome to be the only one to be able to build your new unit, and you don't want it to replace an existing unit, then you'd need to make 2 new units with the same class: one being a dummy unit with a -1 cost, the other being the new unit unique to Rome.
 
Nutty should 'UNITCLASS_EVOCATUS', 'UNIT_LONGSWORDSMAN' be reversed as well?

VALUES ('CIVILIZATION_ROME', 'UNITCLASS_EVOCATUS', 'UNIT_LONGSWORDSMAN' );
 
VALUES ('CIVILIZATION_ROME', 'UNITCLASS_EVOCATUS', 'UNIT_LONGSWORDSMAN' );

Not quite. (Sorry I didn't make this clear.)
Code:
INSERT INTO Civilization_UnitClassOverrides (CivilizationType, UnitClassType, UnitType )
VALUES ('CIVILIZATION_ROME', 'UNITCLASS_LONGSWORDSMAN', 'UNIT_EVOCATUS' );
It should "read": For the Roman civilization, replace the unit of the longswordsman class with the Evocatus unit.
 
Cool thanks for that Nutty and thanks for your time and knowledge.

All the best.
 
Exactly how do you do the art defines for a mounted unit when the horse dds is separated from the unit dds?

nothing special, in that case the .fxsxml reference the .gr2 that is using the multiple .dds, just make sure the VFS property is set to true for all of those files.

the only file name that you will reference in your code is the .fxsxml file
 
You'll have to edit the model itself do to that, you'll need 3D tools and some knowledge in modelling (that I don't have).
 
I've referenced this post many times in the past (even the past month or so) but just recently got around to adding new unit graphics (normally used orphaned ones from scenarios with no alterations) and spent a week trying to figure out why they weren't working until late last night I noticed:

Pre-required : Right click your mod project in the Solution explorer windows, select "properties", go in the "Mod Info" panel, and check the "Reload Unit System" in the "Systems" section.

Nice red highlight and I'd overlooked that completely...
:wallbash:

So apparently my issue was just a short between the user and the keyboard.
:cry:
 
Thank you, I'm actually planning a Post-World War mod that will have new units and revamped units, new ideologies which does not follow a tenet but gives benefits and non-benefits.

New buildings, new resolutions for UN as well as revamped versions of existing resolutions, new improvements and possibly more
 
Top Bottom